mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
## Mirror of PR #26441: [Fix atmos NaN error](https://github.com/space-wizards/space-station-14/pull/26441) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `fdb4a61487db9fc67714c913832427063abdea42` PR opened by <img src="https://avatars.githubusercontent.com/u/60421075?v=4" width="16"/><a href="https://github.com/ElectroJr"> ElectroJr</a> at 2024-03-26 04:27:08 UTC - merged at 2024-03-26 04:44:56 UTC --- PR changed 16 files with 43 additions and 25 deletions. The PR had the following labels: - Status: Needs Review --- <details open="true"><summary><h1>Original Body</h1></summary> > - Fixes a bug I introduced in #22521 that caused the temperature to be set to `NaN`. I don't know for sure, but I assume this is causing the current atmos issues > - Fixes `FixVacuum` not working after #22521 > - Removes some redundant yaml that was setting FixVacuum to its default value > > 🆑 > - fix: Fixed an atmos bug, which was (probably) causing atmospherics on the station to behave incorrectly. </details> Co-authored-by: SimpleStation14 <Unknown>
63 lines
2.9 KiB
C#
63 lines
2.9 KiB
C#
using Content.Server.Atmos.EntitySystems;
|
|
using Content.Shared.Atmos;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
namespace Content.Server.Atmos.Components
|
|
{
|
|
[RegisterComponent, Access(typeof(AirtightSystem))]
|
|
public sealed partial class AirtightComponent : Component
|
|
{
|
|
public (EntityUid Grid, Vector2i Tile) LastPosition { get; set; }
|
|
|
|
/// <summary>
|
|
/// The directions in which this entity should block airflow, relative to its own reference frame.
|
|
/// </summary>
|
|
[DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
|
|
public int InitialAirBlockedDirection { get; set; } = (int) AtmosDirection.All;
|
|
|
|
/// <summary>
|
|
/// The directions in which the entity is currently blocking airflow, relative to the grid that the entity is on.
|
|
/// I.e., this is a variant of <see cref="InitialAirBlockedDirection"/> that takes into account the entity's
|
|
/// current rotation.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public int CurrentAirBlockedDirection;
|
|
|
|
/// <summary>
|
|
/// Whether the airtight entity is currently blocking airflow.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool AirBlocked { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// If true, entities on this tile will attempt to draw air from surrounding tiles when they become unblocked
|
|
/// and currently have no air. This is generally only required when <see cref="NoAirWhenFullyAirBlocked"/> is
|
|
/// true, or if the entity is likely to occupy the same tile as another no-air airtight entity.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool FixVacuum { get; set; } = true;
|
|
// I think fixvacuum exists to ensure that repeatedly closing/opening air-blocking doors doesn't end up
|
|
// depressurizing a room. However it can also effectively be used as a means of generating gasses for free
|
|
// TODO ATMOS Mass conservation. Make it actually push/pull air from adjacent tiles instead of destroying & creating,
|
|
|
|
|
|
// TODO ATMOS Do we need these two fields?
|
|
[DataField("rotateAirBlocked")]
|
|
public bool RotateAirBlocked { get; set; } = true;
|
|
|
|
// TODO ATMOS remove this? What is this even for??
|
|
[DataField("fixAirBlockedDirectionInitialize")]
|
|
public bool FixAirBlockedDirectionInitialize { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// If true, then the tile that this entity is on will have no air at all if all directions are blocked.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool NoAirWhenFullyAirBlocked { get; set; } = true;
|
|
|
|
/// <inheritdoc cref="CurrentAirBlockedDirection"/>
|
|
[Access(Other = AccessPermissions.ReadWriteExecute)]
|
|
public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
|
|
}
|
|
}
|