From acda876e9cc763f68224e60a7c2b350d119c4946 Mon Sep 17 00:00:00 2001 From: kohashiwakaba Date: Wed, 20 Apr 2022 14:42:44 +0900 Subject: [PATCH] Quick fix for Crane Game + Glowing Hour Glass --- main.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/main.lua b/main.lua index 7a49f391..73aa6c6c 100644 --- a/main.lua +++ b/main.lua @@ -33,6 +33,7 @@ EID.sacrificeCounter = {} EID.itemConfig = Isaac.GetItemConfig() EID.itemUnlockStates = {} EID.CraneItemType = {} +EID.LastCraneType = {} EID.absorbedItems = {} EID.CollectedItems = {} EID.IgnoredEntities = {} @@ -255,6 +256,19 @@ if REPENTANCE then local lastGetItemResult = {nil, nil, nil, nil} -- itemID, Frame, gridIndex, InitSeed local lastFrameGridChecked = 0 + local function RevertCraneGameItems() + for seed, collectibleType in pairs(EID.LastCraneType) do + if EID.CraneItemType[seed] then + EID.CraneItemType[seed] = EID.LastCraneType[seed] + end + end + end + + local function OnUseGlowingHourGlass(_, _, _, player) + RevertCraneGameItems() + end + EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseGlowingHourGlass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS) + function EID:postGetCollectible(selectedCollectible, itemPoolType, decrease, seed) -- Handle Crane Game if itemPoolType == ItemPoolType.POOL_CRANE_GAME then @@ -740,6 +754,17 @@ if REPENTANCE then initialItemNext = false flipItemNext = false EID:AssignFlipItems() + + -- Handle Crane Game + if REPENTANCE then + EID.LastCraneType = {} + for _, crane in ipairs(Isaac.FindByType(6, 16, -1, true, false)) do + if EID.CraneItemType[tostring(crane.InitSeed)] then + EID.LastCraneType[tostring(crane.InitSeed)] = EID.CraneItemType[tostring(crane.InitSeed)] + end + end + end + end EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom) end @@ -1566,6 +1591,7 @@ if EID.MCMLoaded or REPENTANCE then if REPENTANCE then EID.BagItems = {} EID.CraneItemType = {} + EID.LastCraneType = {} EID.flipItemPositions = {} EID.absorbedItems = {}