Shuttle UI now properly goes into pilot mode only when using the UI (#40491)

Shuttle UI bug fix
This commit is contained in:
beck-thompson
2025-09-21 23:40:13 -07:00
committed by GitHub
parent c0b1eae162
commit a26bafacb1
2 changed files with 8 additions and 6 deletions

View File

@@ -56,7 +56,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
SubscribeLocalEvent<ShuttleConsoleComponent, ComponentShutdown>(OnConsoleShutdown);
SubscribeLocalEvent<ShuttleConsoleComponent, PowerChangedEvent>(OnConsolePowerChange);
SubscribeLocalEvent<ShuttleConsoleComponent, AnchorStateChangedEvent>(OnConsoleAnchorChange);
SubscribeLocalEvent<ShuttleConsoleComponent, ActivatableUIOpenAttemptEvent>(OnConsoleUIOpenAttempt);
SubscribeLocalEvent<ShuttleConsoleComponent, AfterActivatableUIOpenEvent>(OnConsoleUIOpenAttempt);
Subs.BuiEvents<ShuttleConsoleComponent>(ShuttleConsoleUiKey.Key, subs =>
{
subs.Event<ShuttleConsoleFTLBeaconMessage>(OnBeaconFTLMessage);
@@ -150,10 +150,9 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
}
private void OnConsoleUIOpenAttempt(EntityUid uid, ShuttleConsoleComponent component,
ActivatableUIOpenAttemptEvent args)
AfterActivatableUIOpenEvent args)
{
if (!TryPilot(args.User, uid))
args.Cancel();
TryPilot(args.User, uid);
}
private void OnConsoleAnchorChange(EntityUid uid, ShuttleConsoleComponent component,

View File

@@ -1,6 +1,9 @@
using Robust.Shared.Player;
namespace Content.Shared.UserInterface;
/// <summary>
/// This is raised BEFORE opening a UI! Do not listen and then open / do something use
/// <see cref="AfterActivatableUIOpenEvent"/> for that.
/// </summary>
public sealed class ActivatableUIOpenAttemptEvent : CancellableEntityEventArgs
{
public EntityUid User { get; }