From 6f3caa07b8738bd162f189e43011fc199f0d7d78 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Thu, 29 Sep 2022 20:49:43 -0400 Subject: [PATCH] support for not airtight entity storage (#11616) --- .../Storage/Components/EntityStorageComponent.cs | 6 ++++++ .../Storage/EntitySystems/EntityStorageSystem.cs | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index 05ef1f89b9..66f98b7838 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -58,6 +58,12 @@ public sealed class EntityStorageComponent : Component, IGasMixtureHolder [DataField("deleteContentsOnDestruction")] public bool DeleteContentsOnDestruction = false; + /// + /// Whether or not the container is sealed and traps air inside of it + /// + [DataField("airTight"), ViewVariables(VVAccess.ReadWrite)] + public bool AirTight = true; + [DataField("open")] public bool Open; diff --git a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs index dc63d70e32..c2117e298c 100644 --- a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs @@ -269,7 +269,6 @@ public sealed class EntityStorageSystem : EntitySystem //Checks to see if the opening position, if offset, is inside of a wall. if (component.EnteringOffset != (0, 0) && !HasComp(target)) //if the entering position is offset { - var targetXform = Transform(target); var newCoords = new EntityCoordinates(target, component.EnteringOffset); if (!_interactionSystem.InRangeUnobstructed(target, newCoords, 0, collisionMask: component.EnteringOffsetCollisionFlags)) { @@ -385,6 +384,9 @@ public sealed class EntityStorageSystem : EntitySystem private void TakeGas(EntityUid uid, EntityStorageComponent component) { + if (!component.AirTight) + return; + var tile = GetOffsetTileRef(uid, component); if (tile != null && _atmos.GetTileMixture(tile.Value.GridUid, null, tile.Value.GridIndices, true) is {} environment) @@ -395,6 +397,9 @@ public sealed class EntityStorageSystem : EntitySystem private void ReleaseGas(EntityUid uid, EntityStorageComponent component) { + if (!component.AirTight) + return; + var tile = GetOffsetTileRef(uid, component); if (tile != null && _atmos.GetTileMixture(tile.Value.GridUid, null, tile.Value.GridIndices, true) is {} environment) @@ -420,7 +425,7 @@ public sealed class EntityStorageSystem : EntitySystem private void OnInsideInhale(EntityUid uid, InsideEntityStorageComponent component, InhaleLocationEvent args) { - if (TryComp(component.Storage, out var storage)) + if (TryComp(component.Storage, out var storage) && storage.AirTight) { args.Gas = storage.Air; } @@ -428,7 +433,7 @@ public sealed class EntityStorageSystem : EntitySystem private void OnInsideExhale(EntityUid uid, InsideEntityStorageComponent component, ExhaleLocationEvent args) { - if (TryComp(component.Storage, out var storage)) + if (TryComp(component.Storage, out var storage) && storage.AirTight) { args.Gas = storage.Air; } @@ -441,6 +446,9 @@ public sealed class EntityStorageSystem : EntitySystem if (TryComp(component.Storage, out var storage)) { + if (!storage.AirTight) + return; + args.Gas = storage.Air; }