{
base.Initialize();
+ SubscribeLocalEvent<EntityStorageComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<EntityStorageComponent, WeldableAttemptEvent>(OnWeldableAttempt);
SubscribeLocalEvent<EntityStorageComponent, WeldableChangedEvent>(OnWelded);
SubscribeLocalEvent<InsideEntityStorageComponent, EntGotRemovedFromContainerMessage>(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<ConstructionComponent>(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)