From bda5cf704dfe9676c506ca9cd6d64dd8ad31db50 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:13:54 -0500 Subject: [PATCH 1/5] ouchies --- Content.Server/_DV/Pain/PainSystem.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Content.Server/_DV/Pain/PainSystem.cs b/Content.Server/_DV/Pain/PainSystem.cs index ce4b6711d78..dcfa04c8022 100644 --- a/Content.Server/_DV/Pain/PainSystem.cs +++ b/Content.Server/_DV/Pain/PainSystem.cs @@ -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; @@ -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(OnMapInit); + SubscribeLocalEvent(HandlePainTrigger); } private void OnMapInit(Entity ent, ref MapInitEvent args) @@ -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) + { + if (!TryComp(uid, out var mobstate)) + return; + + if (mobstate.CurrentState == MobState.Dead) + EnsureComp(uid); + } } 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 2/5] 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); } } From 17993bcd8d8b50c501b8fc9505ed1203f3d816f4 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Fri, 10 Jan 2025 01:35:00 -0500 Subject: [PATCH 3/5] oops --- Content.Server/_DV/Pain/PainSystem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Server/_DV/Pain/PainSystem.cs b/Content.Server/_DV/Pain/PainSystem.cs index bbd71838732..08e23e99461 100644 --- a/Content.Server/_DV/Pain/PainSystem.cs +++ b/Content.Server/_DV/Pain/PainSystem.cs @@ -5,7 +5,6 @@ using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; -using Content.Shared.Mobs.Components; namespace Content.Server._DV.Pain; @@ -94,7 +93,7 @@ public override void Update(float frameTime) private void HandlePainTrigger(EntityUid uid, PainComponent component, ref MobStateChangedEvent args) { - if (args.NewMobState != MobState.Dead && HasComp(uid)) + if (args.NewMobState == MobState.Dead && HasComp(uid)) EnsureComp(uid); } } From 5968139a7462d87f07881668578d557262b7da84 Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Fri, 10 Jan 2025 02:08:28 -0500 Subject: [PATCH 4/5] fucked if i know --- Content.Server/_DV/Pain/PainSystem.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Content.Server/_DV/Pain/PainSystem.cs b/Content.Server/_DV/Pain/PainSystem.cs index 08e23e99461..7beb917d4b3 100644 --- a/Content.Server/_DV/Pain/PainSystem.cs +++ b/Content.Server/_DV/Pain/PainSystem.cs @@ -19,7 +19,7 @@ public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(HandlePainTrigger); + SubscribeLocalEvent(HandlePainDeath); } private void OnMapInit(Entity ent, ref MapInitEvent args) @@ -91,9 +91,11 @@ public override void Update(float frameTime) } } - private void HandlePainTrigger(EntityUid uid, PainComponent component, ref MobStateChangedEvent args) + private void HandlePainDeath(EntityUid ent, PainComponent component, ref MobStateChangedEvent args) { - if (args.NewMobState == MobState.Dead && HasComp(uid)) - EnsureComp(uid); + if (args.NewMobState == MobState.Dead && args.OldMobState != MobState.Dead && HasComp(ent)) + { + EnsureComp(ent); + } } } From ba744958a4aad2a86c6ec57badea8f6dc1131ecb Mon Sep 17 00:00:00 2001 From: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:14:46 -0500 Subject: [PATCH 5/5] pro --- Content.Server/_DV/Pain/PainSystem.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Content.Server/_DV/Pain/PainSystem.cs b/Content.Server/_DV/Pain/PainSystem.cs index 7beb917d4b3..71e2060cafc 100644 --- a/Content.Server/_DV/Pain/PainSystem.cs +++ b/Content.Server/_DV/Pain/PainSystem.cs @@ -19,7 +19,7 @@ public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(HandlePainDeath); + SubscribeLocalEvent(HandlePainDeath); } private void OnMapInit(Entity ent, ref MapInitEvent args) @@ -91,11 +91,9 @@ public override void Update(float frameTime) } } - private void HandlePainDeath(EntityUid ent, PainComponent component, ref MobStateChangedEvent args) + private void HandlePainDeath(Entity ent, ref MobStateChangedEvent args) { - if (args.NewMobState == MobState.Dead && args.OldMobState != MobState.Dead && HasComp(ent)) - { - EnsureComp(ent); - } + if (args.NewMobState == MobState.Dead) + EnsureComp(args.Target); } }