From 3d37336ca568eb3e1f7e6f378336fbb91bbdfb3c Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sun, 16 May 2021 00:40:41 +0200 Subject: [PATCH] Fixed alt path items getting unhidden when rerolling them --- main.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index 51607516..6f6315a1 100644 --- a/main.lua +++ b/main.lua @@ -130,14 +130,18 @@ end ------------------------Handle ALT FLOOR CHOICE---------------------------- if REPENTANCE then local altPathItemCounter = 0 + local lastHidePosition = nullVector -- stores lastHide position to store Hide between Morphs / rerolls function EID:onCollectibleInit(pickup) - if pickup.FrameCount > 0 then + if pickup:GetData()["EID_IsAltChoise"] ~= nil then return end pickup:GetData()["EID_IsAltChoise"] = false if Game():GetRoom():GetType() == RoomType.ROOM_TREASURE and Game():GetLevel():GetStageType() > 3 and pickup.OptionsPickupIndex == 1 then - pickup:GetData()["EID_IsAltChoise"] = altPathItemCounter == 1 and not Isaac.GetPlayer(0):HasCollectible(668) + if altPathItemCounter == 1 and not Isaac.GetPlayer(0):HasCollectible(668) or (pickup.Position - lastHidePosition):Length() < 0.1 then + pickup:GetData()["EID_IsAltChoise"] = true + lastHidePosition = pickup.Position + end altPathItemCounter = altPathItemCounter + 1 end end @@ -145,6 +149,7 @@ if REPENTANCE then function EID:resetAltPathCounter() altPathItemCounter = 0 + lastHidePosition = nullVector end EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.resetAltPathCounter) end @@ -482,7 +487,7 @@ local function onRender(t) local closest = nil local dist = 10000 for i, entity in ipairs(Isaac.GetRoomEntities()) do - if EID:hasDescription(entity) then + if EID:hasDescription(entity) and entity.FrameCount > 0 then local diff = entity.Position:__sub(player.Position) if diff:Length() < dist then closest = entity