Change on scaffolding placement checking

This commit is contained in:
José Douglas da Silva Souza 2024-01-23 20:05:45 +00:00
parent 1175be45fb
commit 9b9271e5df

@ -316,11 +316,16 @@ minetest.register_node(SCAFFOLDING_NAME, {
-- A quick check, that may or may not work, to attempt to prevent placing things on the side of other nodes. -- A quick check, that may or may not work, to attempt to prevent placing things on the side of other nodes.
local dir = vector.subtract(pointed.under, pointed.above) local dir = vector.subtract(pointed.under, pointed.above)
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
local anode = minetest.get_node(pointed.above).name
if wdir == 1 then if wdir == 1 then
if anode == "air" or minetest.registered_nodes[anode].buildable_to then
minetest.set_node(pointed.above, { name = SCAFFOLDING_NAME, param2 = 0 }) minetest.set_node(pointed.above, { name = SCAFFOLDING_NAME, param2 = 0 })
if not minetest.is_creative_enabled(placer:get_player_name()) then if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item(1) itemstack:take_item(1)
end end
else
return
end
return itemstack return itemstack
else else
return return