diff --git a/mods/ENTITIES/mcl_falling_nodes/init.lua b/mods/ENTITIES/mcl_falling_nodes/init.lua index a0882ce962..9290f9e268 100644 --- a/mods/ENTITIES/mcl_falling_nodes/init.lua +++ b/mods/ENTITIES/mcl_falling_nodes/init.lua @@ -118,9 +118,28 @@ minetest.register_entity(":__builtin:falling_node", { return end local vel = self.object:getvelocity() + -- Fix position if entity does not move if vector.equals(vel, {x = 0, y = 0, z = 0}) then - local npos = self.object:getpos() - self.object:setpos(vector.round(npos)) + local npos = vector.round(self.object:getpos()) + local npos2 = table.copy(npos) + npos2.y = npos2.y - 2 + local lownode = minetest.get_node(npos2) + -- Special check required for fences, because of their overhigh collision box. + if minetest.get_item_group(lownode.name, "fence") == 1 then + -- Instantly stop the node if it is above a fence. This is needed + -- because the falling node collides early with a fence node. + -- Hacky, because the falling node will teleport a short distance, instead + -- of smoothly fall on the fence post. + local npos3 = table.copy(npos) + npos3.y = npos3.y - 1 + minetest.add_node(npos3, self.node) + self.object:remove() + minetest.check_for_falling(npos3) + return + else + -- Normal position fix (expected case) + self.object:setpos(npos) + end end end }) diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index 5d8f80425c..9b9e1a19f6 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -12,11 +12,11 @@ local z2 = {-1/16, 4/16, 2/16, 1/16, 7/16, 0.5} --oben(quer) z local z22 = {-1/16, -2/16, 2/16, 1/16, 1/16, 0.5} --unten(quer) z -- Collision box -local cp = {-2/16, -0.5, -2/16, 2/16, 1, 2/16} -local cx1 = {-0.5, -2/16, -2/16, -2/16, 1, 2/16} --unten(quer) -x -local cx2 = {2/16, -2/16, -2/16, 0.5, 1, 2/16} --unten(quer) x -local cz1 = {-2/16, -2/16, -0.5, 2/16, 1, -2/16} --unten(quer) -z -local cz2 = {-2/16, -2/16, 2/16, 2/16, 1, 0.5} --unten(quer) z +local cp = {-2/16, -0.5, -2/16, 2/16, 1.01, 2/16} +local cx1 = {-0.5, -2/16, -2/16, -2/16, 1.01, 2/16} --unten(quer) -x +local cx2 = {2/16, -2/16, -2/16, 0.5, 1.01, 2/16} --unten(quer) x +local cz1 = {-2/16, -2/16, -0.5, 2/16, 1.01, -2/16} --unten(quer) -z +local cz2 = {-2/16, -2/16, 2/16, 2/16, 1.01, 0.5} --unten(quer) z mcl_fences = {}