Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chronic Pain to People Upon Death #2677

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Content.Server/_DV/Pain/PainSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
using Content.Server.Explosion.EntitySystems;
using Content.Shared._DV.Pain;
using Content.Shared.Mobs;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;

namespace Content.Server._DV.Pain;

Expand All @@ -13,10 +17,13 @@ public sealed class PainSystem : SharedPainSystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;


public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PainComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<PainComponent, TriggerEvent>(HandlePainTrigger);
}

private void OnMapInit(Entity<PainComponent> ent, ref MapInitEvent args)
Expand Down Expand Up @@ -87,4 +94,13 @@ public override void Update(float frameTime)
component.NextUpdateTime = curTime + TimeSpan.FromSeconds(1);
}
}

private void HandlePainTrigger(EntityUid uid, PainComponent component, TriggerEvent args)
Lyndomen marked this conversation as resolved.
Show resolved Hide resolved
{
if (!TryComp<MobStateComponent>(uid, out var mobstate))
return;

if (mobstate.CurrentState == MobState.Dead)
EnsureComp<PainComponent>(uid);
}
}
Loading