* 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>
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using Robust.Shared.Map;
|
|
|
|
namespace Content.Server.NPC.HTN.Preconditions;
|
|
|
|
/// <summary>
|
|
/// Is the specified coordinate in range of us.
|
|
/// </summary>
|
|
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))
|
|
return false;
|
|
|
|
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
|
|
return false;
|
|
|
|
return _transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
|
}
|
|
}
|