fix: various fix for zSortItem

This commit is contained in:
Kazhnuz 2020-09-13 16:58:42 +02:00
parent 250d75ee77
commit ea4f3a926c

View file

@ -202,6 +202,7 @@ function World3D:zSortItems(items)
end end
local _, aY, aZ, _, aH, aD = self.bodies:getCube(itemA.mainHitbox) local _, aY, aZ, _, aH, aD = self.bodies:getCube(itemA.mainHitbox)
local aDepth, aID, aType
aDepth = itemA.depth aDepth = itemA.depth
aID = itemA.creationID aID = itemA.creationID
aType = itemA.type aType = itemA.type
@ -210,6 +211,7 @@ function World3D:zSortItems(items)
for _, itemB in ipairs(overlapping) do for _, itemB in ipairs(overlapping) do
local _, bY, bZ, _, bH, bD = self.bodies:getCube(itemB.mainHitbox) local _, bY, bZ, _, bH, bD = self.bodies:getCube(itemB.mainHitbox)
local bDepth, bID, bType
bDepth = itemB.depth bDepth = itemB.depth
bID = itemB.creationID bID = itemB.creationID
bType = itemB.type bType = itemB.type
@ -246,7 +248,7 @@ function World3D:zSortItems(items)
elseif aID < bID then elseif aID < bID then
graph:add(itemB, itemA) graph:add(itemB, itemA)
else else
err("two object can't have the same ID") error("two object can't have the same ID")
end end
end end
end end