using EntityCoordinates = Robust.Shared.Map.EntityCoordinates;
namespace Content.Server._Mono.Projectiles.TargetGuided;
///
/// Component that allows a projectile to follow the cursor position in a gunnery console.
///
[RegisterComponent]
public sealed partial class TargetGuidedComponent : Component
{
///
/// How quickly the projectile can change direction in degrees per second.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public Angle? TurnRate = 120f;
///
/// How fast the projectile accelerates in m/s².
///
[DataField]
public float Acceleration = 40f;
///
/// Maximum speed the projectile can reach in m/s.
///
[DataField]
public float MaxSpeed = 20f;
///
/// Initial speed of the projectile in m/s.
///
[DataField]
public float LaunchSpeed = 8f;
///
/// Current speed of the projectile in m/s.
///
[DataField]
public float CurrentSpeed;
///
/// The target position to guide towards.
///
[DataField]
public EntityCoordinates? TargetPosition;
///
/// The console that is controlling this missile via cursor position.
///
[ViewVariables]
public EntityUid? ControllingConsole;
///
/// Maximum lifetime of the projectile in seconds.
///
[DataField]
public float MaxLifetime = 30f;
///
/// Current lifetime of the projectile.
///
[DataField]
public float CurrentLifetime;
///
/// The entity that fired this projectile.
///
[DataField]
public EntityUid? ShooterEntity;
///
/// Time since last cursor position update.
///
[DataField]
public float TimeSinceLastUpdate = 0f;
///
/// Time since the cursor position has actually moved.
///
[DataField]
public float TimeSinceLastCursorMovement = 0f;
///
/// Time in seconds before considering connection lost.
///
[DataField]
public float FallbackTime = 1.0f;
///
/// Previous position of cursor for detecting if it has moved.
///
[DataField]
public EntityCoordinates? PreviousCursorPosition;
///
/// Fixed direction the missile will maintain after losing connection.
/// This prevents stuttering by locking the direction once connection is lost.
///
[DataField]
public Angle? FixedDirection = null;
///
/// Tracks whether the missile has lost connection to its console.
///
[DataField]
public bool ConnectionLost = false;
///
/// Once set to true, the missile permanently ignores any further guidance inputs.
///
[DataField]
public bool ControlPermanentlyLost = false;
}