diff --git a/Content.Server/Access/Systems/AccessOverriderSystem.cs b/Content.Server/Access/Systems/AccessOverriderSystem.cs index c7b20513f428b3..a882209b2d1758 100644 --- a/Content.Server/Access/Systems/AccessOverriderSystem.cs +++ b/Content.Server/Access/Systems/AccessOverriderSystem.cs @@ -116,10 +116,10 @@ private void UpdateUserInterface(EntityUid uid, AccessOverriderComponent compone targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + EntityManager.GetComponent(component.TargetAccessReaderId).EntityName; targetLabelColor = Color.White; - if (!_accessReader.GetMainAccessReader(accessReader, out var accessReaderComponent)) + if (!_accessReader.GetMainAccessReader(accessReader, out var accessReaderEnt)) return; - var currentAccessHashsets = accessReaderComponent.AccessLists; + var currentAccessHashsets = accessReaderEnt.Value.Comp.AccessLists; currentAccess = ConvertAccessHashSetsToList(currentAccessHashsets).ToArray(); } @@ -210,10 +210,10 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid, return; } - if (!_accessReader.GetMainAccessReader(component.TargetAccessReaderId, out var accessReader)) + if (!_accessReader.GetMainAccessReader(component.TargetAccessReaderId, out var accessReaderEnt)) return; - var oldTags = ConvertAccessHashSetsToList(accessReader.AccessLists); + var oldTags = ConvertAccessHashSetsToList(accessReaderEnt.Value.Comp.AccessLists); var privilegedId = component.PrivilegedIdSlot.Item; if (oldTags.SequenceEqual(newAccessList)) @@ -242,10 +242,10 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid, var removedTags = oldTags.Except(newAccessList).Select(tag => "-" + tag).ToList(); _adminLogger.Add(LogType.Action, LogImpact.Medium, - $"{ToPrettyString(player):player} has modified {ToPrettyString(component.TargetAccessReaderId):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]"); + $"{ToPrettyString(player):player} has modified {ToPrettyString(accessReaderEnt.Value):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]"); - accessReader.AccessLists = ConvertAccessListToHashSet(newAccessList); - Dirty(component.TargetAccessReaderId, accessReader); + accessReaderEnt.Value.Comp.AccessLists = ConvertAccessListToHashSet(newAccessList); + Dirty(accessReaderEnt.Value); } /// diff --git a/Content.Server/StationEvents/Events/GreytideVirusRule.cs b/Content.Server/StationEvents/Events/GreytideVirusRule.cs index 19d4438347255f..8d33b858de49a2 100644 --- a/Content.Server/StationEvents/Events/GreytideVirusRule.cs +++ b/Content.Server/StationEvents/Events/GreytideVirusRule.cs @@ -94,11 +94,11 @@ protected override void Started(EntityUid uid, GreytideVirusRuleComponent virusC continue; // use the access reader from the door electronics if they exist - if (!_access.GetMainAccessReader(airlockUid, out var accessComp)) + if (!_access.GetMainAccessReader(airlockUid, out var accessEnt)) continue; // check access - if (!_access.AreAccessTagsAllowed(accessIds, accessComp) || _access.AreAccessTagsAllowed(virusComp.Blacklist, accessComp)) + if (!_access.AreAccessTagsAllowed(accessIds, accessEnt.Value.Comp) || _access.AreAccessTagsAllowed(virusComp.Blacklist, accessEnt.Value.Comp)) continue; // open and bolt airlocks diff --git a/Content.Shared/Access/Systems/AccessReaderSystem.cs b/Content.Shared/Access/Systems/AccessReaderSystem.cs index f670ac860be44d..0b1d508cc24103 100644 --- a/Content.Shared/Access/Systems/AccessReaderSystem.cs +++ b/Content.Shared/Access/Systems/AccessReaderSystem.cs @@ -113,25 +113,25 @@ public bool IsAllowed(EntityUid user, EntityUid target, AccessReaderComponent? r return false; } - public bool GetMainAccessReader(EntityUid uid, [NotNullWhen(true)] out AccessReaderComponent? component) + public bool GetMainAccessReader(EntityUid uid, [NotNullWhen(true)] out Entity? ent) { - component = null; - if (!TryComp(uid, out AccessReaderComponent? accessReader)) + ent = null; + if (!TryComp(uid, out var accessReader)) return false; - component = accessReader; + ent = (uid, accessReader); - if (component.ContainerAccessProvider == null) + if (ent.Value.Comp.ContainerAccessProvider == null) return true; - if (!_containerSystem.TryGetContainer(uid, component.ContainerAccessProvider, out var container)) + if (!_containerSystem.TryGetContainer(uid, ent.Value.Comp.ContainerAccessProvider, out var container)) return true; foreach (var entity in container.ContainedEntities) { - if (TryComp(entity, out AccessReaderComponent? containedReader)) + if (TryComp(entity, out var containedReader)) { - component = containedReader; + ent = (entity, containedReader); return true; } }