Improve saving/loading without MCM

This commit is contained in:
Buurazu authored and GitHub committed 2022-09-30 06:57:44 -04:00
1 parent bc068e2e40
commit ce975bdbc3
1 file changed
+3 -9
+3 -9
View File
@@ -18,6 +18,7 @@ EID.coopMainPlayers = {} -- The primary Player Entity for each controller being
EID.coopAllPlayers = {} -- Every Player Entity (includes Esau, T.Forgotten) EID.coopAllPlayers = {} -- Every Player Entity (includes Esau, T.Forgotten)
EID.controllerIndexes = {} -- A table to map each controller index to their player number for coloring indicators EID.controllerIndexes = {} -- A table to map each controller index to their player number for coloring indicators
EID.isMultiplayer = false -- Used to color P1's highlight/outline indicators (single player just uses white) EID.isMultiplayer = false -- Used to color P1's highlight/outline indicators (single player just uses white)
EID.BoC = {}
-- general variables -- general variables
EID.PositionModifiers = {} EID.PositionModifiers = {}
@@ -1602,8 +1603,6 @@ function EID:OnUseCard(cardID, player, useFlags)
end end
EID:AddCallback(ModCallbacks.MC_USE_CARD, EID.OnUseCard) EID:AddCallback(ModCallbacks.MC_USE_CARD, EID.OnUseCard)
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
if EID.MCMLoaded or REPENTANCE then
local json = require("json") local json = require("json")
local configIgnoreList = { local configIgnoreList = {
["BagContent"] = true, ["BagContent"] = true,
@@ -1680,7 +1679,8 @@ if EID.MCMLoaded or REPENTANCE then
end end
end end
-- Only copy Saved config entries that exist in the save -- Check if eid_config.lua is in its default state (like if an EID update occurred)
-- If it is, or MCM is loaded, load the config from savedata instead of eid_config.lua
if savedEIDConfig.Version == EID.Config.Version then if savedEIDConfig.Version == EID.Config.Version then
local isDefaultConfig = true local isDefaultConfig = true
for key, value in pairs(EID.Config) do for key, value in pairs(EID.Config) do
@@ -1699,11 +1699,7 @@ if EID.MCMLoaded or REPENTANCE then
end end
end end
end end
-- DisableAchievementCheck has been renamed, convert the setting to the new one (this can be removed in a few updates)
if savedEIDConfig["DisableAchievementCheck"] then
EID.Config["DisableStartOfRunWarnings"] = savedEIDConfig["DisableAchievementCheck"]
end end
EID.isHidden = EID.Config["InitiallyHidden"] EID.isHidden = EID.Config["InitiallyHidden"]
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
EID.Scale = EID.Config["Size"] EID.Scale = EID.Config["Size"]
@@ -1712,7 +1708,6 @@ if EID.MCMLoaded or REPENTANCE then
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt") EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
end end
end end
end
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, OnGameStart) EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, OnGameStart)
--Saving Moddata-- --Saving Moddata--
@@ -1744,7 +1739,6 @@ if EID.MCMLoaded or REPENTANCE then
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS] = nil EID.itemUnlockStates[CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS] = nil
end end
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame) EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
end
if EID.enableDebug then if EID.enableDebug then
require("eid_debugging") require("eid_debugging")