Skip to content

Commit 3a5431f

Browse files
committed
Refactor entity storage registration
1 parent 041b190 commit 3a5431f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎Concealment/ConcealmentPlugin.cs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,18 @@ public override void Init(ITorchBase torch)
6262
base.Init(torch);
6363
Settings = Persistent<Settings>.Load(Path.Combine(StoragePath, "Concealment.cfg"));
6464
_concealedAabbTree = new MyDynamicAABBTreeD(MyConstants.GAME_PRUNING_STRUCTURE_AABB_EXTENSION);
65-
torch.SessionUnloading += Torch_SessionUnloading;
65+
//torch.SessionUnloading += Torch_SessionUnloading;
66+
RegisterEntityStorage("Concealment", Id);
67+
}
6668

67-
//Init storage component.
69+
private void RegisterEntityStorage(string name, Guid id)
70+
{
6871
var comp = new MyModStorageComponentDefinition
69-
{
70-
Id = new MyDefinitionId(typeof(MyObjectBuilder_ModStorageComponent), "Concealment"),
71-
RegisteredStorageGuids = new[] {Id}
72+
{
73+
Id = new MyDefinitionId(typeof(MyObjectBuilder_ModStorageComponent), name),
74+
RegisteredStorageGuids = new[] { id }
7275
};
7376
MyDefinitionManager.Static.Definitions.AddDefinition(comp);
74-
7577
}
7678

7779
private void Torch_SessionUnloading()

0 commit comments

Comments
 (0)