Active item touched status is now saved in between game restarts

This commit is contained in:
Wofsauge committed 2022-03-22 23:00:18 +01:00
1 parent a13ee770c3
commit 55f5b11f26
2 files changed
+17 -2

No files matched your search

+1 -1
View File
@@ -1483,7 +1483,7 @@ function EID:evaluateQueuedItems()
if not EID.TouchedActiveItems[i] then
EID.TouchedActiveItems[i] = {LastTouch = 0}
end
if EID.TouchedActiveItems[i].LastTouch + 60 >= game:GetFrameCount() and player.QueuedItem.Item then
if EID.TouchedActiveItems[i].LastTouch + 45 >= game:GetFrameCount() and player.QueuedItem.Item then
return
else
EID.TouchedActiveItems[i].LastTouch = 0
+16 -1
View File
@@ -1472,7 +1472,9 @@ EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
local function OnGameStartGeneral(_,isSave)
EID:buildTransformationTables()
EID.TouchedActiveItems = {}
if not isSave then
EID.TouchedActiveItems = {}
end
end
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, OnGameStartGeneral)
@@ -1486,6 +1488,7 @@ if EID.MCMLoaded or REPENTANCE then
["FlipItemPositions"] = true,
["AbsorbedItems"] = true,
["CollectedItems"] = true,
["TouchedActiveItems"] = true,
}
--------------------------------
--------Handle Savadata---------
@@ -1503,6 +1506,17 @@ if EID.MCMLoaded or REPENTANCE then
EID.SaveGame[EID.Config["SaveGameNumber"]].ItemNeedsPickup[id] = nil
end
end
EID.TouchedActiveItems = {}
if isSave then
-- JSON saves integer table keys as strings. we need to transform them back...
for playerID, data in pairs(savedEIDConfig["TouchedActiveItems"]) do
local convertedData = {}
for key, value in pairs(data) do
convertedData[tonumber(key) or key] = value
end
EID.TouchedActiveItems[tonumber(playerID)] = convertedData
end
end
if REPENTANCE then
EID.BagItems = {}
@@ -1589,6 +1603,7 @@ if EID.MCMLoaded or REPENTANCE then
EID.Config["FlipItemPositions"] = flipItemTable or {}
end
EID.Config["CollectedItems"] = EID.CollectedItems
EID.Config["TouchedActiveItems"] = EID.TouchedActiveItems or {}
EID.SaveData(EID, json.encode(EID.Config))
EID:hidePermanentText()