Generalize ReagentUnit into FixedPoint2 and use it for damage calculations (#5151)
* Damage units * sum ext method
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -19,17 +20,17 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
[DataField("coolingTemperature")] private float _coolingTemperature = 2f;
|
||||
|
||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
||||
return ReagentUnit.Zero;
|
||||
if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
|
||||
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
environment.Temperature =
|
||||
MathF.Max(MathF.Min(environment.Temperature - (_coolingTemperature * 1000f),
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||
atmosphereSystem.HotspotExtinguish(tile.GridIndex, tile.GridIndices);
|
||||
|
||||
return ReagentUnit.Zero;
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user