From 42de8df51915896c3703c5f7acac7b123a246397 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Fri, 31 May 2024 07:56:20 -0700 Subject: [PATCH] Add firelock warnings popup when opening on access allowed (#28420) --- .../Doors/Systems/SharedFirelockSystem.cs | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs index 4afe26039b..03350d2e64 100644 --- a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs @@ -56,25 +56,36 @@ public abstract class SharedFirelockSystem : EntitySystem if (!component.Powered || (!overrideAccess && component.IsLocked)) args.Cancel(); + else if (args.User != null) + WarnPlayer((uid, component), args.User.Value); } private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args) { - if (component.Temperature) - { - _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-fire-message"), - uid, args.User, PopupType.MediumCaution); - } - else if (component.Pressure) - { - _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-pressure-message"), - uid, args.User, PopupType.MediumCaution); - } + WarnPlayer((uid, component), args.User); if (component.IsLocked) args.PryTimeModifier *= component.LockedPryTimeModifier; } + private void WarnPlayer(Entity ent, EntityUid user) + { + if (ent.Comp.Temperature) + { + _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-fire-message"), + ent.Owner, + user, + PopupType.MediumCaution); + } + else if (ent.Comp.Pressure) + { + _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-pressure-message"), + ent.Owner, + user, + PopupType.MediumCaution); + } + } + private void OnAfterPried(EntityUid uid, FirelockComponent component, ref PriedEvent args) { component.EmergencyCloseCooldown = _gameTiming.CurTime + component.EmergencyCloseCooldownDuration;