From 5f6318164f607a5309f7376a28e47d0cf98730b4 Mon Sep 17 00:00:00 2001 From: Mr0maks Date: Sun, 13 Aug 2023 15:10:51 +0500 Subject: [PATCH] Fix borgs access for doors --- .../Access/Systems/AccessReaderBoardSystem.cs | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Content.Shared/Access/Systems/AccessReaderBoardSystem.cs b/Content.Shared/Access/Systems/AccessReaderBoardSystem.cs index 3432952c69ca44..998b3446430d94 100644 --- a/Content.Shared/Access/Systems/AccessReaderBoardSystem.cs +++ b/Content.Shared/Access/Systems/AccessReaderBoardSystem.cs @@ -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!; @@ -318,25 +320,27 @@ public bool FindAccessItemsInventory(EntityUid uid, out HashSet items /// Try to find on this item /// or inside this item (if it's pda) /// - private bool FindAccessTagsItem(EntityUid uid, [NotNullWhen(true)] out HashSet? tags) + private bool FindAccessTagsItem(EntityUid uid, out HashSet 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(id).Tags; - return true; - } + if (TryComp(uid, out PdaComponent? pda) && + pda.ContainedId is { Valid: true } id) + { + tags.UnionWith(EntityManager.GetComponent(id).Tags); + } - tags = null; - return false; + var ev = new GetAccessTagsEvent(tags, _prototype); + RaiseLocalEvent(uid, ref ev); + + return tags.Count != 0; } + /// /// Try to find on this item /// or inside this item (if it's pda)