Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -1,6 +1,5 @@
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;
@@ -171,7 +170,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
/// <param name="target"></param>
/// <param name="range"></param>
/// <returns></returns>
public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f)
public bool CanAccess(EntityUid entity, EntityUid target, float range = 0.0f)
{
// TODO: Handle this gracefully instead of just failing.
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).GridID.IsValid())
@@ -208,7 +207,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
return CanAccess(entity, targetNode);
}
public bool CanAccess(IEntity entity, PathfindingNode targetNode)
public bool CanAccess(EntityUid entity, PathfindingNode targetNode)
{
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID != targetNode.TileRef.GridIndex)
{
@@ -423,7 +422,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public PathfindingRegion? GetRegion(IEntity entity)
public PathfindingRegion? GetRegion(EntityUid entity)
{
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID.IsValid())
{

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Content.Server.Access.Components;
using Content.Server.Access.Systems;
using Content.Server.AI.Components;
using Robust.Shared.GameObjects;
@@ -26,7 +25,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public static ReachableArgs GetArgs(IEntity entity)
public static ReachableArgs GetArgs(EntityUid entity)
{
var collisionMask = 0;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics))

View File

@@ -23,17 +23,17 @@ namespace Content.Server.AI.Pathfinding
/// Whenever there's a change in the collision layers we update the mask as the graph has more reads than writes
/// </summary>
public int BlockedCollisionMask { get; private set; }
private readonly Dictionary<IEntity, int> _blockedCollidables = new(0);
private readonly Dictionary<EntityUid, int> _blockedCollidables = new(0);
public IReadOnlyDictionary<IEntity, int> PhysicsLayers => _physicsLayers;
private readonly Dictionary<IEntity, int> _physicsLayers = new(0);
public IReadOnlyDictionary<EntityUid, int> PhysicsLayers => _physicsLayers;
private readonly Dictionary<EntityUid, int> _physicsLayers = new(0);
/// <summary>
/// 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<IEntity, AccessReader> _accessReaders = new(0);
private readonly Dictionary<EntityUid, AccessReader> _accessReaders = new(0);
public PathfindingNode(PathfindingChunk parent, TileRef tileRef)
{
@@ -42,7 +42,7 @@ namespace Content.Server.AI.Pathfinding
GenerateMask();
}
public static bool IsRelevant(IEntity entity, IPhysBody physicsComponent)
public static bool IsRelevant(EntityUid entity, IPhysBody physicsComponent)
{
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID == GridId.Invalid ||
(PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0)
@@ -258,7 +258,7 @@ namespace Content.Server.AI.Pathfinding
/// <param name="entity"></param>
/// TODO: These 2 methods currently don't account for a bunch of changes (e.g. airlock unpowered, wrenching, etc.)
/// TODO: Could probably optimise this slightly more.
public void AddEntity(IEntity entity, IPhysBody physicsComponent)
public void AddEntity(EntityUid entity, IPhysBody physicsComponent)
{
// If we're a door
if (IoCManager.Resolve<IEntityManager>().HasComponent<AirlockComponent>(entity) || IoCManager.Resolve<IEntityManager>().HasComponent<ServerDoorComponent>(entity))
@@ -294,7 +294,7 @@ namespace Content.Server.AI.Pathfinding
/// Will check each category and remove it from the applicable one
/// </summary>
/// <param name="entity"></param>
public void RemoveEntity(IEntity entity)
public void RemoveEntity(EntityUid entity)
{
// There's no guarantee that the entity isn't deleted
// 90% of updates are probably entities moving around

View File

@@ -2,7 +2,6 @@ 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;
@@ -46,7 +45,7 @@ namespace Content.Server.AI.Pathfinding
private readonly Queue<TileRef> _tileUpdateQueue = new();
// Need to store previously known entity positions for collidables for when they move
private readonly Dictionary<IEntity, PathfindingNode> _lastKnownPositions = new();
private readonly Dictionary<EntityUid, PathfindingNode> _lastKnownPositions = new();
public const int TrackedCollisionLayers = (int)
(CollisionGroup.Impassable |
@@ -85,15 +84,15 @@ namespace Content.Server.AI.Pathfinding
foreach (var update in _collidableUpdateQueue)
{
if (!EntityManager.TryGetEntity(update.Owner, out var entity)) continue;
if (!EntityManager.EntityExists(update.Owner)) continue;
if (update.CanCollide)
{
HandleEntityAdd(entity);
HandleEntityAdd(update.Owner);
}
else
{
HandleEntityRemove(entity);
HandleEntityRemove(update.Owner);
}
totalUpdates++;
@@ -182,7 +181,7 @@ namespace Content.Server.AI.Pathfinding
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public PathfindingNode GetNode(IEntity entity)
public PathfindingNode GetNode(EntityUid entity)
{
var tile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates);
return GetNode(tile);
@@ -263,7 +262,7 @@ namespace Content.Server.AI.Pathfinding
/// </summary>
/// The node will filter it to the correct category (if possible)
/// <param name="entity"></param>
private void HandleEntityAdd(IEntity entity)
private void HandleEntityAdd(EntityUid entity)
{
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
_lastKnownPositions.ContainsKey(entity) ||
@@ -282,7 +281,7 @@ namespace Content.Server.AI.Pathfinding
_lastKnownPositions.Add(entity, node);
}
private void HandleEntityRemove(IEntity entity)
private void HandleEntityRemove(EntityUid entity)
{
if (!_lastKnownPositions.TryGetValue(entity, out var node))
{
@@ -361,7 +360,7 @@ namespace Content.Server.AI.Pathfinding
// TODO: Need to rethink the pathfinder utils (traversable etc.). Maybe just chuck them all in PathfindingSystem
// Otherwise you get the steerer using this and the pathfinders using a different traversable.
// Also look at increasing tile cost the more physics entities are on it
public bool CanTraverse(IEntity entity, EntityCoordinates coordinates)
public bool CanTraverse(EntityUid entity, EntityCoordinates coordinates)
{
var gridId = coordinates.GetGridId(EntityManager);
var tile = _mapManager.GetGrid(gridId).GetTileRef(coordinates);
@@ -369,7 +368,7 @@ namespace Content.Server.AI.Pathfinding
return CanTraverse(entity, node);
}
public bool CanTraverse(IEntity entity, PathfindingNode node)
public bool CanTraverse(EntityUid entity, PathfindingNode node)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics) &&
(physics.CollisionMask & node.BlockedCollisionMask) != 0)