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
This commit is contained in:
@@ -75,6 +75,7 @@ public sealed partial class TimerTriggerComponent : Component
|
||||
|
||||
/// <summary>
|
||||
/// The entity that activated this trigger.
|
||||
/// TODO: use WeakEntityReference once the engine PR is merged!
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? User;
|
||||
|
||||
@@ -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<ActiveTimerTriggerComponent>(uid);
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user