Add heat conduction (#1653)
This commit is contained in:
committed by
GitHub
parent
619386a04a
commit
ca68fbe818
@@ -330,7 +330,7 @@ namespace Content.Server.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void TemperatureShare(GasMixture sharer, float conductionCoefficient)
|
public float TemperatureShare(GasMixture sharer, float conductionCoefficient)
|
||||||
{
|
{
|
||||||
var temperatureDelta = TemperatureArchived - sharer.TemperatureArchived;
|
var temperatureDelta = TemperatureArchived - sharer.TemperatureArchived;
|
||||||
if (MathF.Abs(temperatureDelta) > Atmospherics.MinimumTemperatureDeltaToConsider)
|
if (MathF.Abs(temperatureDelta) > Atmospherics.MinimumTemperatureDeltaToConsider)
|
||||||
@@ -349,6 +349,30 @@ namespace Content.Server.Atmos
|
|||||||
sharer.Temperature = MathF.Abs(MathF.Max(sharer.Temperature + heat / sharerHeatCapacity, Atmospherics.TCMB));
|
sharer.Temperature = MathF.Abs(MathF.Max(sharer.Temperature + heat / sharerHeatCapacity, Atmospherics.TCMB));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return sharer.Temperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public float TemperatureShare(float conductionCoefficient, float sharerTemperature, float sharerHeatCapacity)
|
||||||
|
{
|
||||||
|
var temperatureDelta = TemperatureArchived - sharerTemperature;
|
||||||
|
if (MathF.Abs(temperatureDelta) > Atmospherics.MinimumTemperatureDeltaToConsider)
|
||||||
|
{
|
||||||
|
var heatCapacity = HeatCapacityArchived;
|
||||||
|
|
||||||
|
if (sharerHeatCapacity > Atmospherics.MinimumHeatCapacity && heatCapacity > Atmospherics.MinimumHeatCapacity)
|
||||||
|
{
|
||||||
|
var heat = conductionCoefficient * temperatureDelta * (heatCapacity * sharerHeatCapacity / (heatCapacity + sharerHeatCapacity));
|
||||||
|
|
||||||
|
if (!Immutable)
|
||||||
|
Temperature = MathF.Abs(MathF.Max(Temperature - heat / heatCapacity, Atmospherics.TCMB));
|
||||||
|
|
||||||
|
sharerTemperature = MathF.Abs(MathF.Max(sharerTemperature + heat / sharerHeatCapacity, Atmospherics.TCMB));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sharerTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GasCompareResult
|
public enum GasCompareResult
|
||||||
@@ -357,6 +381,9 @@ namespace Content.Server.Atmos
|
|||||||
TemperatureExchange = -1,
|
TemperatureExchange = -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares sample to self to see if within acceptable ranges that group processing may be enabled.
|
||||||
|
/// </summary>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public GasCompareResult Compare(GasMixture sample)
|
public GasCompareResult Compare(GasMixture sample)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,6 +66,18 @@ namespace Content.Server.Atmos
|
|||||||
/// <param name="tile"></param>
|
/// <param name="tile"></param>
|
||||||
void RemoveHotspotTile(TileAtmosphere tile);
|
void RemoveHotspotTile(TileAtmosphere tile);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Marks a tile as superconductive so it can be processed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tile"></param>
|
||||||
|
void AddSuperconductivityTile(TileAtmosphere tile);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a tile from the superconductivity processing list.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tile"></param>
|
||||||
|
void RemoveSuperconductivityTile(TileAtmosphere tile);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marks a tile has having high pressure differences that need to be equalized.
|
/// Marks a tile has having high pressure differences that need to be equalized.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Server.GameObjects.EntitySystems;
|
|||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
|
using Content.Shared.Maps;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
@@ -27,9 +28,21 @@ namespace Content.Server.Atmos
|
|||||||
[Robust.Shared.IoC.Dependency] private IEntityManager _entityManager = default!;
|
[Robust.Shared.IoC.Dependency] private IEntityManager _entityManager = default!;
|
||||||
[Robust.Shared.IoC.Dependency] private IMapManager _mapManager = default!;
|
[Robust.Shared.IoC.Dependency] private IMapManager _mapManager = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private int _archivedCycle = 0;
|
private int _archivedCycle = 0;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private int _currentCycle = 0;
|
private int _currentCycle = 0;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private static GasTileOverlaySystem _gasTileOverlaySystem;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private float _temperature = Atmospherics.T20C;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private float _temperatureArchived = Atmospherics.T20C;
|
||||||
|
|
||||||
// I know this being static is evil, but I seriously can't come up with a better solution to sound spam.
|
// I know this being static is evil, but I seriously can't come up with a better solution to sound spam.
|
||||||
private static int _soundCooldown = 0;
|
private static int _soundCooldown = 0;
|
||||||
|
|
||||||
@@ -39,6 +52,12 @@ namespace Content.Server.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public float PressureDifference { get; set; } = 0;
|
public float PressureDifference { get; set; } = 0;
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float HeatCapacity { get; set; } = 1f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
public float ThermalConductivity => Tile?.Tile.GetContentTileDefinition().ThermalConductivity ?? 0.05f;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Excited { get; set; } = false;
|
public bool Excited { get; set; } = false;
|
||||||
|
|
||||||
@@ -54,11 +73,15 @@ namespace Content.Server.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public Hotspot Hotspot;
|
public Hotspot Hotspot;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private Direction _pressureDirection;
|
private Direction _pressureDirection;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public GridId GridIndex { get; }
|
public GridId GridIndex { get; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
public TileRef? Tile => GridIndices.GetTileRef(GridIndex);
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public MapIndices GridIndices { get; }
|
public MapIndices GridIndices { get; }
|
||||||
|
|
||||||
@@ -68,6 +91,9 @@ namespace Content.Server.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public GasMixture Air { get; set; }
|
public GasMixture Air { get; set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
public bool BlocksAir => _gridAtmosphereComponent.IsAirBlocked(GridIndices);
|
||||||
|
|
||||||
public TileAtmosphere(GridAtmosphereComponent atmosphereComponent, GridId gridIndex, MapIndices gridIndices, GasMixture mixture = null)
|
public TileAtmosphere(GridAtmosphereComponent atmosphereComponent, GridId gridIndex, MapIndices gridIndices, GasMixture mixture = null)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
@@ -80,8 +106,9 @@ namespace Content.Server.Atmos
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void Archive(int fireCount)
|
private void Archive(int fireCount)
|
||||||
{
|
{
|
||||||
_archivedCycle = fireCount;
|
|
||||||
Air?.Archive();
|
Air?.Archive();
|
||||||
|
_archivedCycle = fireCount;
|
||||||
|
_temperatureArchived = _temperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HotspotExpose(float exposedTemperature, float exposedVolume, bool soh = false)
|
public void HotspotExpose(float exposedTemperature, float exposedVolume, bool soh = false)
|
||||||
@@ -704,10 +731,150 @@ namespace Content.Server.Atmos
|
|||||||
// TODO ATMOS Let all entities in this tile know about the fire?
|
// TODO ATMOS Let all entities in this tile know about the fire?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ConsiderSuperconductivity()
|
||||||
|
{
|
||||||
|
if (ThermalConductivity == 0f)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_gridAtmosphereComponent.AddSuperconductivityTile(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool ConsiderSuperconductivity(bool starting)
|
private bool ConsiderSuperconductivity(bool starting)
|
||||||
{
|
{
|
||||||
// TODO ATMOS
|
if (Air.Temperature < (starting
|
||||||
|
? Atmospherics.MinimumTemperatureStartSuperConduction
|
||||||
|
: Atmospherics.MinimumTemperatureForSuperconduction))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return !(Air.HeatCapacity < Atmospherics.MCellWithRatio) && ConsiderSuperconductivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Superconduct()
|
||||||
|
{
|
||||||
|
var directions = ConductivityDirections();
|
||||||
|
var adjacentTiles = _gridAtmosphereComponent.GetAdjacentTiles(GridIndices, true);
|
||||||
|
|
||||||
|
if (directions.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (var direction in directions)
|
||||||
|
{
|
||||||
|
if (!adjacentTiles.TryGetValue(direction, out var adjacent)) continue;
|
||||||
|
|
||||||
|
if (adjacent.ThermalConductivity == 0f)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(adjacent._archivedCycle < _gridAtmosphereComponent.UpdateCounter)
|
||||||
|
adjacent.Archive(_gridAtmosphereComponent.UpdateCounter);
|
||||||
|
|
||||||
|
adjacent.NeighborConductWithSource(this);
|
||||||
|
|
||||||
|
adjacent.ConsiderSuperconductivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RadiateToSpace();
|
||||||
|
|
||||||
|
FinishSuperconduction();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishSuperconduction()
|
||||||
|
{
|
||||||
|
// Conduct with air on my tile if I have it
|
||||||
|
if (!BlocksAir)
|
||||||
|
{
|
||||||
|
_temperature = Air.TemperatureShare(ThermalConductivity, _temperature, HeatCapacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
FinishSuperconduction(BlocksAir ? _temperature : Air.Temperature);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishSuperconduction(float temperature)
|
||||||
|
{
|
||||||
|
// Make sure it's still hot enough to continue conducting.
|
||||||
|
if (temperature < Atmospherics.MinimumTemperatureForSuperconduction)
|
||||||
|
{
|
||||||
|
_gridAtmosphereComponent.RemoveSuperconductivityTile(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NeighborConductWithSource(TileAtmosphere other)
|
||||||
|
{
|
||||||
|
if (BlocksAir)
|
||||||
|
{
|
||||||
|
if (!other.BlocksAir)
|
||||||
|
{
|
||||||
|
other.TemperatureShareOpenToSolid(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
other.TemperatureShareMutualSolid(this, ThermalConductivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
TemperatureExpose(null, _temperature, _gridAtmosphereComponent.GetVolumeForCells(1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!other.BlocksAir)
|
||||||
|
{
|
||||||
|
other.Air.TemperatureShare(Air, Atmospherics.WindowHeatTransferCoefficient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TemperatureShareOpenToSolid(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
_gridAtmosphereComponent.AddActiveTile(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TemperatureShareOpenToSolid(TileAtmosphere other)
|
||||||
|
{
|
||||||
|
other._temperature =
|
||||||
|
Air.TemperatureShare(other.ThermalConductivity, other._temperature, other.HeatCapacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TemperatureShareMutualSolid(TileAtmosphere other, float conductionCoefficient)
|
||||||
|
{
|
||||||
|
var deltaTemperature = (_temperatureArchived - other._temperatureArchived);
|
||||||
|
if (MathF.Abs(deltaTemperature) > Atmospherics.MinimumTemperatureDeltaToConsider
|
||||||
|
&& HeatCapacity != 0f && other.HeatCapacity != 0f)
|
||||||
|
{
|
||||||
|
var heat = conductionCoefficient * deltaTemperature *
|
||||||
|
(HeatCapacity * other.HeatCapacity / (HeatCapacity + other.HeatCapacity));
|
||||||
|
|
||||||
|
_temperature -= heat / HeatCapacity;
|
||||||
|
other._temperature += heat / other.HeatCapacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RadiateToSpace()
|
||||||
|
{
|
||||||
|
// Considering 0ºC as the break even point for radiation in and out.
|
||||||
|
if (_temperature > Atmospherics.T0C)
|
||||||
|
{
|
||||||
|
// Hardcoded space temperature.
|
||||||
|
var deltaTemperature = (_temperatureArchived - Atmospherics.TCMB);
|
||||||
|
if ((HeatCapacity > 0) && (MathF.Abs(deltaTemperature) > Atmospherics.MinimumTemperatureDeltaToConsider))
|
||||||
|
{
|
||||||
|
var heat = ThermalConductivity * deltaTemperature * (HeatCapacity *
|
||||||
|
Atmospherics.HeatCapacityVacuum / (HeatCapacity + Atmospherics.HeatCapacityVacuum));
|
||||||
|
|
||||||
|
_temperature -= heat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Direction[] ConductivityDirections()
|
||||||
|
{
|
||||||
|
if(BlocksAir)
|
||||||
|
{
|
||||||
|
if(_archivedCycle < _gridAtmosphereComponent.UpdateCounter)
|
||||||
|
Archive(_gridAtmosphereComponent.UpdateCounter);
|
||||||
|
return Cardinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO ATMOS check if this is correct
|
||||||
|
return Cardinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -820,7 +987,6 @@ namespace Content.Server.Atmos
|
|||||||
//throw new NotImplementedException();
|
//throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void React()
|
private void React()
|
||||||
{
|
{
|
||||||
// TODO ATMOS I think this is enough? gotta make sure...
|
// TODO ATMOS I think this is enough? gotta make sure...
|
||||||
@@ -880,8 +1046,6 @@ namespace Content.Server.Atmos
|
|||||||
Direction.North, Direction.East, Direction.South, Direction.West
|
Direction.North, Direction.East, Direction.South, Direction.West
|
||||||
};
|
};
|
||||||
|
|
||||||
private static GasTileOverlaySystem _gasTileOverlaySystem;
|
|
||||||
|
|
||||||
public void TemperatureExpose(GasMixture mixture, float temperature, float cellVolume)
|
public void TemperatureExpose(GasMixture mixture, float temperature, float cellVolume)
|
||||||
{
|
{
|
||||||
// TODO ATMOS do this
|
// TODO ATMOS do this
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private readonly HashSet<TileAtmosphere> _hotspotTiles = new HashSet<TileAtmosphere>(1000);
|
private readonly HashSet<TileAtmosphere> _hotspotTiles = new HashSet<TileAtmosphere>(1000);
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private readonly HashSet<TileAtmosphere> _superconductivityTiles = new HashSet<TileAtmosphere>(1000);
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private readonly HashSet<MapIndices> _invalidatedCoords = new HashSet<MapIndices>(1000);
|
private readonly HashSet<MapIndices> _invalidatedCoords = new HashSet<MapIndices>(1000);
|
||||||
|
|
||||||
@@ -81,6 +84,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
ExcitedGroups,
|
ExcitedGroups,
|
||||||
HighPressureDelta,
|
HighPressureDelta,
|
||||||
Hotspots,
|
Hotspots,
|
||||||
|
Superconductivity,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -237,6 +241,18 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
_hotspotTiles.Remove(tile);
|
_hotspotTiles.Remove(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddSuperconductivityTile(TileAtmosphere tile)
|
||||||
|
{
|
||||||
|
if (tile?.GridIndex != _grid.Index) return;
|
||||||
|
_superconductivityTiles.Add(tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveSuperconductivityTile(TileAtmosphere tile)
|
||||||
|
{
|
||||||
|
if (tile == null) return;
|
||||||
|
_superconductivityTiles.Remove(tile);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddHighPressureDelta(TileAtmosphere tile)
|
public void AddHighPressureDelta(TileAtmosphere tile)
|
||||||
@@ -302,14 +318,14 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return _grid.GetTileRef(indices).Tile.IsEmpty;
|
return _grid.GetTileRef(indices).Tile.IsEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices)
|
public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false)
|
||||||
{
|
{
|
||||||
var sides = new Dictionary<Direction, TileAtmosphere>();
|
var sides = new Dictionary<Direction, TileAtmosphere>();
|
||||||
foreach (var dir in Cardinal)
|
foreach (var dir in Cardinal)
|
||||||
{
|
{
|
||||||
var side = indices.Offset(dir);
|
var side = indices.Offset(dir);
|
||||||
var tile = GetTile(side);
|
var tile = GetTile(side);
|
||||||
if(tile?.Air != null)
|
if(tile?.Air != null || includeAirBlocked)
|
||||||
sides[dir] = tile;
|
sides[dir] = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +377,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
break;
|
break;
|
||||||
case ProcessState.Hotspots:
|
case ProcessState.Hotspots:
|
||||||
ProcessHotspots();
|
ProcessHotspots();
|
||||||
|
_state = ProcessState.Superconductivity;
|
||||||
|
break;
|
||||||
|
case ProcessState.Superconductivity:
|
||||||
|
ProcessSuperconductivity();
|
||||||
_state = ProcessState.TileEqualize;
|
_state = ProcessState.TileEqualize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -463,6 +483,23 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ProcessSuperconductivity()
|
||||||
|
{
|
||||||
|
_stopwatch.Restart();
|
||||||
|
|
||||||
|
var number = 0;
|
||||||
|
foreach (var superconductivity in _superconductivityTiles.ToArray())
|
||||||
|
{
|
||||||
|
superconductivity.Superconduct();
|
||||||
|
|
||||||
|
if (number++ < LagCheckIterations) continue;
|
||||||
|
number = 0;
|
||||||
|
// Process the rest next time.
|
||||||
|
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private AirtightComponent GetObstructingComponent(MapIndices indices)
|
private AirtightComponent GetObstructingComponent(MapIndices indices)
|
||||||
{
|
{
|
||||||
foreach (var v in _grid.GetSnapGridCell(indices, SnapGridOffset.Center))
|
foreach (var v in _grid.GetSnapGridCell(indices, SnapGridOffset.Center))
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ namespace Content.Shared.Atmos
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const float MolesCellStandard = (OneAtmosphere * CellVolume / (T20C * R));
|
public const float MolesCellStandard = (OneAtmosphere * CellVolume / (T20C * R));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compared against for superconduction.
|
||||||
|
/// </summary>
|
||||||
|
public const float MCellWithRatio = (MolesCellStandard * 0.005f);
|
||||||
|
|
||||||
public const float OxygenStandard = 0.21f;
|
public const float OxygenStandard = 0.21f;
|
||||||
public const float NitrogenStandard = 0.79f;
|
public const float NitrogenStandard = 0.79f;
|
||||||
|
|
||||||
@@ -83,6 +88,11 @@ namespace Content.Shared.Atmos
|
|||||||
|
|
||||||
public const float OpenHeatTransferCoefficient = 0.4f;
|
public const float OpenHeatTransferCoefficient = 0.4f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hack to make vacuums cold, sacrificing realism for gameplay.
|
||||||
|
/// </summary>
|
||||||
|
public const float HeatCapacityVacuum = 7000f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ratio of air that must move to/from a tile to reset group processing
|
/// Ratio of air that must move to/from a tile to reset group processing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -116,6 +126,7 @@ namespace Content.Shared.Atmos
|
|||||||
/// Minimum temperature for starting superconduction.
|
/// Minimum temperature for starting superconduction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const float MinimumTemperatureStartSuperConduction = (T20C + 200f);
|
public const float MinimumTemperatureStartSuperConduction = (T20C + 200f);
|
||||||
|
public const float MinimumTemperatureForSuperconduction = (T20C + 10f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum heat capacity.
|
/// Minimum heat capacity.
|
||||||
@@ -214,6 +225,8 @@ namespace Content.Shared.Atmos
|
|||||||
/// so it just applies this flat value).
|
/// so it just applies this flat value).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int LowPressureDamage = 4;
|
public const int LowPressureDamage = 4;
|
||||||
|
|
||||||
|
public const float WindowHeatTransferCoefficient = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace Content.Shared.Maps
|
|||||||
public bool CanCrowbar { get; private set; }
|
public bool CanCrowbar { get; private set; }
|
||||||
public string FootstepSounds { get; private set; }
|
public string FootstepSounds { get; private set; }
|
||||||
public float Friction { get; set; }
|
public float Friction { get; set; }
|
||||||
|
public float ThermalConductivity { get; set; }
|
||||||
public string ItemDropPrototypeName { get; private set; }
|
public string ItemDropPrototypeName { get; private set; }
|
||||||
|
|
||||||
public void AssignTileId(ushort id)
|
public void AssignTileId(ushort id)
|
||||||
@@ -68,6 +69,15 @@ namespace Content.Shared.Maps
|
|||||||
Friction = 0;
|
Friction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mapping.TryGetNode("thermalConductivity", out node))
|
||||||
|
{
|
||||||
|
ThermalConductivity = node.AsFloat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ThermalConductivity = 0.05f;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapping.TryGetNode("item_drop", out node))
|
if (mapping.TryGetNode("item_drop", out node))
|
||||||
{
|
{
|
||||||
ItemDropPrototypeName = node.ToString();
|
ItemDropPrototypeName = node.ToString();
|
||||||
|
|||||||
@@ -12,6 +12,34 @@ namespace Content.Shared.Maps
|
|||||||
{
|
{
|
||||||
public static class TurfHelpers
|
public static class TurfHelpers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the content tile definition for a tile.
|
||||||
|
/// </summary>
|
||||||
|
public static ContentTileDefinition GetContentTileDefinition(this Tile tile)
|
||||||
|
{
|
||||||
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
|
return (ContentTileDefinition)tileDefinitionManager[tile.TypeId];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
||||||
|
/// </summary>
|
||||||
|
public static TileRef? GetTileRef(this MapIndices mapIndices, GridId gridId)
|
||||||
|
{
|
||||||
|
if (!gridId.IsValid())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
|
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (!grid.TryGetTileRef(mapIndices, out var tile))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return tile;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to get the turf at a certain coordinates or null if no such turf is found.
|
/// Attempts to get the turf at a certain coordinates or null if no such turf is found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=soundfonts/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=soundfonts/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spawner/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spawner/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=stunnable/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=stunnable/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=superconduction/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=swsl/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=swsl/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=underplating/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=underplating/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unexcite/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=unexcite/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|||||||
Reference in New Issue
Block a user