Store what access levels are available on the IDCard console (#8259)
Might be better as an accessgroup instead? LMK
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using Content.Client.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -19,8 +21,20 @@ namespace Content.Client.Access.UI
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
List<string> accessLevels;
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
||||
if (_entityManager.TryGetComponent<IdCardConsoleComponent>(Owner.Owner, out var idCard))
|
||||
{
|
||||
accessLevels = idCard.AccessLevels;
|
||||
accessLevels.Sort();
|
||||
}
|
||||
else
|
||||
{
|
||||
accessLevels = new List<string>();
|
||||
Logger.ErrorS(SharedIdCardConsoleSystem.Sawmill, $"No IdCardConsole component found for {_entityManager.ToPrettyString(Owner.Owner)}!");
|
||||
}
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager, accessLevels) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
||||
|
||||
_window.PrivilegedIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(PrivilegedIdCardSlotId));
|
||||
_window.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(TargetIdCardSlotId));
|
||||
|
||||
Reference in New Issue
Block a user