using Content.Server.ParticleAccelerator.Wires; using Content.Shared.Singularity.Components; namespace Content.Server.ParticleAccelerator.Components; // This component is in control of the PA's logic because it's the one to contain the wires for hacking. // And also it's the only PA component that meaningfully needs to work on its own. /// /// Is the computer thing people interact with to control the PA. /// Also contains primary logic for actual PA behavior, part scanning, etc... /// [RegisterComponent] public sealed class ParticleAcceleratorControlBoxComponent : Component { /// /// Whether the PA parts have been correctly arranged to make a functional device. /// [ViewVariables] public bool Assembled = false; /// /// Whether the PA is currently set to fire at the console. /// Requires to be true. /// [ViewVariables] public bool Enabled = false; /// /// Whether the PA actually has the power necessary to fire. /// Requires to be true. /// [ViewVariables] public bool Powered = false; /// /// Whether the PA is currently firing or charging to fire. /// Requires to be true. /// [ViewVariables] public bool Firing = false; /// /// Whether the PA is currently firing or charging to fire. /// Bounded by and . /// Modified by . /// [ViewVariables(VVAccess.ReadWrite)] public ParticleAcceleratorPowerState SelectedStrength = ParticleAcceleratorPowerState.Standby; /// /// The maximum strength level this particle accelerator can be set to operate at. /// Modified by . /// [ViewVariables] public ParticleAcceleratorPowerState MaxStrength = ParticleAcceleratorPowerState.Level2; /// /// The power supply unit of the assembled particle accelerator. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? PowerBox; /// /// Whether the PA is currently firing or charging to fire. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? EndCap; /// /// Whether the PA is currently firing or charging to fire. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? FuelChamber; /// /// Whether the PA is currently firing or charging to fire. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? PortEmitter; /// /// Whether the PA is currently firing or charging to fire. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? ForeEmitter; /// /// Whether the PA is currently firing or charging to fire. /// Implies the existance of a attached to this entity. /// [ViewVariables] public EntityUid? StarboardEmitter; /// /// The amount of power the particle accelerator must be provided with relative to the expected power draw to function. /// [ViewVariables] public const float RequiredPowerRatio = 0.999f; /// /// The amount of power (in watts) the PA draws just by existing as a functional machine. /// [DataField("powerDrawBase")] [ViewVariables(VVAccess.ReadWrite)] public int BasePowerDraw = 500; /// /// The amount of power (in watts) the PA draws per level when turned on. /// [DataField("powerDrawMult")] [ViewVariables(VVAccess.ReadWrite)] public int LevelPowerDraw = 1500; /// /// The time at which the PA last fired a wave of particles. /// [DataField("lastFire")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan LastFire; /// /// The time at which the PA will next fire a wave of particles. /// [DataField("nextFire")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextFire; /// /// Delay between consecutive PA shots. /// // Fun fact: // On /vg/station (can't check TG because lol they removed singulo), // the PA emitter parts have var/fire_delay = 50. // For anybody from the future not BYOND-initiated, that's 5 seconds. // However, /obj/machinery/particle_accelerator/control_box/process(), // which calls emit_particle() on the emitters, // only gets called every *2* seconds, because of CarnMC timing. // So the *actual* effective firing delay of the PA is 6 seconds, not 5 as listed in the code. // So... // I have reflected that here to be authentic. [DataField("chargeTime")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan ChargeTime = TimeSpan.FromSeconds(6.0); /// /// Whether the interface has been disabled via a cut wire or not. /// Modified by . /// [ViewVariables] public bool InterfaceDisabled = false; /// /// Whether the ability to change the strength of the PA has been disabled via a cut wire or not. /// Modified by . /// [ViewVariables] public bool StrengthLocked = false; /// /// Whether the PA can be turned on. /// Modified by . /// [ViewVariables] public bool CanBeEnabled = true; }