using System.Threading; using Content.Shared.DeviceLinking; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared.Singularity.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class EmitterComponent : Component { public CancellationTokenSource? TimerCancel; // whether the power switch is in "on" [ViewVariables] public bool IsOn; // Whether the power switch is on AND the machine has enough power (so is actively firing) [ViewVariables] public bool IsPowered; /// /// counts the number of consecutive shots fired. /// [ViewVariables] public int FireShotCounter; /// /// The entity that is spawned when the emitter fires. /// [DataField, AutoNetworkedField] public EntProtoId BoltType = "EmitterBolt"; [DataField] public List SelectableTypes = new(); /// /// The current amount of power being used. /// [DataField] public int PowerUseActive = 600; /// /// The amount of shots that are fired in a single "burst" /// [DataField] public int FireBurstSize = 3; /// /// The time between each shot during a burst. /// [DataField] public TimeSpan FireInterval = TimeSpan.FromSeconds(2); /// /// The current minimum delay between bursts. /// [DataField] public TimeSpan FireBurstDelayMin = TimeSpan.FromSeconds(4); /// /// The current maximum delay between bursts. /// [DataField] public TimeSpan FireBurstDelayMax = TimeSpan.FromSeconds(10); /// /// The visual state that is set when the emitter is turned on /// [DataField] public string? OnState = "beam"; /// /// The visual state that is set when the emitter doesn't have enough power. /// [DataField] public string? UnderpoweredState = "underpowered"; /// /// Signal port that turns on the emitter. /// [DataField] public ProtoId OnPort = "On"; /// /// Signal port that turns off the emitter. /// [DataField] public ProtoId OffPort = "Off"; /// /// Signal port that toggles the emitter on or off. /// [DataField] public ProtoId TogglePort = "Toggle"; /// /// Map of signal ports to entity prototype IDs of the entity that will be fired. /// [DataField] public Dictionary, EntProtoId> SetTypePorts = new(); } [NetSerializable, Serializable] public enum EmitterVisuals : byte { VisualState } [Serializable, NetSerializable] public enum EmitterVisualLayers : byte { Lights } [NetSerializable, Serializable] public enum EmitterVisualState { On, Underpowered, Off }