| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using Robust.Shared.GameStates;
- using Robust.Shared.Map;
- using Robust.Shared.Serialization;
- namespace Content.Shared.Atmos.Components;
- [RegisterComponent, NetworkedComponent]
- public sealed partial class GasAnalyzerComponent : Component
- {
- [ViewVariables]
- public EntityUid? Target;
- [ViewVariables]
- public EntityUid User;
- [DataField("enabled"), ViewVariables(VVAccess.ReadWrite)]
- public bool Enabled;
- [Serializable, NetSerializable]
- public enum GasAnalyzerUiKey
- {
- Key,
- }
- /// <summary>
- /// Atmospheric data is gathered in the system and sent to the user
- /// </summary>
- [Serializable, NetSerializable]
- public sealed class GasAnalyzerUserMessage : BoundUserInterfaceMessage
- {
- public string DeviceName;
- public NetEntity DeviceUid;
- public bool DeviceFlipped;
- public string? Error;
- public GasMixEntry[] NodeGasMixes;
- public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, NetEntity deviceUid, bool deviceFlipped, string? error = null)
- {
- NodeGasMixes = nodeGasMixes;
- DeviceName = deviceName;
- DeviceUid = deviceUid;
- DeviceFlipped = deviceFlipped;
- Error = error;
- }
- }
- /// <summary>
- /// Contains information on a gas mix entry, turns into a tab in the UI
- /// </summary>
- [Serializable, NetSerializable]
- public struct GasMixEntry
- {
- /// <summary>
- /// Name of the tab in the UI
- /// </summary>
- public readonly string Name;
- public readonly float Volume;
- public readonly float Pressure;
- public readonly float Temperature;
- public readonly GasEntry[]? Gases;
- public GasMixEntry(string name, float volume, float pressure, float temperature, GasEntry[]? gases = null)
- {
- Name = name;
- Volume = volume;
- Pressure = pressure;
- Temperature = temperature;
- Gases = gases;
- }
- }
- /// <summary>
- /// Individual gas entry data for populating the UI
- /// </summary>
- [Serializable, NetSerializable]
- public struct GasEntry
- {
- public readonly string Name;
- public readonly float Amount;
- public readonly string Color;
- public GasEntry(string name, float amount, string color)
- {
- Name = name;
- Amount = amount;
- Color = color;
- }
- public override string ToString()
- {
- // e.g. "Plasma: 2000 mol"
- return Loc.GetString(
- "gas-entry-info",
- ("gasName", Name),
- ("gasAmount", Amount));
- }
- }
- [Serializable, NetSerializable]
- public sealed class GasAnalyzerDisableMessage : BoundUserInterfaceMessage
- {
- }
- }
- [Serializable, NetSerializable]
- public enum GasAnalyzerVisuals : byte
- {
- Enabled,
- }
|