Jump to content

Germs corrupting save file - EntombedItemManager


pether
  • Branch: Live Branch Version: Windows Pending

EntombedItemManager saves information about burried items in several lists. One of those lists is:

private List<byte> diseaseIndices = new List<byte>();

The list contains byte index of germs infesting each entombed item. Those values are serialized to save info between games. If after next game load the index of a germ changes, the manager is not aware of it and will use old value. As a result, burried items may change their germs or - if the index exceedes germ count in the database - the game crashes.

Please note, germs changing their idx currently may happen only when using (and eg disabling) germ-related mods and will never happen in vanilla games. It is hard for a mod to fix things that happen when it becomes disabled, but still - it is purly modded issue. Please consider it when assigning a priority to the issue.

In my germ-related mod I was able to work-around this issue, feel free to peek into the code and use it for game improvements as an inspiration or copy source:

DiseasesExpanded_Patches_EntombedItems saves current germ idx for each game save and allows to translate them after next game reload if the idx of a germ changes. However, I feel it would be more efficient if EntombedItemManager saved ID of a germ instead it's idx in the list, as the ID will not change even if the germ gets disabled (I couldn't do that, I had to work with current structures in my mod, but I feel you guys could)

DiseasesExpanded_Patches_PrimaryElement adds additional check for germ-adding method of primary element - if the germ idx is not found in the db, addition does not happen. This does not prevent changing idx between games, but is good safety net to prevent crashes when something would try to add non-existing germ

 


Steps to Reproduce

1. Spawn item covered in modded germs

2. Entomb it in a tile of sand/snow

3. Save the game, disable germ mod

4. Reload the game. It may crash now, if the germ idx is bigger than total germ count in the db.

5. Dig the item - it will be covered with different germs now

  • Like 1



User Feedback


Attaching save file to reproduce the issue, using beta branch

Next to the printing pod there is sand, try to dig it and prepare for game crash.

In myprevious testing sometimes mere loading the save crashed the game, not sure why it doesn't happen here... Maybe due to different items being burried...?

EntombedItemManager_test.zip

  • Thanks 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...