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]
[Access(typeof(SharedGeigerSystem))]
public sealed class GeigerComponent : Component
{
///
/// If true it will be active only when player equipped it.
///
[DataField("attachedToSuit")]
public bool AttachedToSuit;
///
/// Is geiger counter currently active?
/// If false attached entity will ignore any radiation rays.
///
[DataField("isEnabled")]
public bool IsEnabled;
///
/// Should it shows examine message with current radiation level?
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("showExamine")]
public bool ShowExamine;
///
/// Should it shows item control when equipped by player?
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("showControl")]
public bool ShowControl;
///
/// Map of sounds that should be play on loop for different radiation levels.
///
[DataField("sounds")]
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)]
public float CurrentRadiation;
///
/// Estimated radiation danger level.
///
[ViewVariables(VVAccess.ReadOnly)]
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)]
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 IPlayingAudioStream? Stream;
}
[Serializable, NetSerializable]
public sealed class GeigerComponentState : ComponentState
{
public float CurrentRadiation;
public GeigerDangerLevel DangerLevel;
public bool IsEnabled;
public EntityUid? User;
}
[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
}