Files
OldThink/Content.Server/Chemistry/TileReactions/ExtinguishTileReaction.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

38 lines
1.4 KiB
C#

using System;
using Content.Server.Atmos;
using Content.Shared.Atmos;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces.Chemistry;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Server.Chemistry.TileReactions
{
[UsedImplicitly]
public class ExtinguishTileReaction : ITileReaction
{
private float _coolingTemperature = 2f;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _coolingTemperature, "coolingTemperature", 2f);
}
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
{
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty) return ReagentUnit.Zero;
var tileAtmos = tile.GridIndices.GetTileAtmosphere(tile.GridIndex);
if (tileAtmos == null || !tileAtmos.Hotspot.Valid) return ReagentUnit.Zero;
tileAtmos.Air.Temperature =
MathF.Max(MathF.Min(tileAtmos.Air.Temperature - (_coolingTemperature * 1000f),
tileAtmos.Air.Temperature / _coolingTemperature),
Atmospherics.TCMB);
tileAtmos.Air.React(tileAtmos);
tileAtmos.Hotspot = new Hotspot();
tileAtmos.UpdateVisuals();
return ReagentUnit.Zero;
}
}
}