Files
tbd-station-14/Content.Server/EntityEffects/Effects/ExtinguishReaction.cs
SlamBamActionman b9fa941ca6 Turn ReagentEffects into generic EntityEffects (#28168)
* Oh the possibilities

* Merge fixes

* Forgot to remote LavaSystem oops

* Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs

* Throw exception for unimplemented effectargs

* Remove Json and overrideable datafields

* Fix test issues

* Actually fix the compiling issue

* Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
2024-06-30 13:43:43 +10:00

37 lines
1.4 KiB
C#

using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.EntityEffects;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.Effects
{
[UsedImplicitly]
public sealed partial class ExtinguishReaction : EntityEffect
{
/// <summary>
/// Amount of firestacks reduced.
/// </summary>
[DataField]
public float FireStacksAdjustment = -1.5f;
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-extinguish-reaction", ("chance", Probability));
public override void Effect(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent(args.TargetEntity, out FlammableComponent? flammable)) return;
var flammableSystem = args.EntityManager.System<FlammableSystem>();
flammableSystem.Extinguish(args.TargetEntity, flammable);
if (args is EntityEffectReagentArgs reagentArgs)
{
flammableSystem.AdjustFireStacks(reagentArgs.TargetEntity, FireStacksAdjustment * (float) reagentArgs.Quantity, flammable);
} else
{
flammableSystem.AdjustFireStacks(args.TargetEntity, FireStacksAdjustment, flammable);
}
}
}
}