using Content.Shared.Radiation.Systems; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Radiation.Components; /// /// Geiger counter that shows current radiation level. /// Can be added as a component to clothes. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] [Access(typeof(SharedGeigerSystem))] public sealed partial class GeigerComponent : Component { /// /// If true it will be active only when player equipped it. /// [DataField] public bool AttachedToSuit; /// /// Is geiger counter currently active? /// If false attached entity will ignore any radiation rays. /// [DataField, AutoNetworkedField] public bool IsEnabled; /// /// Should it shows examine message with current radiation level? /// [ViewVariables(VVAccess.ReadWrite)] [DataField] public bool ShowExamine; /// /// Should it shows item control when equipped by player? /// [ViewVariables(VVAccess.ReadWrite)] [DataField] public bool ShowControl; /// /// Map of sounds that should be play on loop for different radiation levels. /// [DataField] public Dictionary Sounds = new() { {GeigerDangerLevel.Low, new SoundPathSpecifier("/Audio/Items/Geiger/low.ogg")}, {GeigerDangerLevel.Med, new SoundPathSpecifier("/Audio/Items/Geiger/med.ogg")}, {GeigerDangerLevel.High, new SoundPathSpecifier("/Audio/Items/Geiger/high.ogg")}, {GeigerDangerLevel.Extreme, new SoundPathSpecifier("/Audio/Items/Geiger/ext.ogg")} }; /// /// Current radiation level in rad per second. /// [ViewVariables(VVAccess.ReadOnly), AutoNetworkedField] public float CurrentRadiation; /// /// Estimated radiation danger level. /// [ViewVariables(VVAccess.ReadOnly), AutoNetworkedField] public GeigerDangerLevel DangerLevel = GeigerDangerLevel.None; /// /// Current player that equipped geiger counter. /// Because sound is annoying, geiger counter clicks will play /// only for player that equipped it. /// [ViewVariables(VVAccess.ReadOnly), AutoNetworkedField] public EntityUid? User; /// /// Marked true if control needs to update UI with latest component state. /// [Access(typeof(SharedGeigerSystem), Other = AccessPermissions.ReadWrite)] public bool UiUpdateNeeded; /// /// Current stream of geiger counter audio. /// Played only for current user. /// public EntityUid? Stream; /// /// Mark true if the audio should be heard by everyone around the device /// [DataField] public bool BroadcastAudio = false; /// /// The distance within which the broadcast tone can be heard. /// [DataField] public float BroadcastRange = 4f; /// /// The volume of the warning tone. /// [DataField] public float Volume = -4f; } [Serializable, NetSerializable] public enum GeigerDangerLevel : byte { None, Low, Med, High, Extreme } [Serializable, NetSerializable] public enum GeigerLayers : byte { Screen } [Serializable, NetSerializable] public enum GeigerVisuals : byte { DangerLevel, IsEnabled }