add: new stimulator effects, mood integration
This commit is contained in:
72
Content.Server/_White/Chemistry/NarcoticEffect.cs
Normal file
72
Content.Server/_White/Chemistry/NarcoticEffect.cs
Normal file
@@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This handles system?
|
||||||
|
/// </summary>
|
||||||
|
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!;
|
||||||
|
|
||||||
|
/// <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, 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Content.Server/_White/Chemistry/NarcoticEffectComponent.cs
Normal file
19
Content.Server/_White/Chemistry/NarcoticEffectComponent.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Content.Server._White.Chemistry;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is used for...
|
||||||
|
/// </summary>
|
||||||
|
[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<string> Effects = new() { "Stun", "TremorAndShake", "Tremor", "Shake", "StunAndShake" };
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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: 4
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user