2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 14:20:34 +01:00
|
|
|
using Robust.Shared.IoC;
|
2020-06-29 01:42:44 +10:00
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.AI.Steering
|
2020-06-29 01:42:44 +10:00
|
|
|
{
|
|
|
|
|
public sealed class EntityTargetSteeringRequest : IAiSteeringRequest
|
|
|
|
|
{
|
|
|
|
|
public SteeringStatus Status { get; set; } = SteeringStatus.Pending;
|
2021-12-03 15:53:09 +01:00
|
|
|
public MapCoordinates TargetMap => IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target).MapPosition;
|
|
|
|
|
public EntityCoordinates TargetGrid => IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target).Coordinates;
|
2021-12-05 18:09:01 +01:00
|
|
|
public EntityUid Target => _target;
|
|
|
|
|
private readonly EntityUid _target;
|
2020-08-22 20:03:24 +10:00
|
|
|
|
2020-06-29 01:42:44 +10:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public float ArrivalDistance { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-06-29 01:42:44 +10:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public float PathfindingProximity { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-06-29 01:42:44 +10:00
|
|
|
/// <summary>
|
2020-08-22 20:03:24 +10:00
|
|
|
/// How far the target can move before we re-path
|
2020-06-29 01:42:44 +10:00
|
|
|
/// </summary>
|
|
|
|
|
public float TargetMaxMove { get; } = 1.5f;
|
|
|
|
|
|
2020-08-22 20:03:24 +10:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public bool RequiresInRangeUnobstructed { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-06-29 01:42:44 +10:00
|
|
|
/// <summary>
|
2020-08-22 20:03:24 +10:00
|
|
|
/// To avoid spamming InRangeUnobstructed we'll apply a cd to it.
|
2020-06-29 01:42:44 +10:00
|
|
|
/// </summary>
|
2020-08-22 20:03:24 +10:00
|
|
|
public float TimeUntilInteractionCheck { get; set; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
public EntityTargetSteeringRequest(EntityUid target, float arrivalDistance, float pathfindingProximity = 0.5f, bool requiresInRangeUnobstructed = false)
|
2020-06-29 01:42:44 +10:00
|
|
|
{
|
|
|
|
|
_target = target;
|
|
|
|
|
ArrivalDistance = arrivalDistance;
|
|
|
|
|
PathfindingProximity = pathfindingProximity;
|
|
|
|
|
RequiresInRangeUnobstructed = requiresInRangeUnobstructed;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-06 16:11:53 +02:00
|
|
|
}
|