Several changes (see below)

Dropped support for punching doors to open them - only right-click now.

Moved gates out of fences and into doors file, renamed that file to
doors_and_gates.lua.

Changed gates to also use right click to open, and in the process
completely rewrote how gates are defined and managed; this necessitated
creating some duplicate textures.  Some of them are blank, and texture
pack authors may find the extra filenames useful anyway.

Node names for all gates have changed, aliases are provided for backward
compatibility.
This commit is contained in:
Vanessa Ezekowitz 2013-04-19 22:48:42 -04:00
parent 2f81946fad
commit 8fd34a9dc6
28 changed files with 295 additions and 537 deletions

View File

@ -1,226 +0,0 @@
-- Node definitions for Homedecor doors
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
local sides = {"left", "right"}
local rsides = {"right", "left"}
-- cheater's method of detecting if default doors are right-click-to-open:
-- default.generate_ore() was exposed to the modding API one day prior to the
-- right-click thing.
local use_rightclick = type(default.generate_ore)
for i in ipairs(sides) do
local side = sides[i]
local rside = rsides[i]
for j in ipairs(homedecor_door_models) do
local doorname = homedecor_door_models[j][1]
local doordesc = homedecor_door_models[j][2]
local nodeboxes_top = nil
local nodeboxes_bottom = nil
if side == "left" then
nodeboxes_top = homedecor_door_models[j][3]
nodeboxes_bottomtom = homedecor_door_models[j][4]
else
nodeboxes_top = homedecor_door_models[j][5]
nodeboxes_bottomtom = homedecor_door_models[j][6]
end
local tiles_top = {
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_lrt.png",
"homedecor_door_"..doorname.."_lrt.png",
"homedecor_door_"..doorname.."_"..rside.."_top.png",
"homedecor_door_"..doorname.."_"..side.."_top.png",
}
local tiles_bottom = {
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_lrb.png",
"homedecor_door_"..doorname.."_lrb.png",
"homedecor_door_"..doorname.."_"..rside.."_bottom.png",
"homedecor_door_"..doorname.."_"..side.."_bottom.png",
}
local selectboxes_top = {
type = "fixed",
fixed = { -0.5, -1.5, 6/16, 0.5, 0.5, 8/16}
}
local selectboxes_bottom = {
type = "fixed",
fixed = { -0.5, -0.5, 6/16, 0.5, 1.5, 8/16}
}
if use_rightclick == nil then -- register the version that uses on_punch
minetest.register_node("homedecor:door_"..doorname.."_top_"..side, {
description = doordesc.." "..S("(Top Half, %s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_top,
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_top,
node_box = {
type = "fixed",
fixed = nodeboxes_top
},
drop = "homedecor:door_"..doorname.."_bottom_"..side,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_"..doorname.."_bottom_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
end
end,
on_punch = function(pos, node, puncher)
homedecor_flip_door({x=pos.x, y=pos.y-1, z=pos.z}, node, puncher, doorname, side)
end
})
minetest.register_node("homedecor:door_"..doorname.."_bottom_"..side, {
description = doordesc.." "..S("(%s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_bottom,
inventory_image = "homedecor_door_"..doorname.."_"..side.."_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_bottom,
node_box = {
type = "fixed",
fixed = nodeboxes_bottomtom
},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_"..doorname.."_top_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
end
end,
on_punch = function(pos, node, puncher)
homedecor_flip_door(pos, node, puncher, doorname, side)
end,
on_place = function(itemstack, placer, pointed_thing)
return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side)
end,
})
else -- register the version that uses on_rightclick
minetest.register_node("homedecor:door_"..doorname.."_top_"..side, {
description = doordesc.." "..S("(Top Half, %s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_top,
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_top,
node_box = {
type = "fixed",
fixed = nodeboxes_top
},
drop = "homedecor:door_"..doorname.."_bottom_"..side,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_"..doorname.."_bottom_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
end
end,
on_rightclick = function(pos, node, clicker)
homedecor_flip_door({x=pos.x, y=pos.y-1, z=pos.z}, node, clicker, doorname, side)
end
})
minetest.register_node("homedecor:door_"..doorname.."_bottom_"..side, {
description = doordesc.." "..S("(%s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_bottom,
inventory_image = "homedecor_door_"..doorname.."_"..side.."_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_bottom,
node_box = {
type = "fixed",
fixed = nodeboxes_bottomtom
},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_"..doorname.."_top_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
end
end,
on_place = function(itemstack, placer, pointed_thing)
local node=minetest.env:get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name]
or not minetest.registered_nodes[node.name].on_rightclick then
return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side)
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end
end,
on_rightclick = function(pos, node, clicker)
homedecor_flip_door(pos, node, clicker, doorname, side)
end
})
end
end
end
function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
local pos = pointed_thing.above
if homedecor_node_is_owned(pointed_thing.under, placer) == false then
local nodename = minetest.env:get_node(pointed_thing.under).name
local field = nil
if minetest.registered_nodes[nodename] then field = minetest.registered_nodes[nodename].on_rightclick end
if field == nil then
fdir = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place a door!') )
return
end
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir})
minetest.env:add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir})
itemstack:take_item()
return itemstack
end
return minetest.item_place(itemstack, placer, pointed_thing)
end
end
function homedecor_flip_door(pos, node, player, name, side)
local rside = nil
local nfdir = nil
if side == "left" then
rside = "right"
nfdir=node.param2 - 1
if nfdir < 0 then nfdir = 3 end
else
rside = "left"
nfdir=node.param2 + 1
if nfdir > 3 then nfdir = 0 end
end
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..rside, param2=nfdir})
minetest.env:add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir})
end

