Fix NoAirWhenFullyAirBlocked (#12709)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.Piping.Components;
|
||||
using Content.Server.Atmos.Reactions;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
@@ -297,7 +298,14 @@ public partial class AtmosphereSystem
|
||||
(EntityUid GridId, Vector2i Tile, ReactionResult Result = default, bool Handled = false);
|
||||
|
||||
[ByRefEvent] private record struct IsTileAirBlockedMethodEvent
|
||||
(EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, MapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false);
|
||||
(EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, MapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false)
|
||||
{
|
||||
/// <summary>
|
||||
/// True if one of the enabled blockers has <see cref="AirtightComponent.NoAirWhenFullyAirBlocked"/>. Note
|
||||
/// that this does not actually check if all directions are blocked.
|
||||
/// </summary>
|
||||
public bool NoAir = false;
|
||||
}
|
||||
|
||||
[ByRefEvent] private record struct IsTileSpaceMethodEvent
|
||||
(EntityUid? Grid, EntityUid? Map, Vector2i Tile, MapGridComponent? MapGridComponent = null, bool Result = true, bool Handled = false);
|
||||
|
||||
@@ -241,6 +241,7 @@ public sealed partial class AtmosphereSystem
|
||||
// We set the directions that are air-blocked so far,
|
||||
// as you could have a full obstruction with only 4 directional air blockers.
|
||||
directions |= obstructingComponent.AirBlockedDirection;
|
||||
args.NoAir |= obstructingComponent.NoAirWhenFullyAirBlocked;
|
||||
|
||||
if (directions.IsFlagSet(args.Direction))
|
||||
{
|
||||
|
||||
@@ -83,22 +83,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
tile.Air = GetTileMixture(null, mapUid, indices);
|
||||
tile.MolesArchived = tile.Air != null ? new float[Atmospherics.AdjustedNumberOfGases] : null;
|
||||
tile.Space = IsTileSpace(null, mapUid, indices, mapGridComp);
|
||||
} else if (isAirBlocked)
|
||||
{
|
||||
var nullAir = false;
|
||||
|
||||
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, indices);
|
||||
|
||||
while (enumerator.MoveNext(out var airtight))
|
||||
{
|
||||
if (!airtight.NoAirWhenFullyAirBlocked)
|
||||
continue;
|
||||
|
||||
nullAir = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (nullAir)
|
||||
else if (isAirBlocked)
|
||||
{
|
||||
if (airBlockedEv.NoAir)
|
||||
{
|
||||
tile.Air = null;
|
||||
tile.MolesArchived = null;
|
||||
|
||||
Reference in New Issue
Block a user