rwmt / Multiplayer

Zetrith's Multiplayer mod for RimWorld
MIT License
481 stars 98 forks source link

Create PauseLockSession during PostLoadInit in ExposeData #493

Open SokyranTheDragon opened 3 months ago

SokyranTheDragon commented 3 months ago

Normally, calling UniqueIDsManager.GetNextID gives a warning when that happens, which made me realize that it's potentially unsafe to do so - the IDs may have not been loaded at that point. This should not happen when saving the data, as the session should exist at that point.

The solution here is to only create the session when Scribe.mode is LoadSaveMode.PostLoadInit. This ensures the IDs are initialized and getting the next ID won't cause any issues.