Atmos Delta-Pressure Window Shattering (#39238)

This PR adds delta-pressure damage. In short, airtight structures can now take damage proportional to the difference in pressures between the sides of the structure.
This commit is contained in:
ArtisticRoomba
2025-09-03 16:58:48 -07:00
committed by GitHub
parent f63eb2e97a
commit 20f2cb920b
22 changed files with 1685 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections.Concurrent;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Serialization;
@@ -61,6 +62,39 @@ namespace Content.Server.Atmos.Components
[ViewVariables]
public int HighPressureDeltaCount => HighPressureDelta.Count;
/// <summary>
/// A list of entities that have a <see cref="DeltaPressureComponent"/> and are to
/// be processed by the <see cref="DeltaPressureSystem"/>, if enabled.
///
/// To prevent massive bookkeeping overhead, this list is processed in-place,
/// with add/remove/find operations helped via a dict.
/// </summary>
/// <remarks>If you want to add/remove/find entities in this list,
/// use the API methods in the Atmospherics API.</remarks>
[ViewVariables]
public readonly List<Entity<DeltaPressureComponent>> DeltaPressureEntities =
new(AtmosphereSystem.DeltaPressurePreAllocateLength);
/// <summary>
/// An index lookup for the <see cref="DeltaPressureEntities"/> list.
/// Used for add/remove/find operations to speed up processing.
/// </summary>
public readonly Dictionary<EntityUid, int> DeltaPressureEntityLookup =
new(AtmosphereSystem.DeltaPressurePreAllocateLength);
/// <summary>
/// Integer that indicates the current position in the
/// <see cref="DeltaPressureEntities"/> list that is being processed.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public int DeltaPressureCursor;
/// <summary>
/// Queue of entities that need to have damage applied to them.
/// </summary>
[ViewVariables]
public readonly ConcurrentQueue<AtmosphereSystem.DeltaPressureDamageResult> DeltaPressureDamageResults = new();
[ViewVariables]
public readonly HashSet<IPipeNet> PipeNets = new();