diff --git a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs index 46459105bf..509dec8a3d 100644 --- a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs @@ -20,6 +20,7 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem { base.Initialize(); + SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnWeldableAttempt); SubscribeLocalEvent(OnWelded); @@ -30,19 +31,22 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem SubscribeLocalEvent(OnRemoved); } + private void OnMapInit(EntityUid uid, EntityStorageComponent component, MapInitEvent args) + { + if (!component.Open && component.Air.TotalMoles == 0) + { + // If we're closed on spawn and have no air already saved, we need to pull some air into our environment from where we spawned, + // so that we have -something-. For example, if you bought an animal crate or something. + TakeGas(uid, component); + } + } + protected override void OnInit(EntityUid uid, SharedEntityStorageComponent component, ComponentInit args) { base.OnInit(uid, component, args); if (TryComp(uid, out var construction)) _construction.AddContainer(uid, ContainerName, construction); - - if (!component.Open) - { - // If we're closed on spawn, we need to pull some air into our environment from where we spawned, - // so that we have -something-. For example, if you bought an animal crate or something. - TakeGas(uid, (EntityStorageComponent) component); - } } private void OnWeldableAttempt(EntityUid uid, EntityStorageComponent component, WeldableAttemptEvent args)