using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Shared.Atmos; namespace Content.Server.Atmos; /// /// Internal Atmospherics class that stores data on an atmosphere in a single tile. /// You should not be using these directly outside of . /// Use the public APIs in instead. /// [Access(typeof(AtmosphereSystem), typeof(GasTileOverlaySystem), typeof(AtmosDebugOverlaySystem))] public sealed class TileAtmosphere : IGasMixtureHolder { /// /// The last cycle this tile's air was archived into . /// See for more info on archival. /// [ViewVariables] public int ArchivedCycle; /// /// Current cycle this tile was processed. /// Used to prevent double-processing in a single cycle in many processing stages. /// [ViewVariables] public int CurrentCycle; /// /// Current temperature of this tile, in Kelvin. /// Used for Superconduction. /// This is not the temperature of the attached ! /// [ViewVariables] public float Temperature = Atmospherics.T20C; /// /// The current target tile for pressure movement for the current cycle. /// Gas will be moved towards this tile during pressure equalization. /// Also see . /// [ViewVariables] public TileAtmosphere? PressureSpecificTarget; /// /// The current pressure difference (delta) between this tile and its pressure target. /// If Monstermos is enabled, this value represents the quantity of moles transferred. /// [ViewVariables] public float PressureDifference; /// /// The current heat capacity of this tile. /// Used for Superconduction. /// This is not the heat capacity of the attached ! /// [ViewVariables(VVAccess.ReadWrite)] public float HeatCapacity = Atmospherics.MinimumHeatCapacity; /// /// The current thermal conductivity of this tile. /// Describes how well heat moves between this tile and adjacent tiles during superconduction. /// [ViewVariables] public float ThermalConductivity = 0.05f; /// /// Designates whether this tile is currently excited for processing in an excited group or LINDA. /// [ViewVariables] public bool Excited; /// /// Whether this tile should be considered space. /// [ViewVariables] public bool Space; /// /// Cached adjacent tiles for this tile. /// Ordered in the same order as /// (should be North, South, East, West). /// Adjacent tiles can be null if air cannot flow to them. /// [ViewVariables] public readonly TileAtmosphere?[] AdjacentTiles = new TileAtmosphere[Atmospherics.Directions]; /// /// Neighbouring tiles to which air can flow. This is a combination of this tile's unblocked direction, and the /// unblocked directions on adjacent tiles. /// [ViewVariables] public AtmosDirection AdjacentBits = AtmosDirection.Invalid; /// /// Current information for this tile. /// [ViewVariables] [Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)] public MonstermosInfo MonstermosInfo; /// /// Current information for this tile. /// [ViewVariables] public Hotspot Hotspot; /// /// Points to the direction of the recipient tile for pressure equalization logic /// (Monstermos or HighPressureDelta otherwise). /// [ViewVariables] public AtmosDirection PressureDirection; /// /// Last cycle's for debugging purposes. /// [ViewVariables] public AtmosDirection LastPressureDirection; /// /// Grid entity this tile belongs to. /// [ViewVariables] [Access(typeof(AtmosphereSystem))] public EntityUid GridIndex; /// /// The grid indices of this tile. /// [ViewVariables] public Vector2i GridIndices; /// /// The excited group this tile belongs to, if any. /// [ViewVariables] public ExcitedGroup? ExcitedGroup; /// /// The air in this tile. If null, this tile is completely air-blocked. /// This can be immutable if the tile is spaced. /// [ViewVariables] [Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends public GasMixture? Air; /// /// A copy of the air in this tile from the last time it was archived at . /// LINDA archives the air before doing any necessary processing and uses this to perform its calculations, /// making the results of LINDA independent of the order in which tiles are processed. /// [ViewVariables] public GasMixture? AirArchived; /// /// The amount of gas last shared to adjacent tiles during LINDA processing. /// Used to determine when LINDA should dismantle an excited group /// or extend its time alive. /// [DataField("lastShare")] public float LastShare; /// /// Implementation of . /// GasMixture IGasMixtureHolder.Air { get => Air ?? new GasMixture(Atmospherics.CellVolume){ Temperature = Temperature }; set => Air = value; } /// /// The maximum temperature this tile has sustained during hotspot fire processing. /// Used for debugging. /// [ViewVariables] public float MaxFireTemperatureSustained; /// /// If true, then this tile is directly exposed to the map's atmosphere, either because the grid has no tile at /// this position, or because the tile type is not airtight. /// [ViewVariables] public bool MapAtmosphere; /// /// If true, this tile does not actually exist on the grid, it only exists to represent the map's atmosphere for /// adjacent grid tiles. /// This tile often has immutable air and is sitting off the edge of the grid, where there is no grid. /// [ViewVariables] public bool NoGridTile; /// /// If true, this tile is queued for processing in /// [ViewVariables] public bool TrimQueued; /// /// Cached information about airtight entities on this tile. This gets updated anytime a tile gets invalidated /// (i.e., gets added to ). /// public AtmosphereSystem.AirtightData AirtightData; /// /// Creates a new TileAtmosphere. /// /// The grid entity this tile belongs to. /// >The grid indices of this tile. /// The gas mixture of this tile. /// If true, the gas mixture will be marked immutable. /// If true, this tile is considered space. public TileAtmosphere(EntityUid gridIndex, Vector2i gridIndices, GasMixture? mixture = null, bool immutable = false, bool space = false) { GridIndex = gridIndex; GridIndices = gridIndices; Air = mixture; AirArchived = Air?.Clone(); Space = space; if(immutable) Air?.MarkImmutable(); } /// /// Creates a copy of another TileAtmosphere. /// /// The TileAtmosphere to copy. public TileAtmosphere(TileAtmosphere other) { GridIndex = other.GridIndex; GridIndices = other.GridIndices; Space = other.Space; NoGridTile = other.NoGridTile; MapAtmosphere = other.MapAtmosphere; Air = other.Air?.Clone(); AirArchived = Air != null ? Air.Clone() : null; } /// /// Creates a new empty TileAtmosphere. /// public TileAtmosphere() { } }