add scale to timer

This commit is contained in:
CaYpeN1
2024-03-24 13:06:51 +05:00
parent 39d749fb05
commit c5ffbf3fcf
2 changed files with 9 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ public sealed class NarcoticEffect : EntitySystem
switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index))
{ {
case NarcoticEffects.TremorAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): case NarcoticEffects.TremorAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token);
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
@@ -62,21 +62,21 @@ public sealed class NarcoticEffect : EntitySystem
break; break;
case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
case NarcoticEffects.Stun: case NarcoticEffects.Stun:
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
break; break;
case NarcoticEffects.TremorAndShake: case NarcoticEffects.TremorAndShake:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;
case NarcoticEffects.Tremor: case NarcoticEffects.Tremor:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token);
break; break;
case NarcoticEffects.Shake: case NarcoticEffects.Shake:
@@ -84,7 +84,7 @@ public sealed class NarcoticEffect : EntitySystem
break; break;
case NarcoticEffects.StunAndShake: case NarcoticEffects.StunAndShake:
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;
} }

View File

@@ -17,6 +17,9 @@ public sealed partial class NarcoticEffectComponent : Component
[ViewVariables(VVAccess.ReadOnly), DataField] [ViewVariables(VVAccess.ReadOnly), DataField]
public List<int> SlurTime = new() { 35, 60, 80, 90, 45 }; public List<int> SlurTime = new() { 35, 60, 80, 90, 45 };
[ViewVariables(VVAccess.ReadOnly), DataField]
public int TimerScale = 6000;
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]