using Content.Server.Shuttles.EntitySystems;
using Content.Shared.Damage;
namespace Content.Server.Shuttles.Components
{
[RegisterComponent]
[Friend(typeof(ThrusterSystem))]
public sealed class ThrusterComponent : Component
{
///
/// Whether the thruster has been force to be enabled / disabled (e.g. VV, interaction, etc.)
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]
public bool Enabled
{
get => _enabled;
set
{
if (_enabled == value) return;
_enabled = value;
var system = EntitySystem.Get();
if (!_enabled)
{
system.DisableThruster(Owner, this);
}
else if (system.CanEnable(Owner, this))
{
system.EnableThruster(Owner, this);
}
}
}
private bool _enabled = true;
///
/// This determines whether the thruster is actually enabled for the purposes of thrust
///
public bool IsOn;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("thrust")]
public float Thrust = 750f;
[ViewVariables]
[DataField("thrusterType")]
public ThrusterType Type = ThrusterType.Linear;
[DataField("burnShape")] public List BurnPoly = new()
{
new Vector2(-0.4f, 0.5f),
new Vector2(-0.1f, 1.2f),
new Vector2(0.1f, 1.2f),
new Vector2(0.4f, 0.5f)
};
///
/// How much damage is done per second to anything colliding with our thrust.
///
[ViewVariables] [DataField("damage")] public DamageSpecifier? Damage = new();
[ViewVariables] [DataField("requireSpace")]
public bool RequireSpace = true;
// Used for burns
public List Colliding = new();
public bool Firing = false;
}
public enum ThrusterType
{
Linear,
// Angular meaning rotational.
Angular,
}
}