support for not airtight entity storage (#11616)
This commit is contained in:
@@ -58,6 +58,12 @@ public sealed class EntityStorageComponent : Component, IGasMixtureHolder
|
||||
[DataField("deleteContentsOnDestruction")]
|
||||
public bool DeleteContentsOnDestruction = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the container is sealed and traps air inside of it
|
||||
/// </summary>
|
||||
[DataField("airTight"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AirTight = true;
|
||||
|
||||
[DataField("open")]
|
||||
public bool Open;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user