Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ScarKy0 committed Jan 9, 2025
1 parent 66810ef commit bf9f6d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Content.Server/Access/Systems/AccessOverriderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ private void UpdateUserInterface(EntityUid uid, AccessOverriderComponent compone
targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + EntityManager.GetComponent<MetaDataComponent>(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();
}

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -244,8 +244,8 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid,
_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)}]");

accessReader.AccessLists = ConvertAccessListToHashSet(newAccessList);
Dirty(component.TargetAccessReaderId, accessReader);
accessReaderEnt.Value.Comp.AccessLists = ConvertAccessListToHashSet(newAccessList);
Dirty(accessReaderEnt.Value, accessReaderEnt.Value.Comp);
}

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions Content.Shared/Access/Systems/AccessReaderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AccessReaderComponent>? ent)
{
component = null;
if (!TryComp(uid, out AccessReaderComponent? accessReader))
ent = null;
if (!TryComp<AccessReaderComponent>(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<AccessReaderComponent>(entity, out var containedReader))
{
component = containedReader;
ent = (entity, containedReader);
return true;
}
}
Expand Down

0 comments on commit bf9f6d4

Please sign in to comment.