2020-09-21 17:51:07 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using Content.Server.Atmos;
|
2021-06-23 11:35:30 +02:00
|
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2020-09-21 17:51:07 +02:00
|
|
|
|
using Content.Shared.Chemistry;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Chemistry.Reaction;
|
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2021-04-13 13:17:10 +02:00
|
|
|
|
using Content.Shared.Maps;
|
2020-09-21 17:51:07 +02:00
|
|
|
|
using JetBrains.Annotations;
|
2021-06-23 11:35:30 +02:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-09-21 17:51:07 +02:00
|
|
|
|
using Robust.Shared.Map;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-09-21 17:51:07 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.TileReactions
|
|
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2020-09-21 17:51:07 +02:00
|
|
|
|
public class FlammableTileReaction : ITileReaction
|
|
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f;
|
2020-09-21 17:51:07 +02:00
|
|
|
|
|
|
|
|
|
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
|
|
|
|
|
{
|
2021-07-19 12:07:37 +02:00
|
|
|
|
if (reactVolume <= ReagentUnit.Zero || tile.Tile.IsEmpty)
|
|
|
|
|
|
return ReagentUnit.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;
|
|
|
|
|
|
|
|
|
|
|
|
environment.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
|
|
|
|
|
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
|
|
|
|
|
|
2020-09-21 17:51:07 +02:00
|
|
|
|
return reactVolume;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|