Repository navigation
Keep mod storage saved in prefabs when MES adds its own - #469
Open
Blaylock1988 wants to merge 1 commit into
Open
Blaylock1988 wants to merge 1 commit into
Blaylock1988 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When MES adds its own storage to a prefab grid or block (NpcData, NPC thruster and gyro settings, container types), it looks for an existing component with TypeId MyModStorageComponentBase. Once storage has been through a save and load, the game saves it as MyModStorageComponent, which is how it appears in a prefab made from a loaded grid. MES misses it and adds a second component. On spawn the second one replaces the first, so the prefab's other mod storage on that grid or block is lost.
Modular-Encounters-Systems/Data/Scripts/ModularEncountersSystems/Spawning/Manipulation/StorageTools.cs
Lines 115 to 121 in 88ebcf0
Change
ApplyCustomBlockStorage and ApplyCustomEntityStorage also accept MyModStorageComponent. As we discussed, GetContainerStorage stays as it is, and NpcData left in a prefab is not cleared.
Testing
Single player, together with #468. I added a key that MES registers but only reads on planets (MesTemporaryPlanetKey) to a rover prefab's grid storage. Rovers spawned before the change were saved without it; after the change they keep it, next to their NpcData.