2021-11-02 01:12:55 +01:00
|
|
|
|
using Content.Server.Gravity.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Gravity;
|
2021-11-02 01:12:55 +01:00
|
|
|
|
using Robust.Shared.Analyzers;
|
2020-05-02 15:02:52 +01:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-08-24 20:47:17 +02:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2020-05-02 15:02:52 +01:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Gravity
|
2020-05-02 15:02:52 +01:00
|
|
|
|
{
|
|
|
|
|
|
[RegisterComponent]
|
2021-11-02 01:12:55 +01:00
|
|
|
|
[Friend(typeof(GravityGeneratorSystem))]
|
|
|
|
|
|
public sealed class GravityGeneratorComponent : SharedGravityGeneratorComponent
|
2020-05-02 15:02:52 +01:00
|
|
|
|
{
|
2021-11-02 01:12:55 +01:00
|
|
|
|
// 1% charge per second.
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("chargeRate")] public float ChargeRate { get; set; } = 0.01f;
|
|
|
|
|
|
// The gravity generator has two power values.
|
|
|
|
|
|
// Idle power is assumed to be the power needed to run the control systems and interface.
|
|
|
|
|
|
[DataField("idlePower")] public float IdlePowerUse { get; set; }
|
|
|
|
|
|
// Active power is the power needed to keep the gravity field stable.
|
|
|
|
|
|
[DataField("activePower")] public float ActivePowerUse { get; set; }
|
|
|
|
|
|
[DataField("lightRadiusMin")] public float LightRadiusMin { get; set; }
|
|
|
|
|
|
[DataField("lightRadiusMax")] public float LightRadiusMax { get; set; }
|
2020-05-02 15:02:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Is the power switch on?
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("switchedOn")]
|
|
|
|
|
|
public bool SwitchedOn { get; set; } = true;
|
2020-05-02 15:02:52 +01:00
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Is the gravity generator intact?
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("intact")]
|
|
|
|
|
|
public bool Intact { get; set; } = true;
|
2020-08-22 22:29:20 +02:00
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
|
// 0 -> 1
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("charge")] public float Charge { get; set; } = 1;
|
2021-06-27 07:43:39 +02:00
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Is the gravity generator currently "producing" gravity?
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("active")]
|
|
|
|
|
|
public bool GravityActive { get; set; } = true;
|
2021-06-27 07:43:39 +02:00
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
|
// Do we need a UI update even if the charge doesn't change? Used by power button.
|
|
|
|
|
|
[ViewVariables] public bool NeedUIUpdate { get; set; }
|
|
|
|
|
|
[ViewVariables] public bool NeedGravityUpdate { get; set; }
|
2021-06-27 07:43:39 +02:00
|
|
|
|
}
|
2020-05-02 15:02:52 +01:00
|
|
|
|
}
|