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,11 +1,9 @@
using System.Linq;
using Content.Server.Access.Systems;
using Content.Server.UserInterface;
using Content.Shared.Access;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.Server.Access.Components
{
@@ -13,7 +11,6 @@ namespace Content.Server.Access.Components
[ComponentReference(typeof(SharedIdCardConsoleComponent))]
public sealed class IdCardConsoleComponent : SharedIdCardConsoleComponent
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entities = default!;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(IdCardConsoleUiKey.Key);
@@ -75,7 +72,7 @@ namespace Content.Server.Access.Components
cardSystem.TryChangeFullName(targetIdEntity, newFullName);
cardSystem.TryChangeJobTitle(targetIdEntity, newJobTitle);
if (!newAccessList.TrueForAll(x => _prototypeManager.HasIndex<AccessLevelPrototype>(x)))
if (!newAccessList.TrueForAll(x => AccessLevels.Contains(x)))
{
Logger.Warning("Tried to write unknown access tag.");
return;