using Content.Shared.Jittering; using Content.Shared.StatusEffect; using Robust.Shared.Prototypes; namespace Content.Shared.EntityEffects.Effects.StatusEffects; // TODO: When Jittering is moved to new Status, make this use StatusEffectsContainerComponent. /// /// Applies the Jittering Status Effect to this entity. /// The amount of time the Jittering is applied is modified by scale. /// /// public sealed partial class JitterEntityEffectSystem : EntityEffectSystem { [Dependency] private SharedJitteringSystem _jittering = default!; protected override void Effect(Entity entity, ref EntityEffectEvent args) { var time = args.Effect.Time * args.Scale; _jittering.DoJitter(entity, TimeSpan.FromSeconds(time), args.Effect.Refresh, args.Effect.Amplitude, args.Effect.Frequency); } } /// public sealed partial class Jitter : EntityEffectBase { /// /// How intense the jitter is. /// [DataField] public float Amplitude = 10.0f; /// /// The speed of the jitter. /// [DataField] public float Frequency = 4.0f; /// /// The duration of the effect. /// [DataField] public float Time = 2.0f; /// /// True - refresh jitter time, false - accumulate jitter time. /// [DataField] public bool Refresh = true; public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-jittering", ("chance", Probability)); }