Use render offset instead of shifting Mega Chest pedestal
This commit is contained in:
1 parent
efca551ec9
commit
68896a939d
1 file changed
+5
-2
@@ -574,8 +574,7 @@ function EID:onGameUpdate()
|
|||||||
local pos = entity.Position
|
local pos = entity.Position
|
||||||
for _, otherPos in ipairs(curPositions) do
|
for _, otherPos in ipairs(curPositions) do
|
||||||
if pos:Distance(otherPos[2]) == 0 then
|
if pos:Distance(otherPos[2]) == 0 then
|
||||||
-- adjust the position so Mega Chests can have both descriptions viewable
|
--entity.Position = entity.Position + Vector(1,0)
|
||||||
entity.Position = entity.Position + Vector(1,0)
|
|
||||||
entity:GetData()["EID_RenderOffset"] = Vector(10,0)
|
entity:GetData()["EID_RenderOffset"] = Vector(10,0)
|
||||||
otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0)
|
otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0)
|
||||||
end
|
end
|
||||||
@@ -750,6 +749,10 @@ local function onRender(t)
|
|||||||
for i, entity in ipairs(entitySearch) do
|
for i, entity in ipairs(entitySearch) do
|
||||||
if EID:hasDescription(entity) and entity.FrameCount > 0 then
|
if EID:hasDescription(entity) and entity.FrameCount > 0 then
|
||||||
local diff = entity.Position:__sub(sourcePos)
|
local diff = entity.Position:__sub(sourcePos)
|
||||||
|
-- break ties with the render offset (for Mega Chest double collectibles)
|
||||||
|
if diff:Length() == EID.lastDist and entity:GetData()["EID_RenderOffset"] then
|
||||||
|
diff = diff + entity:GetData()["EID_RenderOffset"]
|
||||||
|
end
|
||||||
if diff:Length() < EID.lastDist then
|
if diff:Length() < EID.lastDist then
|
||||||
EID.lastDescriptionEntity = entity
|
EID.lastDescriptionEntity = entity
|
||||||
EID.lastDist = diff:Length()
|
EID.lastDist = diff:Length()
|
||||||
|
|||||||
Reference in new issue
Block a user