From d7b064d900304c9bc764620b59aff14ef0292b73 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 13:11:08 +0500 Subject: [PATCH 01/14] add: new stimulator effects, mood integration --- .../_White/Chemistry/NarcoticEffect.cs | 72 +++++++++++++++++++ .../Chemistry/NarcoticEffectComponent.cs | 19 +++++ Resources/Prototypes/Reagents/narcotics.yml | 4 +- .../White/Mood/generic_positveEffects.yml | 7 ++ Resources/Prototypes/status_effects.yml | 4 ++ 5 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 Content.Server/_White/Chemistry/NarcoticEffect.cs create mode 100644 Content.Server/_White/Chemistry/NarcoticEffectComponent.cs diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs new file mode 100644 index 0000000000..4ce8bdd8a9 --- /dev/null +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -0,0 +1,72 @@ +using System.Threading; +using Content.Server.Stunnable; +using Content.Shared._White.Mood; +using Content.Shared.Alert; +using Content.Shared.Damage.Systems; +using Robust.Shared.Random; +using Timer = Robust.Shared.Timing.Timer; + +namespace Content.Server._White.Chemistry; + +/// +/// This handles system? +/// +public sealed class NarcoticEffect : EntitySystem +{ + [Dependency] private readonly StunSystem _stun = default!; + [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly StaminaSystem _stamina = default!; + [Dependency] private readonly AlertsSystem _alertsSystem = default!; + + /// + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(OnRemove); + } + + private void OnInit(EntityUid uid, NarcoticEffectComponent component, ComponentInit args) + { + int index = _robustRandom.Next(0, component.Effects.Count); + + Effects(uid, component, index); + } + + private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args) + { + component.cancelTokenSource.Cancel(); + _alertsSystem.ClearAlert(uid, AlertType.Bleeding); + } + + private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) + { + RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); + CancellationToken token = component.cancelTokenSource.Token; + switch (component.Effects[index]) + { + case "Stun": + Timer.SpawnRepeating(10000, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + break; + + case "TremorAndShake": + Timer.SpawnRepeating(6000, () => _stamina.TakeStaminaDamage(uid, 20F), token); + _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + break; + + case "Tremor": + Timer.SpawnRepeating(6000, () => _stamina.TakeStaminaDamage(uid, 20F), token); + break; + + case "Shake": + _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + break; + + case "StunAndShake": + Timer.SpawnRepeating(10000, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + break; + } + } +} diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs new file mode 100644 index 0000000000..0c8cce1ae0 --- /dev/null +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -0,0 +1,19 @@ +using System.Threading; + +namespace Content.Server._White.Chemistry; + +/// +/// This is used for... +/// +[RegisterComponent] +public sealed partial class NarcoticEffectComponent : Component +{ + [ViewVariables(VVAccess.ReadWrite), DataField] + public float StunTime = 3f; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public CancellationTokenSource cancelTokenSource = new(); + + [ViewVariables(VVAccess.ReadOnly), DataField] + public List Effects = new() { "Stun", "TremorAndShake", "Tremor", "Shake", "StunAndShake" }; +} diff --git a/Resources/Prototypes/Reagents/narcotics.yml b/Resources/Prototypes/Reagents/narcotics.yml index ba86e86406..afccc62e00 100644 --- a/Resources/Prototypes/Reagents/narcotics.yml +++ b/Resources/Prototypes/Reagents/narcotics.yml @@ -76,8 +76,8 @@ Asphyxiation: 2 - !type:Jitter - !type:GenericStatusEffect - key: BlurryVision - component: BlurryVision + key: NarcoticEffect + component: NarcoticEffect - !type:GenericStatusEffect key: Stun time: 1 diff --git a/Resources/Prototypes/White/Mood/generic_positveEffects.yml b/Resources/Prototypes/White/Mood/generic_positveEffects.yml index 71fd30dc0b..5c34773fc2 100644 --- a/Resources/Prototypes/White/Mood/generic_positveEffects.yml +++ b/Resources/Prototypes/White/Mood/generic_positveEffects.yml @@ -50,3 +50,10 @@ desc: "Знаю правду, славим великого!" moodChange: enum.MoodChangeLevel.Big positiveEffect: true + +- type: moodEffect + id: Stimulator + desc: "Я ЧУВСТВУЮ ЭТО, В МОЕЙ КРОВИ НЕЧТО УСКОРЯЮЩЕЕ!!" + moodChange: enum.MoodChangeLevel.Medium + positiveEffect: true + timeout: 4 \ No newline at end of file diff --git a/Resources/Prototypes/status_effects.yml b/Resources/Prototypes/status_effects.yml index 1c2bd7fbf8..a9ea56db57 100644 --- a/Resources/Prototypes/status_effects.yml +++ b/Resources/Prototypes/status_effects.yml @@ -64,6 +64,10 @@ id: BlurryVision alwaysAllowed: true +- type: statusEffect + id: NarcoticEffect + alwaysAllowed: true + #WD EDIT - type: statusEffect id: Incorporeal From cf4d6f8344e0d9eb868c2ca88ca7b779b16affec Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 14:01:32 +0500 Subject: [PATCH 02/14] tweak: timers, effects --- .../_White/Chemistry/NarcoticEffect.cs | 27 ++++++++++++------- .../Chemistry/NarcoticEffectComponent.cs | 8 +++++- Resources/Prototypes/Reagents/narcotics.yml | 4 +-- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index 4ce8bdd8a9..c87390ebfa 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -1,8 +1,10 @@ using System.Threading; +using Content.Server.Speech.EntitySystems; using Content.Server.Stunnable; using Content.Shared._White.Mood; -using Content.Shared.Alert; using Content.Shared.Damage.Systems; +using Content.Shared.Drunk; +using Content.Shared.StatusEffect; using Robust.Shared.Random; using Timer = Robust.Shared.Timing.Timer; @@ -15,8 +17,8 @@ public sealed class NarcoticEffect : EntitySystem { [Dependency] private readonly StunSystem _stun = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StaminaSystem _stamina = default!; - [Dependency] private readonly AlertsSystem _alertsSystem = default!; /// public override void Initialize() @@ -37,35 +39,40 @@ public sealed class NarcoticEffect : EntitySystem private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args) { component.cancelTokenSource.Cancel(); - _alertsSystem.ClearAlert(uid, AlertType.Bleeding); } private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) { RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); CancellationToken token = component.cancelTokenSource.Token; + + TryComp(uid, out var statusEffectsComp); + + int timer = component.TimerInterval[_robustRandom.Next(0, component.TimerInterval.Count)]; + int slur = component.SlurTime[_robustRandom.Next(0, component.SlurTime.Count)]; + switch (component.Effects[index]) { case "Stun": - Timer.SpawnRepeating(10000, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); break; case "TremorAndShake": - Timer.SpawnRepeating(6000, () => _stamina.TakeStaminaDamage(uid, 20F), token); - _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); + _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; case "Tremor": - Timer.SpawnRepeating(6000, () => _stamina.TakeStaminaDamage(uid, 20F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); break; case "Shake": - _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; case "StunAndShake": - Timer.SpawnRepeating(10000, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); - _alertsSystem.ShowAlert(uid, AlertType.Bleeding); + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } } diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs index 0c8cce1ae0..de5f2dc39f 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -9,11 +9,17 @@ namespace Content.Server._White.Chemistry; public sealed partial class NarcoticEffectComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField] - public float StunTime = 3f; + public float StunTime = 2.5f; [ViewVariables(VVAccess.ReadWrite), DataField] public CancellationTokenSource cancelTokenSource = new(); [ViewVariables(VVAccess.ReadOnly), DataField] public List Effects = new() { "Stun", "TremorAndShake", "Tremor", "Shake", "StunAndShake" }; + + [ViewVariables(VVAccess.ReadOnly), DataField] + public List TimerInterval = new() { 3000, 6000, 3800, 7000, 5000 }; + + [ViewVariables(VVAccess.ReadOnly), DataField] + public List SlurTime = new() { 35, 60, 80, 90, 45 }; } diff --git a/Resources/Prototypes/Reagents/narcotics.yml b/Resources/Prototypes/Reagents/narcotics.yml index afccc62e00..24a072adf9 100644 --- a/Resources/Prototypes/Reagents/narcotics.yml +++ b/Resources/Prototypes/Reagents/narcotics.yml @@ -32,8 +32,8 @@ key: Stutter component: StutteringAccent - !type:GenericStatusEffect - key: BlurryVision - component: BlurryVision + key: NarcoticEffect + component: NarcoticEffect - !type:Jitter - !type:GenericStatusEffect key: Stun From 1effff11598bd333989a34bc164bd7652c7fbd09 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 14:02:23 +0500 Subject: [PATCH 03/14] change mood --- Resources/Prototypes/White/Mood/generic_positveEffects.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/Prototypes/White/Mood/generic_positveEffects.yml b/Resources/Prototypes/White/Mood/generic_positveEffects.yml index 5c34773fc2..539b9a2a68 100644 --- a/Resources/Prototypes/White/Mood/generic_positveEffects.yml +++ b/Resources/Prototypes/White/Mood/generic_positveEffects.yml @@ -53,7 +53,7 @@ - type: moodEffect id: Stimulator - desc: "Я ЧУВСТВУЮ ЭТО, В МОЕЙ КРОВИ НЕЧТО УСКОРЯЮЩЕЕ!!" + desc: "Я ЧУВСТВУЮ ЭТО, В МОЕЙ КРОВИ НАХОДИТСЯ ЧТО-ТО НЕОБЫЧНОЕ!!" moodChange: enum.MoodChangeLevel.Medium positiveEffect: true - timeout: 4 \ No newline at end of file + timeout: 2 \ No newline at end of file From 92156fbd45780f695f22840d8c3bb3cf4d755db5 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 14:07:43 +0500 Subject: [PATCH 04/14] check if has drunk effect --- Content.Server/_White/Chemistry/NarcoticEffect.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index c87390ebfa..866c625046 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -53,6 +53,20 @@ public sealed class NarcoticEffect : EntitySystem switch (component.Effects[index]) { + case "TremorAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); + _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); + break; + + case "Shake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); + break; + + case "StunAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); + break; + case "Stun": Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); break; From 022f6ad355c164cab97b3f01b1c2d2e46fd90319 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 14:14:18 +0500 Subject: [PATCH 05/14] =?UTF-8?q?tweak:=20=D0=BF=D0=BE=D0=BD=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B4=D0=B0=D0=BC=D0=B0=D0=B3=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BC=D0=B8=D0=BD=D0=B5=20=D0=B8=20=D0=B2?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D1=8F=20=D1=81=D1=82=D0=B0=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/_White/Chemistry/NarcoticEffect.cs | 6 +++--- Content.Server/_White/Chemistry/NarcoticEffectComponent.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index 866c625046..bb2a2d7254 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -54,7 +54,7 @@ public sealed class NarcoticEffect : EntitySystem switch (component.Effects[index]) { case "TremorAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; @@ -72,12 +72,12 @@ public sealed class NarcoticEffect : EntitySystem break; case "TremorAndShake": - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; case "Tremor": - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 20F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); break; case "Shake": diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs index de5f2dc39f..e4d6932a10 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -9,7 +9,7 @@ namespace Content.Server._White.Chemistry; public sealed partial class NarcoticEffectComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField] - public float StunTime = 2.5f; + public float StunTime = 2f; [ViewVariables(VVAccess.ReadWrite), DataField] public CancellationTokenSource cancelTokenSource = new(); From 6f455b7513c676901502e49f49897854b2a8d06e Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 14:58:15 +0500 Subject: [PATCH 06/14] =?UTF-8?q?tweak:=20=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D1=82=D0=B0=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_White/Chemistry/NarcoticEffect.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index bb2a2d7254..7d21fc433d 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -1,10 +1,11 @@ using System.Threading; -using Content.Server.Speech.EntitySystems; -using Content.Server.Stunnable; using Content.Shared._White.Mood; +using Content.Shared.Damage; +using Content.Shared.Damage.Prototypes; using Content.Shared.Damage.Systems; using Content.Shared.Drunk; using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Timer = Robust.Shared.Timing.Timer; @@ -15,8 +16,9 @@ namespace Content.Server._White.Chemistry; /// public sealed class NarcoticEffect : EntitySystem { - [Dependency] private readonly StunSystem _stun = default!; + [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private static readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StaminaSystem _stamina = default!; @@ -43,6 +45,7 @@ public sealed class NarcoticEffect : EntitySystem private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) { + var damageSpecifier = new DamageSpecifier(_prototypeManager.Index("Poison"), 5); RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); CancellationToken token = component.cancelTokenSource.Token; @@ -62,13 +65,13 @@ public sealed class NarcoticEffect : EntitySystem _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "StunAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + case "DamageAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "Stun": - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + case "Damage": + _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); break; case "TremorAndShake": @@ -84,8 +87,8 @@ public sealed class NarcoticEffect : EntitySystem _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; - case "StunAndShake": - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + case "DamageAndShake": + _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } From 9aa50fe626eb1d89d4c83aee113bf8785e61f8b8 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 17:22:59 +0500 Subject: [PATCH 07/14] revert, change stuntime --- .../_White/Chemistry/NarcoticEffect.cs | 21 ++++++++----------- .../Chemistry/NarcoticEffectComponent.cs | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index 7d21fc433d..bb2a2d7254 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -1,11 +1,10 @@ using System.Threading; +using Content.Server.Speech.EntitySystems; +using Content.Server.Stunnable; using Content.Shared._White.Mood; -using Content.Shared.Damage; -using Content.Shared.Damage.Prototypes; using Content.Shared.Damage.Systems; using Content.Shared.Drunk; using Content.Shared.StatusEffect; -using Robust.Shared.Prototypes; using Robust.Shared.Random; using Timer = Robust.Shared.Timing.Timer; @@ -16,9 +15,8 @@ namespace Content.Server._White.Chemistry; /// public sealed class NarcoticEffect : EntitySystem { - [Dependency] private readonly DamageableSystem _damageableSystem = default!; + [Dependency] private readonly StunSystem _stun = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private static readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StaminaSystem _stamina = default!; @@ -45,7 +43,6 @@ public sealed class NarcoticEffect : EntitySystem private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) { - var damageSpecifier = new DamageSpecifier(_prototypeManager.Index("Poison"), 5); RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); CancellationToken token = component.cancelTokenSource.Token; @@ -65,13 +62,13 @@ public sealed class NarcoticEffect : EntitySystem _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "DamageAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): - _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); + case "StunAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "Damage": - _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); + case "Stun": + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); break; case "TremorAndShake": @@ -87,8 +84,8 @@ public sealed class NarcoticEffect : EntitySystem _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; - case "DamageAndShake": - _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false); + case "StunAndShake": + Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs index e4d6932a10..3b551d92c8 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -9,7 +9,7 @@ namespace Content.Server._White.Chemistry; public sealed partial class NarcoticEffectComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField] - public float StunTime = 2f; + public float StunTime = 1.5f; [ViewVariables(VVAccess.ReadWrite), DataField] public CancellationTokenSource cancelTokenSource = new(); From 2804779529400d2c1bdb30d57c12530830a12ed0 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Thu, 21 Mar 2024 17:49:01 +0500 Subject: [PATCH 08/14] stun time to 0.7 --- Content.Server/_White/Chemistry/NarcoticEffectComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs index 3b551d92c8..0b02955a33 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -9,7 +9,7 @@ namespace Content.Server._White.Chemistry; public sealed partial class NarcoticEffectComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField] - public float StunTime = 1.5f; + public float StunTime = 0.7f; [ViewVariables(VVAccess.ReadWrite), DataField] public CancellationTokenSource cancelTokenSource = new(); From 039b8dd1fc044e23096109f9ba2feee7c44ae525 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Fri, 22 Mar 2024 13:39:56 +0500 Subject: [PATCH 09/14] change list to enum --- .../_White/Chemistry/NarcoticEffect.cs | 24 +++++++++---------- .../Chemistry/NarcoticEffectComponent.cs | 16 +++++++++---- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Server/_White/Chemistry/NarcoticEffect.cs index bb2a2d7254..597992a46f 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffect.cs @@ -31,60 +31,60 @@ public sealed class NarcoticEffect : EntitySystem private void OnInit(EntityUid uid, NarcoticEffectComponent component, ComponentInit args) { - int index = _robustRandom.Next(0, component.Effects.Count); + int index = _robustRandom.Next(0, Enum.GetNames(typeof(NarcoticEffects)).Length); Effects(uid, component, index); } private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args) { - component.cancelTokenSource.Cancel(); + component.CancelTokenSource.Cancel(); } private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) { RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); - CancellationToken token = component.cancelTokenSource.Token; + CancellationToken token = component.CancelTokenSource.Token; TryComp(uid, out var statusEffectsComp); int timer = component.TimerInterval[_robustRandom.Next(0, component.TimerInterval.Count)]; int slur = component.SlurTime[_robustRandom.Next(0, component.SlurTime.Count)]; - switch (component.Effects[index]) + switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) { - case "TremorAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + case NarcoticEffects.TremorAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "Shake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + case NarcoticEffects.Shake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "StunAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case "Stun": + case NarcoticEffects.Stun: Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); break; - case "TremorAndShake": + case NarcoticEffects.TremorAndShake: Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; - case "Tremor": + case NarcoticEffects.Tremor: Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); break; - case "Shake": + case NarcoticEffects.Shake: _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; - case "StunAndShake": + case NarcoticEffects.StunAndShake: Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs index 0b02955a33..b992ad33d8 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs @@ -1,4 +1,5 @@ using System.Threading; +using Robust.Shared.Serialization; namespace Content.Server._White.Chemistry; @@ -12,10 +13,7 @@ public sealed partial class NarcoticEffectComponent : Component public float StunTime = 0.7f; [ViewVariables(VVAccess.ReadWrite), DataField] - public CancellationTokenSource cancelTokenSource = new(); - - [ViewVariables(VVAccess.ReadOnly), DataField] - public List Effects = new() { "Stun", "TremorAndShake", "Tremor", "Shake", "StunAndShake" }; + public CancellationTokenSource CancelTokenSource = new(); [ViewVariables(VVAccess.ReadOnly), DataField] public List TimerInterval = new() { 3000, 6000, 3800, 7000, 5000 }; @@ -23,3 +21,13 @@ public sealed partial class NarcoticEffectComponent : Component [ViewVariables(VVAccess.ReadOnly), DataField] public List SlurTime = new() { 35, 60, 80, 90, 45 }; } + +[Serializable, NetSerializable] +public enum NarcoticEffects +{ + Stun, + Tremor, + Shake, + TremorAndShake, + StunAndShake +} From 91b6dd8b62e7f790e88b99d2e109245ccd1a9a99 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Sat, 23 Mar 2024 16:25:36 +0500 Subject: [PATCH 10/14] change stun to lying --- .../_White/Chemistry/NarcoticEffect.cs | 19 +++++++++---------- .../Chemistry/NarcoticEffectComponent.cs | 5 +---- 2 files changed, 10 insertions(+), 14 deletions(-) rename {Content.Server => Content.Shared}/_White/Chemistry/NarcoticEffect.cs (85%) rename {Content.Server => Content.Shared}/_White/Chemistry/NarcoticEffectComponent.cs (84%) diff --git a/Content.Server/_White/Chemistry/NarcoticEffect.cs b/Content.Shared/_White/Chemistry/NarcoticEffect.cs similarity index 85% rename from Content.Server/_White/Chemistry/NarcoticEffect.cs rename to Content.Shared/_White/Chemistry/NarcoticEffect.cs index 597992a46f..167741eb52 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffect.cs @@ -1,24 +1,20 @@ using System.Threading; -using Content.Server.Speech.EntitySystems; -using Content.Server.Stunnable; using Content.Shared._White.Mood; using Content.Shared.Damage.Systems; using Content.Shared.Drunk; +using Content.Shared.Standing; using Content.Shared.StatusEffect; using Robust.Shared.Random; using Timer = Robust.Shared.Timing.Timer; -namespace Content.Server._White.Chemistry; +namespace Content.Shared._White.Chemistry; -/// -/// This handles system? -/// public sealed class NarcoticEffect : EntitySystem { - [Dependency] private readonly StunSystem _stun = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StaminaSystem _stamina = default!; + [Dependency] private readonly StandingStateSystem _standingStateSystem = default!; /// public override void Initialize() @@ -43,6 +39,9 @@ public sealed class NarcoticEffect : EntitySystem private void Effects(EntityUid uid, NarcoticEffectComponent component, int index) { + if(!TryComp(uid, out var standingComp)) + return; + RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); CancellationToken token = component.CancelTokenSource.Token; @@ -63,12 +62,12 @@ public sealed class NarcoticEffect : EntitySystem break; case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; case NarcoticEffects.Stun: - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); break; case NarcoticEffects.TremorAndShake: @@ -85,7 +84,7 @@ public sealed class NarcoticEffect : EntitySystem break; case NarcoticEffects.StunAndShake: - Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); + Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } diff --git a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs similarity index 84% rename from Content.Server/_White/Chemistry/NarcoticEffectComponent.cs rename to Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs index b992ad33d8..f23182685e 100644 --- a/Content.Server/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs @@ -1,7 +1,7 @@ using System.Threading; using Robust.Shared.Serialization; -namespace Content.Server._White.Chemistry; +namespace Content.Shared._White.Chemistry; /// /// This is used for... @@ -9,9 +9,6 @@ namespace Content.Server._White.Chemistry; [RegisterComponent] public sealed partial class NarcoticEffectComponent : Component { - [ViewVariables(VVAccess.ReadWrite), DataField] - public float StunTime = 0.7f; - [ViewVariables(VVAccess.ReadWrite), DataField] public CancellationTokenSource CancelTokenSource = new(); From 39d749fb0570b81486222fb402f4de54d5b221c3 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Sat, 23 Mar 2024 16:27:23 +0500 Subject: [PATCH 11/14] fix atmos holoprojector --- Content.Server/Holosign/HolosignSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Server/Holosign/HolosignSystem.cs b/Content.Server/Holosign/HolosignSystem.cs index 33a08c0975..7f0952987f 100644 --- a/Content.Server/Holosign/HolosignSystem.cs +++ b/Content.Server/Holosign/HolosignSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Coordinates.Helpers; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Popups; +using Content.Shared.Storage; namespace Content.Server.Holosign; @@ -59,7 +60,7 @@ public sealed class HolosignSystem : EntitySystem return; } - if (args.Handled || !args.CanReach) + if (args.Handled || !args.CanReach || HasComp(args.Target)) return; if (component.Signs.Count >= component.Uses) // wd edit From c5ffbf3fcf94e0f0d7df34104f71f40896b3999d Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Sun, 24 Mar 2024 13:06:51 +0500 Subject: [PATCH 12/14] add scale to timer --- Content.Shared/_White/Chemistry/NarcoticEffect.cs | 12 ++++++------ .../_White/Chemistry/NarcoticEffectComponent.cs | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Content.Shared/_White/Chemistry/NarcoticEffect.cs b/Content.Shared/_White/Chemistry/NarcoticEffect.cs index 167741eb52..91b4d9e579 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffect.cs @@ -53,7 +53,7 @@ public sealed class NarcoticEffect : EntitySystem switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) { 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); break; @@ -62,21 +62,21 @@ public sealed class NarcoticEffect : EntitySystem break; 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); break; case NarcoticEffects.Stun: - Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); + Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); break; case NarcoticEffects.TremorAndShake: - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); + Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; case NarcoticEffects.Tremor: - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); + Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); break; case NarcoticEffects.Shake: @@ -84,7 +84,7 @@ public sealed class NarcoticEffect : EntitySystem break; case NarcoticEffects.StunAndShake: - Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); + Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } diff --git a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs index f23182685e..e34f09217b 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs @@ -17,6 +17,9 @@ public sealed partial class NarcoticEffectComponent : Component [ViewVariables(VVAccess.ReadOnly), DataField] public List SlurTime = new() { 35, 60, 80, 90, 45 }; + + [ViewVariables(VVAccess.ReadOnly), DataField] + public int TimerScale = 6000; } [Serializable, NetSerializable] From 1313a34f5df0173acb9d47edcfe7a1005b835e83 Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Sun, 24 Mar 2024 13:21:11 +0500 Subject: [PATCH 13/14] fix --- .../_White/Chemistry/NarcoticEffect.cs | 18 ++++++++++++------ .../Chemistry/NarcoticEffectComponent.cs | 3 --- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Content.Shared/_White/Chemistry/NarcoticEffect.cs b/Content.Shared/_White/Chemistry/NarcoticEffect.cs index 91b4d9e579..7214e6f05e 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffect.cs @@ -1,5 +1,6 @@ using System.Threading; using Content.Shared._White.Mood; +using Content.Shared.Chemistry.Components; using Content.Shared.Damage.Systems; using Content.Shared.Drunk; using Content.Shared.Standing; @@ -34,6 +35,11 @@ public sealed class NarcoticEffect : EntitySystem private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args) { + if (TryComp(uid, out var movespeedModifierComponent)) + { + if (movespeedModifierComponent.ModifierTimer != TimeSpan.Zero) + return; + } component.CancelTokenSource.Cancel(); } @@ -53,7 +59,7 @@ public sealed class NarcoticEffect : EntitySystem switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) { 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); break; @@ -62,21 +68,21 @@ public sealed class NarcoticEffect : EntitySystem break; 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); break; case NarcoticEffects.Stun: - Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); + Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); break; case NarcoticEffects.TremorAndShake: - Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; case NarcoticEffects.Tremor: - Timer.SpawnRepeating(timer + component.TimerScale, () => _stamina.TakeStaminaDamage(uid, 15F), token); + Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token); break; case NarcoticEffects.Shake: @@ -84,7 +90,7 @@ public sealed class NarcoticEffect : EntitySystem break; case NarcoticEffects.StunAndShake: - Timer.SpawnRepeating(timer + component.TimerScale, () => _standingStateSystem.TryLieDown(uid, standingComp), token); + Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; } diff --git a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs index e34f09217b..f23182685e 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs @@ -17,9 +17,6 @@ public sealed partial class NarcoticEffectComponent : Component [ViewVariables(VVAccess.ReadOnly), DataField] public List SlurTime = new() { 35, 60, 80, 90, 45 }; - - [ViewVariables(VVAccess.ReadOnly), DataField] - public int TimerScale = 6000; } [Serializable, NetSerializable] From 067df00fd9766856f35db929372a87bc81e9bc0c Mon Sep 17 00:00:00 2001 From: CaYpeN1 Date: Sun, 24 Mar 2024 13:34:36 +0500 Subject: [PATCH 14/14] fix2 --- Content.Shared/_White/Chemistry/NarcoticEffect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Shared/_White/Chemistry/NarcoticEffect.cs b/Content.Shared/_White/Chemistry/NarcoticEffect.cs index 7214e6f05e..bb98352db7 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffect.cs @@ -38,6 +38,7 @@ public sealed class NarcoticEffect : EntitySystem if (TryComp(uid, out var movespeedModifierComponent)) { if (movespeedModifierComponent.ModifierTimer != TimeSpan.Zero) + Timer.Spawn(movespeedModifierComponent.ModifierTimer, () => component.CancelTokenSource.Cancel()); return; } component.CancelTokenSource.Cancel();