1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Use itemstack name when placing doors (#2888)

This commit is contained in:
LoneWolfHT 2021-10-31 11:17:31 -07:00 committed by GitHub
parent 31f7d57889
commit 5875820542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,6 +264,7 @@ function doors.register(name, def)
return itemstack return itemstack
end end
local doorname = itemstack:get_name()
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
local pdef = minetest.registered_nodes[node.name] local pdef = minetest.registered_nodes[node.name]
if pdef and pdef.on_rightclick and if pdef and pdef.on_rightclick and
@ -315,10 +316,10 @@ function doors.register(name, def)
local state = 0 local state = 0
if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then
state = state + 2 state = state + 2
minetest.set_node(pos, {name = name .. "_b", param2 = dir}) minetest.set_node(pos, {name = doorname .. "_b", param2 = dir})
minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4}) minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4})
else else
minetest.set_node(pos, {name = name .. "_a", param2 = dir}) minetest.set_node(pos, {name = doorname .. "_a", param2 = dir})
minetest.set_node(above, {name = "doors:hidden", param2 = dir}) minetest.set_node(above, {name = "doors:hidden", param2 = dir})
end end