Store what access levels are available on the IDCard console (#8259)

Might be better as an accessgroup instead? LMK
This commit is contained in:
metalgearsloth
2022-05-21 14:19:02 +10:00
committed by GitHub
parent a51c5df14d
commit f066ac2551
7 changed files with 102 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Shared.Access;
using Content.Shared.Access.Systems;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -22,7 +23,7 @@ namespace Content.Client.Access.UI
private string? _lastFullName;
private string? _lastJobTitle;
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager, List<string> accessLevels)
{
RobustXamlLoader.Load(this);
@@ -42,8 +43,14 @@ namespace Content.Client.Access.UI
};
JobTitleSaveButton.OnPressed += _ => SubmitData();
foreach (var accessLevel in prototypeManager.EnumeratePrototypes<AccessLevelPrototype>())
foreach (var access in accessLevels)
{
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel))
{
Logger.ErrorS(SharedIdCardConsoleSystem.Sawmill, $"Unable to find accesslevel for {access}");
continue;
}
var newButton = new Button
{
Text = accessLevel.Name,