Add fence rails

Dedicated fence rail textures coming in a follow-up PR.
This commit is contained in:
TumeniNodes 2018-07-07 14:03:33 -04:00 committed by Paramat
parent ecea5364f1
commit 7e1b07fddd
5 changed files with 178 additions and 12 deletions

View File

@ -1015,6 +1015,37 @@ minetest.register_craft({
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_rail_aspen_wood",
burntime = 3,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_rail_pine_wood",
burntime = 4,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_rail_wood",
burntime = 5,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_rail_acacia_wood",
burntime = 6,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_rail_junglewood",
burntime = 7,
})
minetest.register_craft({
type = "fuel",
recipe = "default:bush_stem",

View File

@ -303,7 +303,7 @@ function default.register_fence(name, def)
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
},
connects_to = {"group:fence", "group:wood", "group:tree"},
connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
inventory_image = fence_texture,
wield_image = fence_texture,
tiles = {def.texture},
@ -327,6 +327,71 @@ function default.register_fence(name, def)
end
--
-- Fence rail registration helper
--
function default.register_fence_rail(name, def)
minetest.register_craft({
output = name .. " 16",
recipe = {
{ def.material, def.material },
{ "", ""},
{ def.material, def.material },
}
})
local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture ..
"^default_fence_rail_overlay.png^[makealpha:255,126,126"
-- Allow almost everything to be overridden
local default_fields = {
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {
{-1/16, 3/16, -1/16, 1/16, 5/16, 1/16},
{-1/16, -3/16, -1/16, 1/16, -5/16, 1/16}
},
-- connect_top =
-- connect_bottom =
connect_front = {
{-1/16, 3/16, -1/2, 1/16, 5/16, -1/16},
{-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}},
connect_left = {
{-1/2, 3/16, -1/16, -1/16, 5/16, 1/16},
{-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}},
connect_back = {
{-1/16, 3/16, 1/16, 1/16, 5/16, 1/2},
{-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}},
connect_right = {
{1/16, 3/16, -1/16, 1/2, 5/16, 1/16},
{1/16, -5/16, -1/16, 1/2, -3/16, 1/16}},
},
connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
inventory_image = fence_rail_texture,
wield_image = fence_rail_texture,
tiles = {def.texture},
sunlight_propagates = true,
is_ground_content = false,
groups = {},
}
for k, v in pairs(default_fields) do
if def[k] == nil then
def[k] = v
end
end
-- Always add to the fence group, even if no group provided
def.groups.fence = 1
def.texture = nil
def.material = nil
minetest.register_node(name, def)
end
--
-- Leafdecay
--

View File

@ -2590,8 +2590,10 @@ minetest.register_node("default:ladder_steel", {
default.register_fence("default:fence_wood", {
description = "Apple Wood Fence",
texture = "default_fence_wood.png",
inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
inventory_image = "default_fence_overlay.png^default_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -2600,8 +2602,10 @@ default.register_fence("default:fence_wood", {
default.register_fence("default:fence_acacia_wood", {
description = "Acacia Wood Fence",
texture = "default_fence_acacia_wood.png",
inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
inventory_image = "default_fence_overlay.png^default_acacia_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_acacia_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
material = "default:acacia_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -2610,8 +2614,10 @@ default.register_fence("default:fence_acacia_wood", {
default.register_fence("default:fence_junglewood", {
description = "Jungle Wood Fence",
texture = "default_fence_junglewood.png",
inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
inventory_image = "default_fence_overlay.png^default_junglewood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_junglewood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
material = "default:junglewood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -2620,8 +2626,10 @@ default.register_fence("default:fence_junglewood", {
default.register_fence("default:fence_pine_wood", {
description = "Pine Wood Fence",
texture = "default_fence_pine_wood.png",
inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
inventory_image = "default_fence_overlay.png^default_pine_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_pine_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
material = "default:pine_wood",
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
sounds = default.node_sound_wood_defaults()
@ -2630,13 +2638,75 @@ default.register_fence("default:fence_pine_wood", {
default.register_fence("default:fence_aspen_wood", {
description = "Aspen Wood Fence",
texture = "default_fence_aspen_wood.png",
inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
inventory_image = "default_fence_overlay.png^default_aspen_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_aspen_wood.png^" ..
"default_fence_overlay.png^[makealpha:255,126,126",
material = "default:aspen_wood",
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("default:fence_rail_wood", {
description = "Apple Wood Fence Rail",
texture = "default_wood.png",
inventory_image = "default_fence_rail_overlay.png^default_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^default_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("default:fence_rail_acacia_wood", {
description = "Acacia Wood Fence Rail",
texture = "default_acacia_wood.png",
inventory_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "default:acacia_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("default:fence_rail_junglewood", {
description = "Jungle Wood Fence Rail",
texture = "default_junglewood.png",
inventory_image = "default_fence_rail_overlay.png^default_junglewood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^default_junglewood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "default:junglewood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("default:fence_rail_pine_wood", {
description = "Pine Wood Fence Rail",
texture = "default_pine_wood.png",
inventory_image = "default_fence_rail_overlay.png^default_pine_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^default_pine_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "default:pine_wood",
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("default:fence_rail_aspen_wood", {
description = "Aspen Wood Fence Rail",
texture = "default_aspen_wood.png",
inventory_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" ..
"default_fence_rail_overlay.png^[makealpha:255,126,126",
material = "default:aspen_wood",
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
minetest.register_node("default:glass", {
description = "Glass",
drawtype = "glasslike_framed_optional",

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

View File

@ -14,7 +14,7 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou
connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}},
connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}},
},
connects_to = { "group:wall", "group:stone" },
connects_to = { "group:wall", "group:stone", "group:fence" },
paramtype = "light",
is_ground_content = false,
tiles = { wall_texture, },