Replace obsolete EntityCoordiates.InRange() with TransformSystem.InRange() (#29993)

* Replace EntityCoordiates.InRange() with TransformSystem.InRange()

* nullspace

* I figured it out

* man I have no clue how client side sutff works

* please have mercy

* remove RadiationPulseOverlay changes

* nullspace

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-07-13 14:25:51 -07:00
committed by GitHub
parent a03b88979e
commit b7aa97e203
14 changed files with 39 additions and 16 deletions

View File

@@ -8,12 +8,19 @@ namespace Content.Server.NPC.HTN.Preconditions;
public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _transformSystem = default!;
[DataField("targetKey", required: true)] public string TargetKey = default!;
[DataField("rangeKey", required: true)]
public string RangeKey = default!;
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
}
public override bool IsMet(NPCBlackboard blackboard)
{
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
@@ -22,6 +29,6 @@ public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
return false;
return coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
return _transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
}
}