using System.Threading; using Content.Shared.DeviceLinking; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; namespace Content.Shared.Singularity.Components; [RegisterComponent, NetworkedComponent] 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("boltType", customTypeSerializer: typeof(PrototypeIdSerializer))] public string BoltType = "EmitterBolt"; [DataField("selectableTypes", customTypeSerializer: typeof(PrototypeIdListSerializer))] public List SelectableTypes = new(); /// /// The current amount of power being used. /// [DataField("powerUseActive")] public int PowerUseActive = 600; /// /// The amount of shots that are fired in a single "burst" /// [DataField("fireBurstSize")] public int FireBurstSize = 3; /// /// The time between each shot during a burst. /// [DataField("fireInterval")] public TimeSpan FireInterval = TimeSpan.FromSeconds(2); /// /// The current minimum delay between bursts. /// [DataField("fireBurstDelayMin")] public TimeSpan FireBurstDelayMin = TimeSpan.FromSeconds(4); /// /// The current maximum delay between bursts. /// [DataField("fireBurstDelayMax")] public TimeSpan FireBurstDelayMax = TimeSpan.FromSeconds(10); /// /// The visual state that is set when the emitter is turned on /// [DataField("onState")] public string? OnState = "beam"; /// /// The visual state that is set when the emitter doesn't have enough power. /// [DataField("underpoweredState")] public string? UnderpoweredState = "underpowered"; /// /// Signal port that turns on the emitter. /// [DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer))] public string OnPort = "On"; /// /// Signal port that turns off the emitter. /// [DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer))] public string OffPort = "Off"; /// /// Signal port that toggles the emitter on or off. /// [DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer))] public string TogglePort = "Toggle"; /// /// Map of signal ports to entity prototype IDs of the entity that will be fired. /// [DataField("setTypePorts", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public Dictionary SetTypePorts = new(); } [NetSerializable, Serializable] public enum EmitterVisuals : byte { VisualState } [Serializable, NetSerializable] public enum EmitterVisualLayers : byte { Lights } [NetSerializable, Serializable] public enum EmitterVisualState { On, Underpowered, Off }