using Content.Shared.Atmos.Consoles; using Content.Shared.Atmos.Monitor; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Serialization; namespace Content.Shared.Atmos.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(SharedAtmosAlertsComputerSystem))] public sealed partial class AtmosAlertsComputerComponent : Component { /// /// The current entity of interest (selected via the console UI) /// [ViewVariables] public NetEntity? FocusDevice; /// /// A list of all the atmos devices that will be used to populate the nav map /// [ViewVariables, AutoNetworkedField] public HashSet AtmosDevices = new(); /// /// A list of all the air alarms that have had their alerts silenced on this particular console /// [ViewVariables, AutoNetworkedField] public HashSet SilencedDevices = new(); } [Serializable, NetSerializable] public struct AtmosAlertsDeviceNavMapData { /// /// The entity in question /// public NetEntity NetEntity; /// /// Location of the entity /// public NetCoordinates NetCoordinates; /// /// Used to determine what map icons to use /// public AtmosAlertsComputerGroup Group; /// /// Populate the atmos monitoring console nav map with a single entity /// public AtmosAlertsDeviceNavMapData(NetEntity netEntity, NetCoordinates netCoordinates, AtmosAlertsComputerGroup group) { NetEntity = netEntity; NetCoordinates = netCoordinates; Group = group; } } [Serializable, NetSerializable] public struct AtmosAlertsFocusDeviceData { /// /// Focus entity /// public NetEntity NetEntity; /// /// Temperature (K) and related alert state /// public (float, AtmosAlarmType) TemperatureData; /// /// Pressure (kPA) and related alert state /// public (float, AtmosAlarmType) PressureData; /// /// Moles, percentage, and related alert state, for all detected gases /// public Dictionary GasData; /// /// Populates the atmos monitoring console focus entry with atmospheric data /// public AtmosAlertsFocusDeviceData (NetEntity netEntity, (float, AtmosAlarmType) temperatureData, (float, AtmosAlarmType) pressureData, Dictionary gasData) { NetEntity = netEntity; TemperatureData = temperatureData; PressureData = pressureData; GasData = gasData; } } [Serializable, NetSerializable] public sealed class AtmosAlertsComputerBoundInterfaceState : BoundUserInterfaceState { /// /// A list of all air alarms /// public AtmosAlertsComputerEntry[] AirAlarms; /// /// A list of all fire alarms /// public AtmosAlertsComputerEntry[] FireAlarms; /// /// Data for the UI focus (if applicable) /// public AtmosAlertsFocusDeviceData? FocusData; /// /// Sends data from the server to the client to populate the atmos monitoring console UI /// public AtmosAlertsComputerBoundInterfaceState(AtmosAlertsComputerEntry[] airAlarms, AtmosAlertsComputerEntry[] fireAlarms, AtmosAlertsFocusDeviceData? focusData) { AirAlarms = airAlarms; FireAlarms = fireAlarms; FocusData = focusData; } } [Serializable, NetSerializable] public struct AtmosAlertsComputerEntry { /// /// The entity in question /// public NetEntity NetEntity; /// /// Location of the entity /// public NetCoordinates Coordinates; /// /// The type of entity /// public AtmosAlertsComputerGroup Group; /// /// Current alarm state /// public AtmosAlarmType AlarmState; /// /// Localised device name /// public string EntityName; /// /// Device network address /// public string Address; /// /// Used to populate the atmos monitoring console UI with data from a single air alarm /// public AtmosAlertsComputerEntry (NetEntity entity, NetCoordinates coordinates, AtmosAlertsComputerGroup group, AtmosAlarmType alarmState, string entityName, string address) { NetEntity = entity; Coordinates = coordinates; Group = group; AlarmState = alarmState; EntityName = entityName; Address = address; } } [Serializable, NetSerializable] public sealed class AtmosAlertsComputerFocusChangeMessage : BoundUserInterfaceMessage { public NetEntity? FocusDevice; /// /// Used to inform the server that the specified focus for the atmos monitoring console has been changed by the client /// public AtmosAlertsComputerFocusChangeMessage(NetEntity? focusDevice) { FocusDevice = focusDevice; } } [Serializable, NetSerializable] public sealed class AtmosAlertsComputerDeviceSilencedMessage : BoundUserInterfaceMessage { public NetEntity AtmosDevice; public bool SilenceDevice = true; /// /// Used to inform the server that the client has silenced alerts from the specified device to this atmos monitoring console /// public AtmosAlertsComputerDeviceSilencedMessage(NetEntity atmosDevice, bool silenceDevice = true) { AtmosDevice = atmosDevice; SilenceDevice = silenceDevice; } } /// /// List of all the different atmos device groups /// public enum AtmosAlertsComputerGroup { Invalid, AirAlarm, FireAlarm, } [NetSerializable, Serializable] public enum AtmosAlertsComputerVisuals { ComputerLayerScreen, } /// /// UI key associated with the atmos monitoring console /// [Serializable, NetSerializable] public enum AtmosAlertsComputerUiKey { Key }