From f18100139f1f3324a1c2f10da2dc43f6cc56d7c4 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Fri, 10 Jan 2025 01:16:27 -0500 Subject: [PATCH] not working ops --- Content.Server/_DV/Pain/PainSystem.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Content.Server/_DV/Pain/PainSystem.cs b/Content.Server/_DV/Pain/PainSystem.cs index dcfa04c8022..bbd71838732 100644 --- a/Content.Server/_DV/Pain/PainSystem.cs +++ b/Content.Server/_DV/Pain/PainSystem.cs @@ -1,11 +1,10 @@ -using Content.Server.Explosion.EntitySystems; using Content.Shared._DV.Pain; +using Content.Shared.Humanoid; 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; @@ -17,13 +16,11 @@ public sealed class PainSystem : SharedPainSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; - public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(HandlePainTrigger); + SubscribeLocalEvent(HandlePainTrigger); } private void OnMapInit(Entity ent, ref MapInitEvent args) @@ -95,12 +92,9 @@ public override void Update(float frameTime) } } - private void HandlePainTrigger(EntityUid uid, PainComponent component, TriggerEvent args) + private void HandlePainTrigger(EntityUid uid, PainComponent component, ref MobStateChangedEvent args) { - if (!TryComp(uid, out var mobstate)) - return; - - if (mobstate.CurrentState == MobState.Dead) + if (args.NewMobState != MobState.Dead && HasComp(uid)) EnsureComp(uid); } }