1
0
Fork 0

Fix item entity force-out bias to positive dir

This commit is contained in:
Wuzzy 2019-08-27 13:08:54 +02:00
parent f67c302c3d
commit 1cbee9de18
1 changed files with 4 additions and 4 deletions

View File

@ -543,8 +543,8 @@ core.register_entity(":__builtin:item", {
-- Push item out when stuck inside solid opaque node -- Push item out when stuck inside solid opaque node
if def and def.walkable and def.groups and def.groups.opaque == 1 then if def and def.walkable and def.groups and def.groups.opaque == 1 then
local shootdir local shootdir
local cx = p.x % 1 local cx = (p.x % 1) - 0.5
local cz = p.z % 1 local cz = (p.z % 1) - 0.5
local order = {} local order = {}
-- First prepare the order in which the 4 sides are to be checked. -- 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 -- 2nd: other direction
-- 3rd and 4th: other axis -- 3rd and 4th: other axis
local cxcz = function(o, cw, one, zero) 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 })
table.insert(o, { [one]=-1, y=0, [zero]=0 }) table.insert(o, { [one]=-1, y=0, [zero]=0 })
else else
@ -561,7 +561,7 @@ core.register_entity(":__builtin:item", {
end end
return o return o
end 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, cx, "x", "z")
order = cxcz(order, cz, "z", "x") order = cxcz(order, cz, "z", "x")
else else