Move Access to ECS (#4826)
* Moved access to ecs * Fixed tests * Moved test to integration * Better IoC * Moved preset ID card * Moved id card to ECS * Moved access component to ECS * Fixed pda access * Final touches Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Access.Components;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AI.Pathfinding.Pathfinders;
|
||||
using Content.Shared.AI;
|
||||
using Content.Shared.GameTicking;
|
||||
@@ -38,6 +39,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Queued region updates
|
||||
@@ -184,7 +186,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
collisionMask = physics.CollisionMask;
|
||||
}
|
||||
|
||||
var access = AccessReader.FindAccessTags(entity);
|
||||
var access = _accessReader.FindAccessTags(entity.Uid);
|
||||
|
||||
// We'll do a quick traversable check before going through regions
|
||||
// If we can't access it we'll try to get a valid node in range (this is essentially an early-out)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Access.Components;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AI.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -32,7 +33,8 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
collisionMask = physics.CollisionMask;
|
||||
}
|
||||
|
||||
var access = AccessReader.FindAccessTags(entity);
|
||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||
var access = accessSystem.FindAccessTags(entity.Uid);
|
||||
var visionRadius = entity.GetComponent<AiControllerComponent>().VisionRadius;
|
||||
|
||||
return new ReachableArgs(visionRadius, access, collisionMask);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AI.Pathfinding.Accessible;
|
||||
using Content.Server.AI.Pathfinding.Pathfinders;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -117,9 +118,10 @@ namespace Content.Server.AI.Pathfinding
|
||||
return false;
|
||||
}
|
||||
|
||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||
foreach (var reader in node.AccessReaders)
|
||||
{
|
||||
if (!reader.IsAllowed(access))
|
||||
if (!accessSystem.IsAllowed(reader, access))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Content.Server.Access;
|
||||
using Content.Server.Access.Components;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AI.Pathfinding.Pathfinders;
|
||||
using Content.Server.CPUJob.JobQueues;
|
||||
using Content.Server.CPUJob.JobQueues.Queues;
|
||||
@@ -31,6 +32,7 @@ namespace Content.Server.AI.Pathfinding
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
|
||||
public IReadOnlyDictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> Graph => _graph;
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> _graph = new();
|
||||
@@ -375,11 +377,10 @@ namespace Content.Server.AI.Pathfinding
|
||||
return false;
|
||||
}
|
||||
|
||||
var access = AccessReader.FindAccessTags(entity);
|
||||
|
||||
var access = _accessReader.FindAccessTags(entity.Uid);
|
||||
foreach (var reader in node.AccessReaders)
|
||||
{
|
||||
if (!reader.IsAllowed(access))
|
||||
if (!_accessReader.IsAllowed(reader, access))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user