using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Atmos.Components;
///
/// Used for gas analyzers, an item that shows players the gas contents of an atmos
/// device they use it on or of the tile they are standing on.
///
[RegisterComponent, NetworkedComponent]
public sealed partial class GasAnalyzerComponent : Component
{
///
/// The target entity currently being analyzed.
///
[DataField]
public EntityUid? Target;
///
/// The current user of the gas analyzer.
///
[DataField]
public EntityUid? User;
///
/// Is the analyzer currently active?
///
[DataField]
public bool Enabled;
}
///
/// Atmospheric data is gathered in the system and sent to the user.
///
[Serializable, NetSerializable]
public sealed class GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, NetEntity deviceUid, bool deviceFlipped) : BoundUserInterfaceMessage
{
public string DeviceName = deviceName;
public NetEntity DeviceUid = deviceUid;
public bool DeviceFlipped = deviceFlipped;
public GasMixEntry[] NodeGasMixes = nodeGasMixes;
}
///
/// Contains information on a gas mix entry, turns into a tab in the UI.
///
[Serializable, NetSerializable]
public readonly record struct GasMixEntry(string Name, float Volume, float Pressure, float Temperature, GasEntry[]? Gases = null)
{
///
/// Name of the tab in the UI.
///
public readonly string Name = Name;
///
/// Volume of this gas mixture.
///
public readonly float Volume = Volume;
///
/// Pressure of this gas mixture.
///
public readonly float Pressure = Pressure;
///
/// Temperature of this gas mixture.
///
public readonly float Temperature = Temperature;
///
/// The gases contained in this gas mixture.
/// The gases below a certain mol threshold are not included.
///
public readonly GasEntry[]? Gases = Gases;
}
///
/// Individual gas entry data for populating the UI.
///
[Serializable, NetSerializable]
public readonly record struct GasEntry(Gas Gas, float Amount)
{
///
/// The gas this entry represents.
///
public readonly Gas Gas = Gas;
///
/// The gas amount in mol.
///
public readonly float Amount = Amount;
}
///
/// Key for the GasAnalyzerBoundUserInterface.
///
[Serializable, NetSerializable]
public enum GasAnalyzerUiKey
{
Key,
}
///
/// Individual gas entry data for populating the UI
///
[Serializable, NetSerializable]
public enum GasAnalyzerVisuals : byte
{
Enabled,
}