unhardcode the stun time (#19396)

This commit is contained in:
PixelTK
2023-08-21 19:18:57 +01:00
committed by GitHub
parent 216dea9b26
commit 109222e5d5
2 changed files with 8 additions and 3 deletions

View File

@@ -39,6 +39,12 @@ public sealed class StaminaComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("critThreshold")]
public float CritThreshold = 100f;
/// <summary>
/// How long will this mob be stunned for?
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("stunTime")]
public TimeSpan StunTime = TimeSpan.FromSeconds(6);
/// <summary>
/// To avoid continuously updating our data we track the last time we updated so we can extrapolate our current stamina.
/// </summary>

View File

@@ -394,11 +394,10 @@ public sealed partial class StaminaSystem : EntitySystem
component.Critical = true;
component.StaminaDamage = component.CritThreshold;
var stunTime = TimeSpan.FromSeconds(6);
_stunSystem.TryParalyze(uid, stunTime, true);
_stunSystem.TryParalyze(uid, component.StunTime, true);
// Give them buffer before being able to be re-stunned
component.NextUpdate = _timing.CurTime + stunTime + StamCritBufferTime;
component.NextUpdate = _timing.CurTime + component.StunTime + StamCritBufferTime;
EnsureComp<ActiveStaminaComponent>(uid);
Dirty(component);
_adminLogger.Add(LogType.Stamina, LogImpact.Medium, $"{ToPrettyString(uid):user} entered stamina crit");