From a68107681e9335cfab732e0e7d88eb68a48d83dd Mon Sep 17 00:00:00 2001 From: Buurazu Date: Fri, 14 Jan 2022 03:01:01 -0500 Subject: [PATCH] Fix reloading after a mod change --- eid_tmtrainer.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eid_tmtrainer.lua b/eid_tmtrainer.lua index 194803ea..2c393c90 100644 --- a/eid_tmtrainer.lua +++ b/eid_tmtrainer.lua @@ -121,6 +121,10 @@ local function CheckLogForItems(_) eidDesc = EID:CheckGlitchedItemConfig(maxNumber - spawnedItems) .. eidDesc EID:addCollectible(maxNumber - spawnedItems, eidDesc) end + elseif string.find(line, "Game ended;") then + spawnedItems = 0 + lastEffectTrigger = "chain" + eidDesc = "" end line = theLog:read() @@ -146,3 +150,9 @@ local function GameStartTMTRAINER(_,isSave) spawnedItems = 0 end EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, GameStartTMTRAINER) + +local function GameEndTMTRAINER() + -- Our cursor spot in the log gets wiped if mods are reloaded; can't think of a better way than this + Isaac.DebugString("[EID] Game ended; ignore previous glitched items in the log!") +end +EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, GameEndTMTRAINER)