CatStation/Content.Shared/EntityEffects/Effects/StatusEffects/JitterEntityEffectSystem.cs
Ewanderer d7f7a91183
Documentation of e api (#44395)
* documentation pass on content.server -> E!

* APi pass on content.server for the E folder.

* documentation pass on content.shared for e.

* Apply suggestions from code review

Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>

* fixing documentation according to review part 1.

* typo

* Very minor fixes

* And a short explanation about EUI

---------

Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
2026-07-01 08:38:04 +00:00

54 lines
1.7 KiB
C#

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.
/// <summary>
/// Applies the Jittering Status Effect to this entity.
/// The amount of time the Jittering is applied is modified by scale.
/// </summary>
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
public sealed partial class JitterEntityEffectSystem : EntityEffectSystem<StatusEffectsComponent, Jitter>
{
[Dependency] private SharedJitteringSystem _jittering = default!;
protected override void Effect(Entity<StatusEffectsComponent> entity, ref EntityEffectEvent<Jitter> args)
{
var time = args.Effect.Time * args.Scale;
_jittering.DoJitter(entity, TimeSpan.FromSeconds(time), args.Effect.Refresh, args.Effect.Amplitude, args.Effect.Frequency);
}
}
/// <inheritdoc cref="EntityEffect"/>
public sealed partial class Jitter : EntityEffectBase<Jitter>
{
/// <summary>
/// How intense the jitter is.
/// </summary>
[DataField]
public float Amplitude = 10.0f;
/// <summary>
/// The speed of the jitter.
/// </summary>
[DataField]
public float Frequency = 4.0f;
/// <summary>
/// The duration of the effect.
/// </summary>
[DataField]
public float Time = 2.0f;
/// <summary>
/// True - refresh jitter time, false - accumulate jitter time.
/// </summary>
[DataField]
public bool Refresh = true;
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
Loc.GetString("entity-effect-guidebook-jittering", ("chance", Probability));
}