tweak: заменил стан

This commit is contained in:
CaYpeN1
2024-03-21 14:58:15 +05:00
parent 022f6ad355
commit 6f455b7513

View File

@@ -1,10 +1,11 @@
using System.Threading; using System.Threading;
using Content.Server.Speech.EntitySystems;
using Content.Server.Stunnable;
using Content.Shared._White.Mood; using Content.Shared._White.Mood;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Damage.Systems; using Content.Shared.Damage.Systems;
using Content.Shared.Drunk; using Content.Shared.Drunk;
using Content.Shared.StatusEffect; using Content.Shared.StatusEffect;
using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Timer = Robust.Shared.Timing.Timer; using Timer = Robust.Shared.Timing.Timer;
@@ -15,8 +16,9 @@ namespace Content.Server._White.Chemistry;
/// </summary> /// </summary>
public sealed class NarcoticEffect : EntitySystem 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 readonly IRobustRandom _robustRandom = default!;
[Dependency] private static readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly StaminaSystem _stamina = 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) private void Effects(EntityUid uid, NarcoticEffectComponent component, int index)
{ {
var damageSpecifier = new DamageSpecifier(_prototypeManager.Index<DamageTypePrototype>("Poison"), 5);
RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator"));
CancellationToken token = component.cancelTokenSource.Token; CancellationToken token = component.cancelTokenSource.Token;
@@ -62,13 +65,13 @@ public sealed class NarcoticEffect : EntitySystem
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
case "StunAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): case "DamageAndShake" when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false);
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
case "Stun": case "Damage":
Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false);
break; break;
case "TremorAndShake": case "TremorAndShake":
@@ -84,8 +87,8 @@ public sealed class NarcoticEffect : EntitySystem
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;
case "StunAndShake": case "DamageAndShake":
Timer.SpawnRepeating(timer, () => _stun.TryParalyze(uid, TimeSpan.FromSeconds(component.StunTime), true), token); _damageableSystem.TryChangeDamage(uid, damageSpecifier, true, false);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;
} }