Replace obsolete functions in NPC systems (#31448)
This commit is contained in:
@@ -20,6 +20,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly MeleeWeaponSystem _melee = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private EntityQuery<NPCMeleeCombatComponent> _npcMeleeQuery;
|
||||
@@ -59,7 +60,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var currentTile = grid.CoordinatesToTile(args.Transform.Coordinates);
|
||||
var currentTile = _mapSystem.CoordinatesToTile(args.Transform.GridUid.Value, grid, args.Transform.Coordinates);
|
||||
|
||||
if (component.TargetTile == null)
|
||||
{
|
||||
@@ -116,7 +117,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var targetCoords = grid.GridTileToWorld(component.TargetTile.Value);
|
||||
var targetCoords = _mapSystem.GridTileToWorld(args.Transform.GridUid.Value, grid, component.TargetTile.Value);
|
||||
var targetDir = (targetCoords.Position - args.WorldPosition);
|
||||
targetDir = args.OffsetRotation.RotateVec(targetDir);
|
||||
const float weight = 1f;
|
||||
|
||||
@@ -166,8 +166,8 @@ public sealed partial class NPCSteeringSystem
|
||||
}
|
||||
|
||||
// Check if mapids match.
|
||||
var targetMap = targetCoordinates.ToMap(EntityManager, _transform);
|
||||
var ourMap = ourCoordinates.ToMap(EntityManager, _transform);
|
||||
var targetMap = _transform.ToMapCoordinates(targetCoordinates);
|
||||
var ourMap = _transform.ToMapCoordinates(ourCoordinates);
|
||||
|
||||
if (targetMap.MapId != ourMap.MapId)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ public sealed partial class NPCSteeringSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
targetMap = targetCoordinates.ToMap(EntityManager, _transform);
|
||||
targetMap = _transform.ToMapCoordinates(targetCoordinates);
|
||||
|
||||
// Can't make it again.
|
||||
if (ourMap.MapId != targetMap.MapId)
|
||||
@@ -439,7 +439,7 @@ public sealed partial class NPCSteeringSystem
|
||||
if (!node.Data.IsFreeSpace)
|
||||
break;
|
||||
|
||||
var nodeMap = node.Coordinates.ToMap(EntityManager, _transform);
|
||||
var nodeMap = _transform.ToMapCoordinates(node.Coordinates);
|
||||
|
||||
// If any nodes are 'behind us' relative to the target we'll prune them.
|
||||
// This isn't perfect but should fix most cases of stutter stepping.
|
||||
|
||||
@@ -207,7 +207,7 @@ public sealed partial class NPCSteeringSystem
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var ent in grid.GetLocalAnchoredEntities(poly.Box))
|
||||
foreach (var ent in _mapSystem.GetLocalAnchoredEntities(poly.GraphUid, grid, poly.Box))
|
||||
{
|
||||
if (!_physicsQuery.TryGetComponent(ent, out var body) ||
|
||||
!body.Hard ||
|
||||
|
||||
@@ -54,6 +54,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
||||
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
||||
[Dependency] private readonly PryingSystem _pryingSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||
[Dependency] private readonly SharedMeleeWeaponSystem _melee = default!;
|
||||
[Dependency] private readonly SharedMoverController _mover = default!;
|
||||
|
||||
Reference in New Issue
Block a user