Files
tbd-station-14/Content.Server/Chemistry/ReagentEffects/StatusEffects/Jitter.cs
Nemanja b9fb66f005 Chem guidebook (#17123)
* im good at atomizing. welcome to half-finished chem guides.

* wagh

* e

* save work

* aa

* woweee UI

* finishing the last of it

* don't actually update the engine :(

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
2023-06-04 15:45:02 -05:00

42 lines
1.4 KiB
C#

using Content.Shared.Chemistry.Reagent;
using Content.Shared.Jittering;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.ReagentEffects.StatusEffects
{
/// <summary>
/// Adds the jitter status effect to a mob.
/// This doesn't use generic status effects because it needs to
/// take in some parameters that JitterSystem needs.
/// </summary>
public sealed class Jitter : ReagentEffect
{
[DataField("amplitude")]
public float Amplitude = 10.0f;
[DataField("frequency")]
public float Frequency = 4.0f;
[DataField("time")]
public float Time = 2.0f;
/// <remarks>
/// true - refresh jitter time, false - accumulate jitter time
/// </remarks>
[DataField("refresh")]
public bool Refresh = true;
public override void Effect(ReagentEffectArgs args)
{
var time = Time;
time *= args.Scale;
args.EntityManager.EntitySysManager.GetEntitySystem<SharedJitteringSystem>()
.DoJitter(args.SolutionEntity, TimeSpan.FromSeconds(time), Refresh, Amplitude, Frequency);
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
Loc.GetString("reagent-effect-guidebook-jittering", ("chance", Probability));
}
}