Added updating the Collection page progress when collecting items
This commit is contained in:
1 parent
4f0ad9c27d
commit
507f4b72d9
2 files changed
+38
-8
No files matched your search
+16
-1
@@ -1261,6 +1261,21 @@ end
|
|||||||
|
|
||||||
-- Returns true if an item needs to be collected for the collection page
|
-- Returns true if an item needs to be collected for the collection page
|
||||||
function EID:requiredForCollectionPage(itemID)
|
function EID:requiredForCollectionPage(itemID)
|
||||||
if game:GetVictoryLap() > 0 or game:GetSeeds():IsCustomRun() or not EID.SaveGame or EID.Config["SaveGameNumber"] == 0 then return false end
|
if not EID.SaveGame or EID.Config["SaveGameNumber"] == 0 or game:GetVictoryLap() > 0 or game:GetSeeds():IsCustomRun() then return false end
|
||||||
return not EID.SaveGame[EID.Config["SaveGameNumber"]].ItemCollection[itemID]
|
return not EID.SaveGame[EID.Config["SaveGameNumber"]].ItemCollection[itemID]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Updates the item collection state of the players, based on the QueuedItem value.
|
||||||
|
-- TODO: also check for D100 / MissingNo Item collections
|
||||||
|
function EID:checkPlayersForMissingItems()
|
||||||
|
if not EID.SaveGame or EID.Config["SaveGameNumber"] == 0 or game:GetVictoryLap() > 0 or game:GetSeeds():IsCustomRun() then return end
|
||||||
|
if EID.GameUpdateCount % 5 ~= 0 then return end
|
||||||
|
|
||||||
|
for i = 0, game:GetNumPlayers() - 1 do
|
||||||
|
local player = Isaac.GetPlayer(i)
|
||||||
|
if player.QueuedItem.Item and EID.SaveGame[EID.Config["SaveGameNumber"]].ItemNeedsPickup[player.QueuedItem.Item.ID] then
|
||||||
|
table.insert(EID.CollectedItems, player.QueuedItem.Item.ID)
|
||||||
|
EID.SaveGame[EID.Config["SaveGameNumber"]].ItemNeedsPickup[player.QueuedItem.Item.ID] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -29,6 +29,7 @@ EID.itemConfig = Isaac.GetItemConfig()
|
|||||||
EID.itemUnlockStates = {}
|
EID.itemUnlockStates = {}
|
||||||
EID.CraneItemType = {}
|
EID.CraneItemType = {}
|
||||||
EID.absorbedItems = {}
|
EID.absorbedItems = {}
|
||||||
|
EID.CollectedItems = {}
|
||||||
local pathsChecked = {}
|
local pathsChecked = {}
|
||||||
local altPathItemChecked = {}
|
local altPathItemChecked = {}
|
||||||
|
|
||||||
@@ -823,6 +824,7 @@ EID.RecheckVoid = false
|
|||||||
|
|
||||||
function EID:onGameUpdate()
|
function EID:onGameUpdate()
|
||||||
EID.GameUpdateCount = EID.GameUpdateCount + 1
|
EID.GameUpdateCount = EID.GameUpdateCount + 1
|
||||||
|
EID:checkPlayersForMissingItems()
|
||||||
|
|
||||||
if collSpawned then
|
if collSpawned then
|
||||||
collSpawned = false
|
collSpawned = false
|
||||||
@@ -947,6 +949,7 @@ local function onRender(t)
|
|||||||
EID.GameRenderCount = EID.GameRenderCount + 1
|
EID.GameRenderCount = EID.GameRenderCount + 1
|
||||||
EID:resumeCoroutines()
|
EID:resumeCoroutines()
|
||||||
|
|
||||||
|
|
||||||
EID.isDisplaying = false
|
EID.isDisplaying = false
|
||||||
EID:setPlayer()
|
EID:setPlayer()
|
||||||
EID.TabPreviewID = 0
|
EID.TabPreviewID = 0
|
||||||
@@ -1205,21 +1208,31 @@ EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
|
|||||||
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
|
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
|
||||||
if EID.MCMLoaded or REPENTANCE then
|
if EID.MCMLoaded or REPENTANCE then
|
||||||
local json = require("json")
|
local json = require("json")
|
||||||
|
local configIgnoreList = {
|
||||||
|
["BagContent"] = true,
|
||||||
|
["BagFloorContent"] = true,
|
||||||
|
["CraneItemType"] = true,
|
||||||
|
["FlipItemPositions"] = true,
|
||||||
|
["AbsorbedItems"] = true,
|
||||||
|
["CollectedItems"] = true,
|
||||||
|
}
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------Handle Savadata---------
|
--------Handle Savadata---------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
function OnGameStart(_,isSave)
|
function OnGameStart(_,isSave)
|
||||||
--Loading Moddata--
|
--Loading Moddata--
|
||||||
local configIgnoreList = {
|
|
||||||
["BagContent"] = true,
|
|
||||||
["BagFloorContent"] = true,
|
|
||||||
["CraneItemType"] = true,
|
|
||||||
["FlipItemPositions"] = true,
|
|
||||||
["AbsorbedItems"] = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
if EID:HasData() then
|
if EID:HasData() then
|
||||||
local savedEIDConfig = json.decode(Isaac.LoadModData(EID))
|
local savedEIDConfig = json.decode(Isaac.LoadModData(EID))
|
||||||
|
|
||||||
|
-- collection progress
|
||||||
|
EID.CollectedItems = savedEIDConfig["CollectedItems"] or {}
|
||||||
|
if EID.Config["SaveGameNumber"] > 0 then
|
||||||
|
for _, id in ipairs(EID.CollectedItems) do
|
||||||
|
EID.SaveGame[EID.Config["SaveGameNumber"]].ItemNeedsPickup[id] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if REPENTANCE then
|
if REPENTANCE then
|
||||||
EID.BagItems = {}
|
EID.BagItems = {}
|
||||||
EID.CraneItemType = {}
|
EID.CraneItemType = {}
|
||||||
@@ -1305,6 +1318,8 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
end
|
end
|
||||||
EID.Config["FlipItemPositions"] = flipItemTable or {}
|
EID.Config["FlipItemPositions"] = flipItemTable or {}
|
||||||
end
|
end
|
||||||
|
EID.Config["CollectedItems"] = EID.CollectedItems
|
||||||
|
|
||||||
EID.SaveData(EID, json.encode(EID.Config))
|
EID.SaveData(EID, json.encode(EID.Config))
|
||||||
EID:hidePermanentText()
|
EID:hidePermanentText()
|
||||||
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
|
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
|
||||||
|
|||||||
Reference in new issue
Block a user