using System.Collections.Generic;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Shared.Atmos
{
///
/// Class to store atmos constants.
///
public static class Atmospherics
{
static Atmospherics()
{
var protoMan = IoCManager.Resolve();
GasPrototypes = new GasPrototype[TotalNumberOfGases];
for (var i = 0; i < TotalNumberOfGases; i++)
{
GasPrototypes[i] = protoMan.Index(i.ToString());
}
}
private static readonly GasPrototype[] GasPrototypes;
public static GasPrototype GetGas(int gasId) => GasPrototypes[gasId];
public static GasPrototype GetGas(Gas gasId) => GasPrototypes[(int) gasId];
public static IEnumerable Gases => GasPrototypes;
#region ATMOS
///
/// The universal gas constant, in kPa*L/(K*mol)
///
public const float R = 8.314462618f;
///
/// 1 ATM in kPA.
///
public const float OneAtmosphere = 101.325f;
///
/// -270.3ºC in K. CMB stands for Cosmic Microwave Background.
///
public const float TCMB = 2.7f;
///
/// 0ºC in K
///
public const float T0C = 273.15f;
///
/// 20ºC in K
///
public const float T20C = 293.15f;
///
/// Liters in a cell.
///
public const float CellVolume = 2500f;
///
/// Moles in a 2.5 m^3 cell at 101.325 Pa and 20ºC
///
public const float MolesCellStandard = (OneAtmosphere * CellVolume / (T20C * R));
#endregion
///
/// Visible moles multiplied by this factor to get moles at which gas is at max visibility.
///
public const float FactorGasVisibleMax = 20f;
///
/// Minimum number of moles a gas can have.
///
public const float GasMinMoles = 0.00000005f;
public const float OpenHeatTransferCoefficient = 0.4f;
///
/// Ratio of air that must move to/from a tile to reset group processing
///
public const float MinimumAirRatioToSuspend = 0.1f;
///
/// Minimum ratio of air that must move to/from a tile
///
public const float MinimumAirRatioToMove = 0.001f;
///
/// Minimum amount of air that has to move before a group processing can be suspended
///
public const float MinimumAirToSuspend = (MolesCellStandard * MinimumAirRatioToSuspend);
public const float MinimumTemperatureToMove = (T20C + 100f);
public const float MinimumMolesDeltaToMove = (MolesCellStandard * MinimumAirRatioToMove);
///
/// Minimum temperature difference before group processing is suspended
///
public const float MinimumTemperatureDeltaToSuspend = 4.0f;
///
/// Minimum temperature difference before the gas temperatures are just set to be equal.
///
public const float MinimumTemperatureDeltaToConsider = 0.5f;
///
/// Minimum temperature for starting superconduction.
///
public const float MinimumTemperatureStartSuperConduction = (T20C + 200f);
///
/// Minimum heat capacity.
///
public const float MinimumHeatCapacity = 0.0003f;
#region Excited Groups
///
/// Number of full atmos updates ticks before an excited group breaks down (averages gas contents across turfs)
///
public const int ExcitedGroupBreakdownCycles = 4;
///
/// Number of full atmos updates before an excited group dismantles and removes its turfs from active
///
public const int ExcitedGroupsDismantleCycles = 16;
#endregion
///
/// Hard limit for tile equalization.
///
public const int ZumosHardTileLimit = 2000;
///
/// Limit for zone-based tile equalization.
///
public const int ZumosTileLimit = 200;
///
/// Total number of gases. Increase this if you want to add more!
///
public const int TotalNumberOfGases = 5;
public const float FireMinimumTemperatureToExist = T0C + 100f;
public const float FireMinimumTemperatureToSpread = T0C + 150f;
public const float FireSpreadRadiosityScale = 0.85f;
public const float FirePhoronEnergyReleased = 3000000f;
public const float FireGrowthRate = 40000f;
public const float SuperSaturationThreshold = 96f;
public const float OxygenBurnRateBase = 1.4f;
public const float PhoronMinimumBurnTemperature = (100f+T0C);
public const float PhoronUpperTemperature = (1370f+T0C);
public const float PhoronOxygenFullburn = 10f;
public const float PhoronBurnRateDelta = 9f;
}
///
/// Gases to Ids. Keep these updated with the prototypes!
///
public enum Gas
{
Oxygen = 0,
Nitrogen = 1,
CarbonDioxide = 2,
Phoron = 3,
Tritium = 4,
}
}