Move Access & AccessReader to shared. (#5798)

* git mv

* Move Access Component & system.

- Name space changes
- Rename AccessReader to AccessReaderComponent
- Also need an abstract TryGetSlot function for SharedInventoryComponent

* better TryGetSlot

* Ah yes, tests exist.
This commit is contained in:
Leon Friedrich
2021-12-26 17:07:28 +13:00
committed by GitHub
parent 32d752bfa6
commit b675bdb789
27 changed files with 90 additions and 81 deletions

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Access.Components;
using Content.Server.Doors.Components;
using Content.Shared.Access.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
@@ -32,8 +32,8 @@ namespace Content.Server.AI.Pathfinding
/// The entities on this tile that require access to traverse
/// </summary>
/// We don't store the ICollection, at least for now, as we'd need to replicate the access code here
public IReadOnlyCollection<AccessReader> AccessReaders => _accessReaders.Values;
private readonly Dictionary<EntityUid, AccessReader> _accessReaders = new(0);
public IReadOnlyCollection<AccessReaderComponent> AccessReaders => _accessReaders.Values;
private readonly Dictionary<EntityUid, AccessReaderComponent> _accessReaders = new(0);
public PathfindingNode(PathfindingChunk parent, TileRef tileRef)
{
@@ -268,7 +268,7 @@ namespace Content.Server.AI.Pathfinding
// TODO: Check for powered I think (also need an event for when it's depowered
// AccessReader calls this whenever opening / closing but it can seem to get called multiple times
// Which may or may not be intended?
if (entMan.TryGetComponent(entity, out AccessReader? accessReader) && !_accessReaders.ContainsKey(entity))
if (entMan.TryGetComponent(entity, out AccessReaderComponent? accessReader) && !_accessReaders.ContainsKey(entity))
{
_accessReaders.Add(entity, accessReader);
ParentChunk.Dirty();