From: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Date: Sat, 4 Oct 2025 17:51:36 +0000 (-0700) Subject: Explosives with timers now properly alert admins when detonating (#40471) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=7e3ee1d7c6097b2290d8e7f93a031b82794bbd0a;p=space-station-14.git Explosives with timers now properly alert admins when detonating (#40471) * Explosives with timers now properly alert admins when detonating * add TODO comment * Check if user is deleted before triggering --- diff --git a/Content.Shared/Trigger/Components/TimerTriggerComponent.cs b/Content.Shared/Trigger/Components/TimerTriggerComponent.cs index 9cc58d3cda..f413ab5d4f 100644 --- a/Content.Shared/Trigger/Components/TimerTriggerComponent.cs +++ b/Content.Shared/Trigger/Components/TimerTriggerComponent.cs @@ -75,6 +75,7 @@ public sealed partial class TimerTriggerComponent : Component /// /// The entity that activated this trigger. + /// TODO: use WeakEntityReference once the engine PR is merged! /// [DataField, AutoNetworkedField] public EntityUid? User; diff --git a/Content.Shared/Trigger/Systems/TriggerSystem.Timer.cs b/Content.Shared/Trigger/Systems/TriggerSystem.Timer.cs index 58ac43e571..179b04af93 100644 --- a/Content.Shared/Trigger/Systems/TriggerSystem.Timer.cs +++ b/Content.Shared/Trigger/Systems/TriggerSystem.Timer.cs @@ -168,7 +168,8 @@ public sealed partial class TriggerSystem if (timer.NextTrigger <= curTime) { - Trigger(uid, timer.User, timer.KeyOut); + var user = TerminatingOrDeleted(timer.User) ? null : timer.User; + Trigger(uid, user, timer.KeyOut); // Remove after triggering to prevent it from starting the timer again RemComp(uid); if (TryComp(uid, out var appearance)) diff --git a/Content.Shared/Trigger/Systems/TriggerSystem.cs b/Content.Shared/Trigger/Systems/TriggerSystem.cs index ca60901a79..25f8d51e11 100644 --- a/Content.Shared/Trigger/Systems/TriggerSystem.cs +++ b/Content.Shared/Trigger/Systems/TriggerSystem.cs @@ -107,6 +107,7 @@ public sealed partial class TriggerSystem : EntitySystem ent.Comp.NextTrigger = curTime + ent.Comp.Delay; var delay = ent.Comp.InitialBeepDelay ?? ent.Comp.BeepInterval; ent.Comp.NextBeep = curTime + delay; + ent.Comp.User = user; Dirty(ent); var ev = new ActiveTimerTriggerEvent(user);