Merge pull request 'Change on scaffolding placement checking' (#4164) from JoseDouglas26/MineClone2:scaffolding_bug_fix into master

Reviewed-on: MineClone2/MineClone2#4164
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
the-real-herowl 2024-01-25 13:30:41 +00:00
commit b3bcd949b9
1 changed files with 8 additions and 3 deletions

View File

@ -316,10 +316,15 @@ 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
minetest.set_node(pointed.above, { name = SCAFFOLDING_NAME, param2 = 0 }) if (anode == "air" or minetest.registered_nodes[anode].buildable_to) and not mcl_bamboo.is_protected(pointed.above, placer) then
if not minetest.is_creative_enabled(placer:get_player_name()) then minetest.set_node(pointed.above, { name = SCAFFOLDING_NAME, param2 = 0 })
itemstack:take_item(1) if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item(1)
end
else
return
end end
return itemstack return itemstack
else else