Skip to content

Commit

Permalink
Fix borgs access for doors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr0maks committed Aug 13, 2023
1 parent 85a15ed commit 5f63181
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions Content.Shared/Access/Systems/AccessReaderBoardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
using Robust.Shared.GameStates;
using Content.Shared.Doors.Components;
using Content.Shared.AlertLevel;
using Robust.Shared.Prototypes;

namespace Content.Shared.Access.Systems
{
public sealed class AccessReaderBoardSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] protected readonly SharedContainerSystem _container = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
Expand Down Expand Up @@ -318,25 +320,27 @@ public bool FindAccessItemsInventory(EntityUid uid, out HashSet<EntityUid> items
/// Try to find <see cref="AccessComponent"/> on this item
/// or inside this item (if it's pda)
/// </summary>
private bool FindAccessTagsItem(EntityUid uid, [NotNullWhen(true)] out HashSet<string>? tags)
private bool FindAccessTagsItem(EntityUid uid, out HashSet<string> tags)
{
if (TryComp(uid, out AccessComponent? access))
{
tags = access.Tags;
return true;
}
tags = new();
if (TryComp(uid, out AccessComponent? access))
{
tags.UnionWith(access.Tags);
}

if (TryComp(uid, out PdaComponent? pda) &&
pda.ContainedId is {Valid: true} id)
{
tags = EntityManager.GetComponent<AccessComponent>(id).Tags;
return true;
}
if (TryComp(uid, out PdaComponent? pda) &&
pda.ContainedId is { Valid: true } id)
{
tags.UnionWith(EntityManager.GetComponent<AccessComponent>(id).Tags);
}

tags = null;
return false;
var ev = new GetAccessTagsEvent(tags, _prototype);
RaiseLocalEvent(uid, ref ev);

return tags.Count != 0;
}


/// <summary>
/// Try to find <see cref="StationRecordKeyStorageComponent"/> on this item
/// or inside this item (if it's pda)
Expand Down

0 comments on commit 5f63181

Please sign in to comment.