294
doors_and_gates.lua Normal file
View File

@ -0,0 +1,294 @@
-- Node definitions for Homedecor doors
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
-- doors
local sides = {"left", "right"}
local rsides = {"right", "left"}
for i in ipairs(sides) do
local side = sides[i]
local rside = rsides[i]
for j in ipairs(homedecor_door_models) do
local doorname = homedecor_door_models[j][1]
local doordesc = homedecor_door_models[j][2]
local nodeboxes_top = nil
local nodeboxes_bottom = nil
if side == "left" then
nodeboxes_top = homedecor_door_models[j][3]
nodeboxes_bottomtom = homedecor_door_models[j][4]
else
nodeboxes_top = homedecor_door_models[j][5]
nodeboxes_bottomtom = homedecor_door_models[j][6]
end
local tiles_top = {
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_lrt.png",
"homedecor_door_"..doorname.."_lrt.png",
"homedecor_door_"..doorname.."_"..rside.."_top.png",
"homedecor_door_"..doorname.."_"..side.."_top.png",
}
local tiles_bottom = {
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_tb.png",
"homedecor_door_"..doorname.."_lrb.png",
"homedecor_door_"..doorname.."_lrb.png",
"homedecor_door_"..doorname.."_"..rside.."_bottom.png",
"homedecor_door_"..doorname.."_"..side.."_bottom.png",
}
local selectboxes_top = {
type = "fixed",
fixed = { -0.5, -1.5, 6/16, 0.5, 0.5, 8/16}
}
local selectboxes_bottom = {
type = "fixed",
fixed = { -0.5, -0.5, 6/16, 0.5, 1.5, 8/16}
}
minetest.register_node("homedecor:door_"..doorname.."_top_"..side, {
description = doordesc.." "..S("(Top Half, %s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_top,
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_top,
node_box = {
type = "fixed",
fixed = nodeboxes_top
},
drop = "homedecor:door_"..doorname.."_bottom_"..side,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_"..doorname.."_bottom_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
end
end,
on_rightclick = function(pos, node, clicker)
homedecor_flip_door({x=pos.x, y=pos.y-1, z=pos.z}, node, clicker, doorname, side)
end
})
minetest.register_node("homedecor:door_"..doorname.."_bottom_"..side, {
description = doordesc.." "..S("(%s-opening)"):format(side),
drawtype = "nodebox",
tiles = tiles_bottom,
inventory_image = "homedecor_door_"..doorname.."_"..side.."_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
selection_box = selectboxes_bottom,
node_box = {
type = "fixed",
fixed = nodeboxes_bottomtom
},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_"..doorname.."_top_"..side then
minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
end
end,
on_place = function(itemstack, placer, pointed_thing)
local node=minetest.env:get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name]
or not minetest.registered_nodes[node.name].on_rightclick then
return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side)
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end
end,
on_rightclick = function(pos, node, clicker)
homedecor_flip_door(pos, node, clicker, doorname, side)
end
})
end
end
-- Gates
local gates_list = { "picket", "picket_white", "barbed_wire", "chainlink" }
local gate_names = { "Unpainted Picket", "White Picket", "Barbed Wire", "Chainlink" }
local gate_models_closed = {
{{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }},
{{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }},
{{ -8/16, -8/16, 6/16, -6/16, 8/16, 8/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ -8/16, 7/16, 13/32, 8/16, 8/16, 15/32 }, -- top piece
{ -8/16, -8/16, 13/32, 8/16, -7/16, 15/32 }, -- bottom piece
{ -6/16, -8/16, 7/16, 6/16, 8/16, 7/16 }}, -- the wire
{{ -8/16, -8/16, 6/16, -7/16, 8/16, 8/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ -8/16, 7/16, 13/32, 8/16, 8/16, 15/32 }, -- top piece
{ -8/16, -8/16, 13/32, 8/16, -7/16, 15/32 }, -- bottom piece
{ -8/16, -8/16, 7/16, 8/16, 8/16, 7/16 }, -- the chainlink itself
{ -8/16, -3/16, 6/16, -6/16, 3/16, 8/16 }} -- the lump representing the lock
}
local gate_models_open = {
{{ 0.498, -0.5, -0.5, 0.498, 0.5, 0.5 }},
{{ 0.498, -0.5, -0.5, 0.498, 0.5, 0.5 }},
{{ 6/16, -8/16, -8/16, 8/16, 8/16, -6/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ 13/32, 7/16, -8/16, 15/32, 8/16, 8/16 }, -- top piece
{ 13/32, -8/16, -8/16, 15/32, -7/16, 8/16 }, -- bottom piece
{ 7/16, -8/16, -6/16, 7/16, 8/16, 6/16 }}, -- the wire
{{ 6/16, -8/16, -8/16, 8/16, 8/16, -7/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ 13/32, 7/16, -8/16, 15/32, 8/16, 8/16 }, -- top piece
{ 13/32, -8/16, -8/16, 15/32, -7/16, 8/16 }, -- bottom piece
{ 7/16, -8/16, -8/16, 7/16, 8/16, 8/16 }, -- the chainlink itself
{ 6/16, -3/16, -8/16, 8/16, 3/16, -6/16 }} -- the lump representing the lock
}
for i in ipairs(gates_list) do
local gate=gates_list[i]
minetest.register_node("homedecor:gate_"..gate.."_closed", {
drawtype = "nodebox",
description = S(gate_names[i].." Fence Gate"),
tiles = {
"homedecor_gate_"..gate.."_top.png",
"homedecor_gate_"..gate.."_bottom.png",
"homedecor_gate_"..gate.."_left.png",
"homedecor_gate_"..gate.."_right.png",
"homedecor_gate_"..gate.."_back.png",
"homedecor_gate_"..gate.."_front.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = gate_models_closed[i]
},
on_rightclick = function(pos, node, clicker)
homedecor_flip_gate(pos, node, clicker, gate, "closed")
end
})
minetest.register_node("homedecor:gate_"..gate.."_open", {
drawtype = "nodebox",
description = S(gate_names[i].." Fence Gate"),
tiles = {
"homedecor_gate_"..gate.."_top.png",
"homedecor_gate_"..gate.."_bottom.png",
"homedecor_gate_"..gate.."_front.png",
"homedecor_gate_"..gate.."_back.png",
"homedecor_gate_"..gate.."_left.png",
"homedecor_gate_"..gate.."_right.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed ={ 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = gate_models_open[i]
},
drop = "homedecor:gate_"..gate.."_closed",
on_rightclick = function(pos, node, clicker)
homedecor_flip_gate(pos, node, clicker, gate, "open")
end
})
end
minetest.register_alias("homedecor:fence_barbed_wire_gate_open", "homedecor:gate_chainlink_open")
minetest.register_alias("homedecor:fence_barbed_wire_gate_closed", "homedecor:gate_chainlink_closed")
minetest.register_alias("homedecor:fence_chainlink_gate_open", "homedecor:gate_barbed_wire_open")
minetest.register_alias("homedecor:fence_chainlink_gate_closed", "homedecor:gate_barbed_wire_closed")
minetest.register_alias("homedecor:fence_picket_gate_open", "homedecor:gate_picket_open")
minetest.register_alias("homedecor:fence_picket_gate_closed", "homedecor:gate_picket_closed")
minetest.register_alias("homedecor:fence_picket_gate_white_open", "homedecor:gate_picket_white_open")
minetest.register_alias("homedecor:fence_picket_gate_white_closed", "homedecor:gate_picket_white_closed")
----- helper functions
function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
local pos = pointed_thing.above
if homedecor_node_is_owned(pointed_thing.under, placer) == false then
local nodename = minetest.env:get_node(pointed_thing.under).name
local field = nil
if minetest.registered_nodes[nodename] then field = minetest.registered_nodes[nodename].on_rightclick end
if field == nil then
fdir = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place a door!') )
return
end
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir})
minetest.env:add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir})
itemstack:take_item()
return itemstack
end
return minetest.item_place(itemstack, placer, pointed_thing)
end
end
function homedecor_flip_door(pos, node, player, name, side)
local rside = nil
local nfdir = nil
if side == "left" then
rside = "right"
nfdir=node.param2 - 1
if nfdir < 0 then nfdir = 3 end
else
rside = "left"
nfdir=node.param2 + 1
if nfdir > 3 then nfdir = 0 end
end
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..rside, param2=nfdir})
minetest.env:add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir})
end
function homedecor_flip_gate(pos, node, player, gate, oc)
local fdir = node.param2
if oc == "closed" then
minetest.env:add_node(pos, { name = "homedecor:gate_"..gate.."_open", param2=fdir})
else
minetest.env:add_node(pos, { name = "homedecor:gate_"..gate.."_closed", param2=fdir})
end
end

View File

@ -456,316 +456,6 @@ minetest.register_node("homedecor:fence_chainlink_corner", {
}, },
}) })
-- =====
-- Gates
minetest.register_node("homedecor:fence_picket_gate_closed", {
drawtype = "nodebox",
description = S("Unpainted Picket Fence Gate"),
tiles = {
"homedecor_blanktile.png",
"homedecor_blanktile.png",
"homedecor_fence_picket_gate.png",
"homedecor_fence_picket_gate.png",
"homedecor_fence_picket_gate_backside.png",
"homedecor_fence_picket_gate.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
},
})
minetest.register_node("homedecor:fence_picket_gate_open", {
drawtype = "nodebox",
description = S("Unpainted Picket Fence Gate"),
tiles = {
"homedecor_blanktile.png",
"homedecor_blanktile.png",
"homedecor_fence_picket_gate.png",
"homedecor_fence_picket_gate_backside.png",
"homedecor_fence_picket_gate.png",
"homedecor_fence_picket_gate.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { 0.498, -0.5, -0.5, 0.498, 0.5, 0.5 }
},
drop = "homedecor:fence_picket_gate_closed"
})
minetest.register_node("homedecor:fence_picket_gate_white_closed", {
drawtype = "nodebox",
description = S("White Picket Fence Gate"),
tiles = {
"homedecor_blanktile.png",
"homedecor_blanktile.png",
"homedecor_fence_picket_gate_white.png",
"homedecor_fence_picket_gate_white.png",
"homedecor_fence_picket_gate_white_backside.png",
"homedecor_fence_picket_gate_white.png"
},
-- inventory_image = "homedecor_fence_picket_gate.png",
-- wield_image = "homedecor_fence_picket_gate.png",
paramtype = "light",
is_ground_content = true,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
},
})
minetest.register_node("homedecor:fence_picket_gate_white_open", {
drawtype = "nodebox",
description = S("White Picket Fence Gate"),
tiles = {
"homedecor_blanktile.png",
"homedecor_blanktile.png",
"homedecor_fence_picket_gate_white.png",
"homedecor_fence_picket_gate_white_backside.png",
"homedecor_fence_picket_gate_white.png",
"homedecor_fence_picket_gate_white.png"
},
-- inventory_image = "homedecor_fence_picket_gate.png",
-- wield_image = "homedecor_fence_picket_gate.png",
paramtype = "light",
is_ground_content = true,
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { 0.498, -0.5, -0.5, 0.498, 0.5, 0.5 }
},
drop = "homedecor:fence_picket_gate_closed"
})
minetest.register_node("homedecor:fence_barbed_wire_gate_closed", {
drawtype = "nodebox",
description = S("Barbed Wire Fence Gate"),
tiles = {
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_backside.png",
"homedecor_fence_barbed_wire_gate_front.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, 6/16, -6/16, 8/16, 8/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ -8/16, 7/16, 13/32, 8/16, 8/16, 15/32 }, -- top piece
{ -8/16, -8/16, 13/32, 8/16, -7/16, 15/32 }, -- bottom piece
{ -6/16, -8/16, 7/16, 6/16, 8/16, 7/16 } -- the wire
}
},
})
minetest.register_node("homedecor:fence_barbed_wire_gate_open", {
drawtype = "nodebox",
description = S("Barbed Wire Fence Gate"),
tiles = {
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_front.png",
"homedecor_fence_barbed_wire_gate_backside.png",
"homedecor_fence_barbed_wire_gate_edges.png",
"homedecor_fence_barbed_wire_gate_edges.png"
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { 0.375, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = {
{ 6/16, -8/16, -8/16, 8/16, 8/16, -6/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ 13/32, 7/16, -8/16, 15/32, 8/16, 8/16 }, -- top piece
{ 13/32, -8/16, -8/16, 15/32, -7/16, 8/16 }, -- bottom piece
{ 7/16, -8/16, -6/16, 7/16, 8/16, 6/16 } -- the wire
}
},
drop = "homedecor:fence_barbed_wire_gate_closed"
})
minetest.register_node("homedecor:fence_chainlink_gate_closed", {
drawtype = "nodebox",
description = S("Chainlink Fence Gate"),
tiles = {
"homedecor_fence_chainlink_gate_tb.png",
"homedecor_fence_chainlink_gate_tb.png",
"homedecor_fence_chainlink_gate_sides.png",
"homedecor_fence_chainlink_gate_sides.png",
"homedecor_fence_chainlink_gate_backside.png",
"homedecor_fence_chainlink_gate_front.png",
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, 6/16, -7/16, 8/16, 8/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ -8/16, 7/16, 13/32, 8/16, 8/16, 15/32 }, -- top piece
{ -8/16, -8/16, 13/32, 8/16, -7/16, 15/32 }, -- bottom piece
{ -8/16, -8/16, 7/16, 8/16, 8/16, 7/16 }, -- the chainlink itself
{ -8/16, -3/16, 6/16, -6/16, 3/16, 8/16 } -- the lump representing the lock
}
},
})
minetest.register_node("homedecor:fence_chainlink_gate_open", {
drawtype = "nodebox",
description = S("Chainlink Fence Gate (open)"),
tiles = {
"homedecor_fence_chainlink_gate_tb.png",
"homedecor_fence_chainlink_gate_tb.png",
"homedecor_fence_chainlink_gate_front.png",
"homedecor_fence_chainlink_gate_backside.png",
"homedecor_fence_chainlink_gate_sides.png",
"homedecor_fence_chainlink_gate_sides.png",
},
paramtype = "light",
is_ground_content = true,
groups = {snappy=3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = { 0.375, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = {
{ 6/16, -8/16, -8/16, 8/16, 8/16, -7/16 }, -- left post
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 }, -- right post
{ 13/32, 7/16, -8/16, 15/32, 8/16, 8/16 }, -- top piece
{ 13/32, -8/16, -8/16, 15/32, -7/16, 8/16 }, -- bottom piece
{ 7/16, -8/16, -8/16, 7/16, 8/16, 8/16 }, -- the chainlink itself
{ 6/16, -3/16, -8/16, 8/16, 3/16, -6/16 } -- the lump representing the lock
}
},
drop = "homedecor:fence_chainlink_gate_closed"
})
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_picket_gate_white_closed" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_picket_gate_white_open", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_picket_gate_white_open" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_picket_gate_white_closed", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_picket_gate_closed" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_picket_gate_open", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_picket_gate_open" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_picket_gate_closed", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_barbed_wire_gate_closed" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_barbed_wire_gate_open", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_barbed_wire_gate_open" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_barbed_wire_gate_closed", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_chainlink_gate_closed" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_chainlink_gate_open", param2 = fdir })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="homedecor:fence_chainlink_gate_open" then
fdir=node.param2
minetest.env:add_node(pos, { name = "homedecor:fence_chainlink_gate_closed", param2 = fdir })
end
end)
minetest.register_alias("homedecor:fence_wood_with_sign", "signs:sign_post") minetest.register_alias("homedecor:fence_wood_with_sign", "signs:sign_post")
homedecor_register_fence_with_sign("default:fence_wood", "signs:sign_post") homedecor_register_fence_with_sign("default:fence_wood", "signs:sign_post")

View File

@ -72,7 +72,7 @@ dofile(minetest.get_modpath("homedecor").."/shutters.lua")
dofile(minetest.get_modpath("homedecor").."/shingles.lua") dofile(minetest.get_modpath("homedecor").."/shingles.lua")
dofile(minetest.get_modpath("homedecor").."/door_models.lua") dofile(minetest.get_modpath("homedecor").."/door_models.lua")
dofile(minetest.get_modpath("homedecor").."/door_nodes.lua") dofile(minetest.get_modpath("homedecor").."/doors_and_gates.lua")
dofile(minetest.get_modpath("homedecor").."/signs_lib.lua") dofile(minetest.get_modpath("homedecor").."/signs_lib.lua")
dofile(minetest.get_modpath("homedecor").."/fences.lua") dofile(minetest.get_modpath("homedecor").."/fences.lua")

View File

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 562 B

View File

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 397 B

View File

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

View File

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 601 B

View File

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

View File

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

View File

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B