This commit is contained in:
CaYpeN1
2024-03-24 13:21:11 +05:00
parent c5ffbf3fcf
commit 1313a34f5d
2 changed files with 12 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
using System.Threading; using System.Threading;
using Content.Shared._White.Mood; using Content.Shared._White.Mood;
using Content.Shared.Chemistry.Components;
using Content.Shared.Damage.Systems; using Content.Shared.Damage.Systems;
using Content.Shared.Drunk; using Content.Shared.Drunk;
using Content.Shared.Standing; using Content.Shared.Standing;
@@ -34,6 +35,11 @@ public sealed class NarcoticEffect : EntitySystem
private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args) private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args)
{ {
if (TryComp<MovespeedModifierMetabolismComponent>(uid, out var movespeedModifierComponent))
{
if (movespeedModifierComponent.ModifierTimer != TimeSpan.Zero)
return;
}
component.CancelTokenSource.Cancel(); component.CancelTokenSource.Cancel();
} }
@@ -53,7 +59,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 + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer, () => _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 +68,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 + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _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 + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
break; break;
case NarcoticEffects.TremorAndShake: case NarcoticEffects.TremorAndShake:
Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer, () => _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 + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token);
break; break;
case NarcoticEffects.Shake: case NarcoticEffects.Shake:
@@ -84,7 +90,7 @@ public sealed class NarcoticEffect : EntitySystem
break; break;
case NarcoticEffects.StunAndShake: case NarcoticEffects.StunAndShake:
Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _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,9 +17,6 @@ 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]