support for not airtight entity storage (#11616)

This commit is contained in:
Nemanja
2022-09-29 20:49:43 -04:00
committed by GitHub
parent 466e285594
commit 6f3caa07b8
2 changed files with 17 additions and 3 deletions

View File

@@ -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<WallMountComponent>(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<EntityStorageComponent>(component.Storage, out var storage))
if (TryComp<EntityStorageComponent>(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<EntityStorageComponent>(component.Storage, out var storage))
if (TryComp<EntityStorageComponent>(component.Storage, out var storage) && storage.AirTight)
{
args.Gas = storage.Air;
}
@@ -441,6 +446,9 @@ public sealed class EntityStorageSystem : EntitySystem
if (TryComp<EntityStorageComponent>(component.Storage, out var storage))
{
if (!storage.AirTight)
return;
args.Gas = storage.Air;
}