mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
Replace obsolete functions in NPC systems (#31448)
(cherry picked from commit e85c25a7468b4daea7a5f1deb85900a9151651cf) Signed-off-by: Spatison <137375981+Spatison@users.noreply.github.com>
This commit is contained in:
@@ -16,8 +16,8 @@ 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!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
private EntityQuery<NPCMeleeCombatComponent> _npcMeleeQuery;
|
||||
private EntityQuery<NPCRangedCombatComponent> _npcRangedQuery;
|
||||
@@ -56,7 +56,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var currentTile = _map.CoordinatesToTile((EntityUid) args.Transform.GridUid, grid, args.Transform.Coordinates);
|
||||
var currentTile = _mapSystem.CoordinatesToTile(args.Transform.GridUid.Value, grid, args.Transform.Coordinates);
|
||||
|
||||
if (component.TargetTile == null)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
var index = (startIndex + i) % 8;
|
||||
var neighbor = ((Direction) index).ToIntVec() + currentTile;
|
||||
var neighbor = ((Direction)index).ToIntVec() + currentTile;
|
||||
var valid = true;
|
||||
|
||||
// TODO: Probably make this a helper on engine maybe
|
||||
@@ -112,7 +112,7 @@ public sealed class NPCJukeSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var targetCoords = _map.GridTileToWorld((EntityUid) args.Transform.GridUid, grid, 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;
|
||||
|
||||
@@ -22,7 +22,7 @@ public sealed partial class NPCSteeringSystem
|
||||
if (weight == 0f || direction == Vector2.Zero)
|
||||
return;
|
||||
|
||||
var directionAngle = (float) direction.ToAngle().Theta;
|
||||
var directionAngle = (float)direction.ToAngle().Theta;
|
||||
|
||||
for (var i = 0; i < InterestDirections; i++)
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
@@ -429,7 +429,7 @@ public sealed partial class NPCSteeringSystem
|
||||
|
||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||
{
|
||||
mask = (CollisionGroup) physics.CollisionMask;
|
||||
mask = (CollisionGroup)physics.CollisionMask;
|
||||
}
|
||||
|
||||
for (var i = 0; i < nodes.Count; i++)
|
||||
@@ -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 _map.GetLocalAnchoredEntities(poly.GraphUid, grid, poly.Box))
|
||||
foreach (var ent in _mapSystem.GetLocalAnchoredEntities(poly.GraphUid, grid, poly.Box))
|
||||
{
|
||||
if (!_physicsQuery.TryGetComponent(ent, out var body) ||
|
||||
!body.Hard ||
|
||||
|
||||
@@ -55,6 +55,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