2022-05-13 00:59:03 -07:00
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2021-11-20 16:47:53 -07:00
|
|
|
|
using Content.Shared.Jittering;
|
2023-06-04 16:45:02 -04:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-20 16:47:53 -07:00
|
|
|
|
|
|
|
|
|
|
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>
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class Jitter : ReagentEffect
|
2021-11-20 16:47:53 -07:00
|
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2021-11-20 16:47:53 -07:00
|
|
|
|
public float Amplitude = 10.0f;
|
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2021-11-20 16:47:53 -07:00
|
|
|
|
public float Frequency = 4.0f;
|
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2021-11-20 16:47:53 -07:00
|
|
|
|
public float Time = 2.0f;
|
|
|
|
|
|
|
2021-12-07 09:18:07 +03:00
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// true - refresh jitter time, false - accumulate jitter time
|
|
|
|
|
|
/// </remarks>
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2021-12-07 09:18:07 +03:00
|
|
|
|
public bool Refresh = true;
|
|
|
|
|
|
|
2021-11-21 00:35:02 -07:00
|
|
|
|
public override void Effect(ReagentEffectArgs args)
|
2021-11-20 16:47:53 -07:00
|
|
|
|
{
|
2022-12-21 09:51:49 -05:00
|
|
|
|
var time = Time;
|
|
|
|
|
|
time *= args.Scale;
|
|
|
|
|
|
|
2021-11-20 16:47:53 -07:00
|
|
|
|
args.EntityManager.EntitySysManager.GetEntitySystem<SharedJitteringSystem>()
|
2022-12-21 09:51:49 -05:00
|
|
|
|
.DoJitter(args.SolutionEntity, TimeSpan.FromSeconds(time), Refresh, Amplitude, Frequency);
|
2021-11-20 16:47:53 -07:00
|
|
|
|
}
|
2023-06-04 16:45:02 -04:00
|
|
|
|
|
|
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
|
|
|
|
|
|
Loc.GetString("reagent-effect-guidebook-jittering", ("chance", Probability));
|
2021-11-20 16:47:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|