diff --git a/Content.Client/Shuttles/Systems/ShuttleConsoleLockSystem.cs b/Content.Client/Shuttles/Systems/ShuttleConsoleLockSystem.cs index ba6d50cce44..b0e038d8c8b 100644 --- a/Content.Client/Shuttles/Systems/ShuttleConsoleLockSystem.cs +++ b/Content.Client/Shuttles/Systems/ShuttleConsoleLockSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Shuttles.Systems; using Content.Shared.Shuttles.Components; using Content.Shared.Access.Components; +using Content.Shared.UserInterface; namespace Content.Client.Shuttles.Systems; @@ -17,4 +18,17 @@ public override bool TryUnlock(EntityUid console, EntityUid idCard, ShuttleConso // Prediction only return false; } -} \ No newline at end of file + + /// + /// Client extension of OnUIOpenAttempt. Prevents UI flashing open on client. + /// + protected override void OnUIOpenAttempt(EntityUid uid, + ShuttleConsoleLockComponent component, + ActivatableUIOpenAttemptEvent args) + { + base.OnUIOpenAttempt(uid, component, args); + + if(Timing.IsFirstTimePredicted && args.Cancelled) + Popup.PopupEntity(Loc.GetString("shuttle-console-locked"), uid, args.User); + } +} diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleLockSystem.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleLockSystem.cs index 7169b4b9b86..67d662b30ee 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleLockSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleLockSystem.cs @@ -5,7 +5,6 @@ using Content.Shared._NF.Shipyard.Components; using Content.Server.Shuttles.Components; using Content.Server.Hands.Systems; -using Content.Shared.UserInterface; using Robust.Shared.Audio.Systems; using Content.Shared.Verbs; using Robust.Shared.Utility; @@ -36,7 +35,6 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnShuttleConsoleLockInit); SubscribeLocalEvent>(AddUnlockVerb); - SubscribeLocalEvent(OnUIOpenAttempt); SubscribeLocalEvent(OnPdaAfterInteract); SubscribeLocalEvent(OnAfterInteractUsing); SubscribeLocalEvent(OnShuttleDeedInit); @@ -535,20 +533,6 @@ private bool TryLockWithVoucher(EntityUid console, EntityUid voucher, ShuttleCon return true; } - /// - /// Prevents using the console UI if it's locked - /// - private void OnUIOpenAttempt(EntityUid uid, - ShuttleConsoleLockComponent component, - ActivatableUIOpenAttemptEvent args) - { - if (GetEffectiveLockState(uid, component)) - { - Popup.PopupEntity(Loc.GetString("shuttle-console-locked"), uid, args.User); - args.Cancel(); - } - } - /// /// Finds all ID cards accessible to a user (in hands or worn) /// diff --git a/Content.Shared/Shuttles/Systems/SharedShuttleConsoleLockSystem.cs b/Content.Shared/Shuttles/Systems/SharedShuttleConsoleLockSystem.cs index 980a2a98ca2..6f03b1cb993 100644 --- a/Content.Shared/Shuttles/Systems/SharedShuttleConsoleLockSystem.cs +++ b/Content.Shared/Shuttles/Systems/SharedShuttleConsoleLockSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Access.Components; using Content.Shared.Shuttles.Components; using Content.Shared._NF.Shipyard.Components; +using Content.Shared.UserInterface; using Content.Shared.Popups; using Robust.Shared.Timing; using Content.Shared.Examine; @@ -22,6 +23,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnUIOpenAttempt); } private void OnStartup(EntityUid uid, ShuttleConsoleLockComponent component, ComponentStartup args) @@ -58,6 +60,17 @@ public bool GetEffectiveLockState(EntityUid console, ShuttleConsoleLockComponent return component.Locked; } + /// + /// Prevents using the console UI if it's locked + /// + protected virtual void OnUIOpenAttempt(EntityUid uid, + ShuttleConsoleLockComponent component, + ActivatableUIOpenAttemptEvent args) + { + if (GetEffectiveLockState(uid, component)) + args.Cancel(); + } + protected void UpdateAppearance(EntityUid uid, ShuttleConsoleLockComponent? component = null) { if (!Resolve(uid, ref component))