From 51d7f180e045403ca1dffef110bcd7c5bb852671 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 8 Aug 2023 03:02:38 +1000 Subject: [PATCH] Fix LoadPrototype admin button (#18802) --- .../UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs index 43439748d8..1d71d5bdf4 100644 --- a/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AdminbusTab/AdminbusTab.xaml.cs @@ -27,6 +27,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab _decalPlacerController = UserInterfaceManager.GetUIController(); var adminManager = IoCManager.Resolve(); + adminManager.AdminStatusUpdated += OnStatusUpdate; // For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually // TODO: This will probably need some command check at some point @@ -34,8 +35,15 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed; SpawnDecalsButton.OnPressed += SpawnDecalsButtonOnPressed; LoadGamePrototypeButton.OnPressed += LoadGamePrototypeButtonOnPressed; - LoadGamePrototypeButton.Disabled = !adminManager.HasFlag(AdminFlags.Query); - LoadBlueprintsButton.Disabled = !adminManager.HasFlag(AdminFlags.Mapping); + LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype"); + LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid"); + } + + private void OnStatusUpdate() + { + var adminManager = IoCManager.Resolve(); + LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype"); + LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid"); } private void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj)