Storage system opts (#7427)

This commit is contained in:
mirrorcult
2022-04-04 23:00:52 -07:00
committed by GitHub
parent bdca58f2ed
commit fd0bb9fd8c
2 changed files with 27 additions and 16 deletions

View File

@@ -366,6 +366,7 @@ namespace Content.Server.Storage.Components
SubscribedSessions.Add(session);
}
_entityManager.EnsureComponent<ActiveStorageComponent>(Owner);
if (SubscribedSessions.Count == 1)
UpdateStorageVisualization();
}
@@ -388,7 +389,14 @@ namespace Content.Server.Storage.Components
CloseNestedInterfaces(session);
if (SubscribedSessions.Count == 0)
{
UpdateStorageVisualization();
if (_entityManager.HasComponent<ActiveStorageComponent>(Owner))
{
_entityManager.RemoveComponent<ActiveStorageComponent>(Owner);
}
}
}
/// <summary>
@@ -635,4 +643,7 @@ namespace Content.Server.Storage.Components
SoundSystem.Play(Filter.Pvs(Owner), StorageSoundCollection.GetSound(), Owner, AudioParams.Default);
}
}
[RegisterComponent]
public sealed class ActiveStorageComponent : Component {}
}