From 1cbee9de18325a9e7c6208e96ec37d5dc096ed37 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 27 Aug 2019 13:08:54 +0200 Subject: [PATCH] Fix item entity force-out bias to positive dir --- mods/ENTITIES/mcl_item_entity/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f44917ccf..362824494 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -543,8 +543,8 @@ core.register_entity(":__builtin:item", { -- Push item out when stuck inside solid opaque node if def and def.walkable and def.groups and def.groups.opaque == 1 then local shootdir - local cx = p.x % 1 - local cz = p.z % 1 + local cx = (p.x % 1) - 0.5 + local cz = (p.z % 1) - 0.5 local order = {} -- First prepare the order in which the 4 sides are to be checked. @@ -552,7 +552,7 @@ core.register_entity(":__builtin:item", { -- 2nd: other direction -- 3rd and 4th: other axis local cxcz = function(o, cw, one, zero) - if cw > 0 then + if cw < 0 then table.insert(o, { [one]=1, y=0, [zero]=0 }) table.insert(o, { [one]=-1, y=0, [zero]=0 }) else @@ -561,7 +561,7 @@ core.register_entity(":__builtin:item", { end return o end - if math.abs(cx) > math.abs(cz) then + if math.abs(cx) < math.abs(cz) then order = cxcz(order, cx, "x", "z") order = cxcz(order, cz, "z", "x") else