Improve saving/loading without MCM
This commit is contained in:
1 parent
bc068e2e40
commit
ce975bdbc3
1 file changed
+15
-21
@@ -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,10 +1603,8 @@ 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
|
local json = require("json")
|
||||||
if EID.MCMLoaded or REPENTANCE then
|
local configIgnoreList = {
|
||||||
local json = require("json")
|
|
||||||
local configIgnoreList = {
|
|
||||||
["BagContent"] = true,
|
["BagContent"] = true,
|
||||||
["BagFloorContent"] = true,
|
["BagFloorContent"] = true,
|
||||||
["CraneItemType"] = true,
|
["CraneItemType"] = true,
|
||||||
@@ -1614,11 +1613,11 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
["CollectedItems"] = true,
|
["CollectedItems"] = true,
|
||||||
["PlayerItemInteractions"] = true,
|
["PlayerItemInteractions"] = true,
|
||||||
["UsedPillColors"] = true,
|
["UsedPillColors"] = true,
|
||||||
}
|
}
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------Handle Savadata---------
|
--------Handle Savadata---------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
function OnGameStart(_,isSave)
|
function OnGameStart(_,isSave)
|
||||||
--Loading Moddata--
|
--Loading Moddata--
|
||||||
|
|
||||||
if EID:HasData() then
|
if EID:HasData() then
|
||||||
@@ -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"]
|
||||||
@@ -1711,12 +1707,11 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
EID:fixDefinedFont()
|
EID:fixDefinedFont()
|
||||||
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--
|
||||||
function SaveGame()
|
function SaveGame()
|
||||||
if REPENTANCE then
|
if REPENTANCE then
|
||||||
EID.Config["BagContent"] = EID.BoC.BagItems or {}
|
EID.Config["BagContent"] = EID.BoC.BagItems or {}
|
||||||
EID.Config["BagFloorContent"] = EID.BoC.RoomQueries or {}
|
EID.Config["BagFloorContent"] = EID.BoC.RoomQueries or {}
|
||||||
@@ -1742,9 +1737,8 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
EID:hidePermanentText()
|
EID:hidePermanentText()
|
||||||
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
|
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
|
||||||
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
|
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
|
||||||
end
|
end
|
||||||
|
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
||||||
|
|
||||||
if EID.enableDebug then
|
if EID.enableDebug then
|
||||||
require("eid_debugging")
|
require("eid_debugging")
|
||||||
|
|||||||
Reference in new issue
Block a user