Nerf stims V2 (#227)

This commit is contained in:
CaypenNow
2024-03-24 13:59:57 +05:00
committed by GitHub
6 changed files with 146 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Coordinates.Helpers;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Storage;
namespace Content.Server.Holosign; namespace Content.Server.Holosign;
@@ -59,7 +60,7 @@ public sealed class HolosignSystem : EntitySystem
return; return;
} }
if (args.Handled || !args.CanReach) if (args.Handled || !args.CanReach || HasComp<StorageComponent>(args.Target))
return; return;
if (component.Signs.Count >= component.Uses) // wd edit if (component.Signs.Count >= component.Uses) // wd edit

View File

@@ -0,0 +1,99 @@
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;
using Content.Shared.StatusEffect;
using Robust.Shared.Random;
using Timer = Robust.Shared.Timing.Timer;
namespace Content.Shared._White.Chemistry;
public sealed class NarcoticEffect : EntitySystem
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly StaminaSystem _stamina = default!;
[Dependency] private readonly StandingStateSystem _standingStateSystem = default!;
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NarcoticEffectComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<NarcoticEffectComponent, ComponentRemove>(OnRemove);
}
private void OnInit(EntityUid uid, NarcoticEffectComponent component, ComponentInit args)
{
int index = _robustRandom.Next(0, Enum.GetNames(typeof(NarcoticEffects)).Length);
Effects(uid, component, index);
}
private void OnRemove(EntityUid uid, NarcoticEffectComponent component, ComponentRemove args)
{
if (TryComp<MovespeedModifierMetabolismComponent>(uid, out var movespeedModifierComponent))
{
if (movespeedModifierComponent.ModifierTimer != TimeSpan.Zero)
Timer.Spawn(movespeedModifierComponent.ModifierTimer, () => component.CancelTokenSource.Cancel());
return;
}
component.CancelTokenSource.Cancel();
}
private void Effects(EntityUid uid, NarcoticEffectComponent component, int index)
{
if(!TryComp<StandingStateComponent>(uid, out var standingComp))
return;
RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator"));
CancellationToken token = component.CancelTokenSource.Token;
TryComp<StatusEffectsComponent>(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 (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index))
{
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 NarcoticEffects.Shake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break;
case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _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);
break;
case NarcoticEffects.TremorAndShake:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break;
case NarcoticEffects.Tremor:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 15F), token);
break;
case NarcoticEffects.Shake:
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break;
case NarcoticEffects.StunAndShake:
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break;
}
}
}

View File

@@ -0,0 +1,30 @@
using System.Threading;
using Robust.Shared.Serialization;
namespace Content.Shared._White.Chemistry;
/// <summary>
/// This is used for...
/// </summary>
[RegisterComponent]
public sealed partial class NarcoticEffectComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField]
public CancellationTokenSource CancelTokenSource = new();
[ViewVariables(VVAccess.ReadOnly), DataField]
public List<int> TimerInterval = new() { 3000, 6000, 3800, 7000, 5000 };
[ViewVariables(VVAccess.ReadOnly), DataField]
public List<int> SlurTime = new() { 35, 60, 80, 90, 45 };
}
[Serializable, NetSerializable]
public enum NarcoticEffects
{
Stun,
Tremor,
Shake,
TremorAndShake,
StunAndShake
}

View File

@@ -32,8 +32,8 @@
key: Stutter key: Stutter
component: StutteringAccent component: StutteringAccent
- !type:GenericStatusEffect - !type:GenericStatusEffect
key: BlurryVision key: NarcoticEffect
component: BlurryVision component: NarcoticEffect
- !type:Jitter - !type:Jitter
- !type:GenericStatusEffect - !type:GenericStatusEffect
key: Stun key: Stun
@@ -76,8 +76,8 @@
Asphyxiation: 2 Asphyxiation: 2
- !type:Jitter - !type:Jitter
- !type:GenericStatusEffect - !type:GenericStatusEffect
key: BlurryVision key: NarcoticEffect
component: BlurryVision component: NarcoticEffect
- !type:GenericStatusEffect - !type:GenericStatusEffect
key: Stun key: Stun
time: 1 time: 1

View File

@@ -50,3 +50,10 @@
desc: "Знаю правду, славим великого!" desc: "Знаю правду, славим великого!"
moodChange: enum.MoodChangeLevel.Big moodChange: enum.MoodChangeLevel.Big
positiveEffect: true positiveEffect: true
- type: moodEffect
id: Stimulator
desc: "Я ЧУВСТВУЮ ЭТО, В МОЕЙ КРОВИ НАХОДИТСЯ ЧТО-ТО НЕОБЫЧНОЕ!!"
moodChange: enum.MoodChangeLevel.Medium
positiveEffect: true
timeout: 2

View File

@@ -64,6 +64,10 @@
id: BlurryVision id: BlurryVision
alwaysAllowed: true alwaysAllowed: true
- type: statusEffect
id: NarcoticEffect
alwaysAllowed: true
#WD EDIT #WD EDIT
- type: statusEffect - type: statusEffect
id: Incorporeal id: Incorporeal