* Construct and upgrade mini gravity generator Now the mini gravity generator can be assembled/disassembled, the necessary machine board has been added to ShuttleCraft technology. Now it is possible to destroy the mini gravity generator and improve its components, thereby increasing the maximum charge of the generator. * Test with empty OnRefreshParts Perhaps this will help to get rid of the error during the test... * Revert "Test with empty OnRefreshParts" This reverts commit 5f32e15d66a4cb0d8df7578593867062be7872d8. * Test without OnRefreshParts Let's check if the problem is multiple inheritance. * Revert "Test without OnRefreshParts" This reverts commit d319757aa15a8ebec1237e552213e80eb8042790. * Enabled by default Maybe this will solve the problem, and maybe not... * Swapped the components ApcPowerReciver and GravityGenerator The previous "solution" did not give results, perhaps this time it will work.... * Revert "Swapped the components ApcPowerReciver and GravityGenerator" This reverts commit 38759ca5a3465908b97d1d7e6ca583f8e9a97afb. * Brought everything back to the beginning * One parent in generator prototype, test * Revert "One parent in generator prototype, test" This reverts commit f7275b5d53234d9f66e8b4df0692596e14d82c95. * Test without switchedOn and charge * Revert "Test without switchedOn and charge" This reverts commit 3916de8cc68e488098e6adc1e6b13e00d3f0e1a1. * Revert "Revert "Test without switchedOn and charge"" This reverts commit 3d95efbfd4cb358b5c04a2302a377d51eb5f34cc. * Update Resources/Prototypes/Entities/Structures/Machines/gravity_generator.yml --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
53 lines
2.1 KiB
C#
53 lines
2.1 KiB
C#
using Content.Shared.Gravity;
|
|
using Content.Shared.Construction.Prototypes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
namespace Content.Server.Gravity
|
|
{
|
|
[RegisterComponent]
|
|
[Access(typeof(GravityGeneratorSystem))]
|
|
public sealed class GravityGeneratorComponent : SharedGravityGeneratorComponent
|
|
{
|
|
// 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; }
|
|
|
|
|
|
/// <summary>
|
|
/// Is the power switch on?
|
|
/// </summary>
|
|
[DataField("switchedOn")]
|
|
public bool SwitchedOn { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Is the gravity generator intact?
|
|
/// </summary>
|
|
[DataField("intact")]
|
|
public bool Intact { get; set; } = true;
|
|
|
|
[DataField("maxCharge")]
|
|
public float MaxCharge { get; set; } = 1;
|
|
|
|
// 0 -> 1
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("charge")] public float Charge { get; set; } = 1;
|
|
|
|
[DataField("machinePartMaxChargeMultiplier", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
|
|
public string MachinePartMaxChargeMultiplier = "Capacitor";
|
|
|
|
/// <summary>
|
|
/// Is the gravity generator currently "producing" gravity?
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool GravityActive { get; set; } = false;
|
|
|
|
// Do we need a UI update even if the charge doesn't change? Used by power button.
|
|
[ViewVariables] public bool NeedUIUpdate { get; set; }
|
|
}
|
|
}
|