diff --git a/eid_api.lua b/eid_api.lua index 2973bbbd..a2030984 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -739,7 +739,7 @@ end -- Result: "3{{Crafting3}}2{{Crafting2}}3{{Crafting1}}" function EID:tableToCraftingIconsMerged(craftTable) table.sort(craftTable, function(a, b) return a > b end) - filteredList = {} + local filteredList = {} for _,nr in ipairs(craftTable) do if filteredList[nr] == nil then filteredList[nr] = 1 diff --git a/eid_bagOfCrafting.lua b/eid_bagOfCrafting.lua index 2e0969df..8e8d8beb 100644 --- a/eid_bagOfCrafting.lua +++ b/eid_bagOfCrafting.lua @@ -405,7 +405,7 @@ EID:AddCallback(ModCallbacks.MC_PRE_PICKUP_COLLISION, function(_, pickup,collide return end -- Remove pickups picked up normally - pickupsOnInitCorrected = {} + local pickupsOnInitCorrected = {} for _,e in ipairs (pickupsOnInit) do if GetPtrHash(pickup) ~= GetPtrHash(e) then table.insert(pickupsOnInitCorrected, e) @@ -440,7 +440,6 @@ EID:AddCallback(ModCallbacks.MC_POST_ENTITY_REMOVE, function(_, bag) end end end - end, EntityType.ENTITY_KNIFE) local holdCounter = 0 @@ -494,6 +493,7 @@ function EID:handleBagOfCraftingRendering() for i, v in ipairs(floorItems) do table.insert(itemQuery, v) end + for i, v in ipairs(EID.BagItems) do table.insert(itemQuery, v) end diff --git a/main.lua b/main.lua index 16386ea4..2613274a 100644 --- a/main.lua +++ b/main.lua @@ -679,10 +679,16 @@ if EID.MCMLoaded or REPENTANCE then -------------------------------- --------Handle Savadata--------- -------------------------------- - function OnGameStart(isSave) + function OnGameStart(_,isSave) --Loading Moddata-- if EID:HasData() then local savedEIDConfig = json.decode(Isaac.LoadModData(EID)) + if REPENTANCE and isSave then + EID.BagItems = savedEIDConfig["BagContent"] + savedEIDConfig["BagContent"] = nil + else + EID.BagItems = {} + end -- Only copy Saved config entries that exist in the save if savedEIDConfig.Version == EID.Config.Version then local isDefaultConfig = true @@ -708,6 +714,9 @@ if EID.MCMLoaded or REPENTANCE then --Saving Moddata-- function SaveGame() + if REPENTANCE then + EID.Config["BagContent"] = EID.BagItems or {} + end EID.SaveData(EID, json.encode(EID.Config)) end EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)