NPC Warnings cleanup (#36189)
* NPC Warnings cleanup * Reverting unnecessary changes * Reverting unnecessary changes, missed * Using entity GetGrid override instead
This commit is contained in:
@@ -86,7 +86,7 @@ public sealed partial class MoveToOperator : HTNOperator, IHtnConditionalShutdow
|
||||
return (false, null);
|
||||
|
||||
if (!_entManager.TryGetComponent<MapGridComponent>(xform.GridUid, out var ownerGrid) ||
|
||||
!_entManager.TryGetComponent<MapGridComponent>(targetCoordinates.GetGridUid(_entManager), out var targetGrid))
|
||||
!_entManager.TryGetComponent<MapGridComponent>(_transform.GetGrid(targetCoordinates), out var targetGrid))
|
||||
{
|
||||
return (false, null);
|
||||
}
|
||||
@@ -155,8 +155,8 @@ public sealed partial class MoveToOperator : HTNOperator, IHtnConditionalShutdow
|
||||
{
|
||||
if (blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||
{
|
||||
var mapCoords = coordinates.ToMap(_entManager, _transform);
|
||||
_steering.PrunePath(uid, mapCoords, targetCoordinates.ToMapPos(_entManager, _transform) - mapCoords.Position, result.Path);
|
||||
var mapCoords = _transform.ToMapCoordinates(coordinates);
|
||||
_steering.PrunePath(uid, mapCoords, _transform.ToMapCoordinates(targetCoordinates).Position - mapCoords.Position, result.Path);
|
||||
}
|
||||
|
||||
comp.CurrentPath = new Queue<PathPoly>(result.Path);
|
||||
|
||||
@@ -2,10 +2,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Destructible;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Climbing.Components;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.NPC;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Collections;
|
||||
@@ -281,7 +277,7 @@ public sealed partial class PathfindingSystem
|
||||
var gridUid = ev.Component.GridUid;
|
||||
var oldGridUid = ev.OldPosition.EntityId == ev.NewPosition.EntityId
|
||||
? gridUid
|
||||
: ev.OldPosition.GetGridUid(EntityManager);
|
||||
: _transform.GetGrid((ev.Entity.Owner, ev.Component));
|
||||
|
||||
if (oldGridUid != null && oldGridUid != gridUid)
|
||||
{
|
||||
@@ -395,7 +391,7 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private Vector2i GetOrigin(EntityCoordinates coordinates, EntityUid gridUid)
|
||||
{
|
||||
var localPos = Vector2.Transform(coordinates.ToMapPos(EntityManager, _transform), _transform.GetInvWorldMatrix(gridUid));
|
||||
var localPos = Vector2.Transform(_transform.ToMapCoordinates(coordinates).Position, _transform.GetInvWorldMatrix(gridUid));
|
||||
return new Vector2i((int) Math.Floor(localPos.X / ChunkSize), (int) Math.Floor(localPos.Y / ChunkSize));
|
||||
}
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var targetPos = steering.Coordinates.ToMap(EntityManager, _transform);
|
||||
var targetPos = _transform.ToMapCoordinates(steering.Coordinates);
|
||||
var ourPos = _transform.GetMapCoordinates(uid, xform: xform);
|
||||
|
||||
PrunePath(uid, ourPos, targetPos.Position - ourPos.Position, result.Path);
|
||||
|
||||
Reference in New Issue
Block a user