Fix LoadPrototype admin button (#18802)

This commit is contained in:
metalgearsloth 2023-08-08 03:02:38 +10:00 committed by GitHub
parent 329d75880b
commit 51d7f180e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -27,6 +27,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
_decalPlacerController = UserInterfaceManager.GetUIController<DecalPlacerUIController>();
var adminManager = IoCManager.Resolve<IClientAdminManager>();
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<IClientAdminManager>();
LoadGamePrototypeButton.Disabled = !adminManager.CanCommand("loadprototype");
LoadBlueprintsButton.Disabled = !adminManager.CanCommand("loadgrid");
}
private void LoadGamePrototypeButtonOnPressed(BaseButton.ButtonEventArgs obj)