forked from mtcontrib/homedecor_modpack
also make the japanese door use the expand function, giving it a proper construction (buildable_to) and prevent crashes when rightclicking onknown nodes with it
This commit is contained in:
parent
5b35bb571b
commit
0341a00f9f
@ -625,7 +625,7 @@ minetest.register_node("homedecor:tatami_mat", {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("homedecor:jpn_door_bottom", {
|
homedecor.register("jpn_door_bottom", {
|
||||||
description = "Japanese-style door",
|
description = "Japanese-style door",
|
||||||
inventory_image = "homedecor_jpn_door_inv.png",
|
inventory_image = "homedecor_jpn_door_inv.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -635,9 +635,6 @@ minetest.register_node("homedecor:jpn_door_bottom", {
|
|||||||
"homedecor_japanese_wall_edges.png",
|
"homedecor_japanese_wall_edges.png",
|
||||||
"homedecor_japanese_door_bottom.png"
|
"homedecor_japanese_door_bottom.png"
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = { snappy = 3 },
|
groups = { snappy = 3 },
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
@ -657,27 +654,7 @@ minetest.register_node("homedecor:jpn_door_bottom", {
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, 0, 0.5, 1.5, 0.0625},
|
fixed = {-0.5, -0.5, 0, 0.5, 1.5, 0.0625},
|
||||||
},
|
},
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
expand = { top = "homedecor:jpn_door_top" },
|
||||||
|
|
||||||
local pointed = pointed_thing.under
|
|
||||||
local pnode = minetest.get_node(pointed)
|
|
||||||
local pname = pnode.name
|
|
||||||
local rnodedef = minetest.registered_nodes[pname]
|
|
||||||
|
|
||||||
if rnodedef.on_rightclick then
|
|
||||||
rnodedef.on_rightclick(pointed, pnode, placer)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
|
||||||
"homedecor:jpn_door_bottom", "homedecor:jpn_door_top")
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
|
||||||
if minetest.get_node(pos2).name == "homedecor:jpn_door_top" then
|
|
||||||
minetest.remove_node(pos2)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
fdir = minetest.get_node(pos).param2
|
fdir = minetest.get_node(pos).param2
|
||||||
minetest.set_node(pos, {name = "homedecor:jpn_door_bottom_open", param2 = fdir})
|
minetest.set_node(pos, {name = "homedecor:jpn_door_bottom_open", param2 = fdir})
|
||||||
|
Loading…
Reference in New Issue
Block a user