Files
tbd-station-14/Content.Server/EntityEffects/Effects/ChemCleanBloodstream.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

41 lines
1.2 KiB
C#

using Content.Server.Body.Systems;
using Content.Shared.EntityEffects;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.Effects;
/// <summary>
/// Basically smoke and foam reactions.
/// </summary>
[UsedImplicitly]
public sealed partial class ChemCleanBloodstream : EntityEffect
{
[DataField]
public float CleanseRate = 3.0f;
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("reagent-effect-guidebook-chem-clean-bloodstream", ("chance", Probability));
public override void Effect(EntityEffectBaseArgs args)
{
var cleanseRate = CleanseRate;
var bloodstreamSys = args.EntityManager.System<BloodstreamSystem>();
if (args is EntityEffectReagentArgs reagentArgs)
{
if (reagentArgs.Source == null || reagentArgs.Reagent == null)
return;
cleanseRate *= reagentArgs.Scale.Float();
bloodstreamSys.FlushChemicals(args.TargetEntity, reagentArgs.Reagent.ID, cleanseRate);
}
else
{
bloodstreamSys.FlushChemicals(args.TargetEntity, "", cleanseRate);
}
}
}