From 68896a939d3b44fc0b9799ae0f4b30c5de0ab67b Mon Sep 17 00:00:00 2001 From: Buurazu Date: Fri, 17 Dec 2021 03:24:14 -0500 Subject: [PATCH] Use render offset instead of shifting Mega Chest pedestal --- main.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.lua b/main.lua index e44c1cdc..fddfd0ca 100644 --- a/main.lua +++ b/main.lua @@ -574,8 +574,7 @@ function EID:onGameUpdate() local pos = entity.Position for _, otherPos in ipairs(curPositions) do 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) otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0) end @@ -750,6 +749,10 @@ local function onRender(t) for i, entity in ipairs(entitySearch) do if EID:hasDescription(entity) and entity.FrameCount > 0 then 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 EID.lastDescriptionEntity = entity EID.lastDist = diff:Length()