2023-07-08 14:08:32 +10:00
|
|
|
using System.Numerics;
|
|
|
|
|
|
2021-11-21 17:09:49 +11:00
|
|
|
namespace Content.Server.Shuttles.Components
|
|
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ShuttleComponent : Component
|
2021-11-21 17:09:49 +11:00
|
|
|
{
|
2022-06-16 15:28:16 +10:00
|
|
|
[ViewVariables]
|
|
|
|
|
public bool Enabled = true;
|
|
|
|
|
|
2023-04-29 18:17:31 +10:00
|
|
|
[ViewVariables]
|
|
|
|
|
public Vector2[] CenterOfThrust = new Vector2[4];
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Thrust gets multiplied by this value if it's for braking.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const float BrakeCoefficient = 1.5f;
|
|
|
|
|
|
2023-09-04 22:33:47 +03:00
|
|
|
/// <summary>
|
2025-05-16 22:04:29 +10:00
|
|
|
/// Maximum velocity.
|
2023-09-04 22:33:47 +03:00
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2025-05-16 22:04:29 +10:00
|
|
|
public float BaseMaxLinearVelocity = 60f;
|
2023-04-29 18:17:31 +10:00
|
|
|
|
2023-05-24 23:15:03 +10:00
|
|
|
public const float MaxAngularVelocity = 4f;
|
2023-04-29 18:17:31 +10:00
|
|
|
|
2021-11-21 17:09:49 +11:00
|
|
|
/// <summary>
|
2022-03-07 02:03:53 -03:00
|
|
|
/// The cached thrust available for each cardinal direction
|
2021-11-21 17:09:49 +11:00
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
2022-03-07 02:03:53 -03:00
|
|
|
public readonly float[] LinearThrust = new float[4];
|
2021-11-21 17:09:49 +11:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The thrusters contributing to each direction for impulse.
|
|
|
|
|
/// </summary>
|
2023-08-27 16:08:29 +10:00
|
|
|
// No touchy
|
|
|
|
|
public readonly List<EntityUid>[] LinearThrusters = new List<EntityUid>[]
|
|
|
|
|
{
|
|
|
|
|
new(),
|
|
|
|
|
new(),
|
|
|
|
|
new(),
|
|
|
|
|
new(),
|
|
|
|
|
};
|
2021-11-21 17:09:49 +11:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The thrusters contributing to the angular impulse of the shuttle.
|
|
|
|
|
/// </summary>
|
2023-04-21 20:04:20 +10:00
|
|
|
public readonly List<EntityUid> AngularThrusters = new();
|
2021-11-21 17:09:49 +11:00
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public float AngularThrust = 0f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A bitmask of all the directions we are considered thrusting.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public DirectionFlag ThrustDirections = DirectionFlag.None;
|
2023-08-05 02:24:24 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
2025-05-13 05:14:18 -07:00
|
|
|
/// Base damping modifier applied to the shuttle's physics component when not in FTL.
|
2023-08-05 02:24:24 -07:00
|
|
|
/// </summary>
|
2025-05-13 05:14:18 -07:00
|
|
|
[DataField]
|
|
|
|
|
public float BodyModifier = 0.25f;
|
2023-08-05 02:24:24 -07:00
|
|
|
|
2025-05-13 05:14:18 -07:00
|
|
|
/// <summary>
|
|
|
|
|
/// Final Damping Modifier for a shuttle.
|
|
|
|
|
/// This value is set to 0 during FTL. And to BodyModifier when not in FTL.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public float DampingModifier;
|
2021-11-21 17:09:49 +11:00
|
|
|
}
|
|
|
|
|
}
|