2020-06-29 01:42:44 +10:00
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|
|
|
|
{
|
|
|
|
|
public sealed class EntityTargetSteeringRequest : IAiSteeringRequest
|
|
|
|
|
{
|
|
|
|
|
public SteeringStatus Status { get; set; } = SteeringStatus.Pending;
|
|
|
|
|
public MapCoordinates TargetMap => _target.Transform.MapPosition;
|
2020-09-06 16:11:53 +02:00
|
|
|
public EntityCoordinates TargetGrid => _target.Transform.Coordinates;
|
2020-06-29 01:42:44 +10:00
|
|
|
public IEntity Target => _target;
|
2020-11-21 14:02:00 +01:00
|
|
|
private readonly IEntity _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
|
|
|
|
2020-06-29 01:42:44 +10:00
|
|
|
public EntityTargetSteeringRequest(IEntity target, float arrivalDistance, float pathfindingProximity = 0.5f, bool requiresInRangeUnobstructed = false)
|
|
|
|
|
{
|
|
|
|
|
_target = target;
|
|
|
|
|
ArrivalDistance = arrivalDistance;
|
|
|
|
|
PathfindingProximity = pathfindingProximity;
|
|
|
|
|
RequiresInRangeUnobstructed = requiresInRangeUnobstructed;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-06 16:11:53 +02:00
|
|
|
}
|