2021-02-22 00:07:46 +00:00
|
|
|
using System;
|
2020-08-13 14:40:27 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-08-08 18:24:41 +02:00
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
2021-06-19 13:25:05 +02:00
|
|
|
namespace Content.Shared.Atmos.Components
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2022-02-16 00:23:23 -07:00
|
|
|
public abstract class SharedGasAnalyzerComponent : Component
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum GasAnalyzerUiKey
|
|
|
|
|
{
|
|
|
|
|
Key,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class GasAnalyzerBoundUserInterfaceState : BoundUserInterfaceState
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
public float Pressure;
|
|
|
|
|
public float Temperature;
|
2021-03-15 21:55:49 +01:00
|
|
|
public GasEntry[]? Gases;
|
|
|
|
|
public string? Error;
|
2020-08-08 18:24:41 +02:00
|
|
|
|
2021-03-15 21:55:49 +01:00
|
|
|
public GasAnalyzerBoundUserInterfaceState(float pressure, float temperature, GasEntry[]? gases, string? error = null)
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
Pressure = pressure;
|
|
|
|
|
Temperature = temperature;
|
|
|
|
|
Gases = gases;
|
|
|
|
|
Error = error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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()
|
|
|
|
|
{
|
2021-02-22 00:07:46 +00:00
|
|
|
// e.g. "Plasma: 2000 mol"
|
|
|
|
|
return Loc.GetString(
|
|
|
|
|
"gas-entry-info",
|
|
|
|
|
("gasName", Name),
|
|
|
|
|
("gasAmount", Amount));
|
2020-08-08 18:24:41 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class GasAnalyzerRefreshMessage : BoundUserInterfaceMessage
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
public GasAnalyzerRefreshMessage() {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum GasAnalyzerDanger
|
|
|
|
|
{
|
|
|
|
|
Nominal,
|
|
|
|
|
Warning,
|
|
|
|
|
Hazard
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class GasAnalyzerComponentState : ComponentState
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
public GasAnalyzerDanger Danger;
|
|
|
|
|
|
2021-07-12 01:32:10 -07:00
|
|
|
public GasAnalyzerComponentState(GasAnalyzerDanger danger)
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
|
|
|
|
Danger = danger;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-19 13:25:05 +02:00
|
|
|
|
|
|
|
|
[NetSerializable]
|
|
|
|
|
[Serializable]
|
|
|
|
|
public enum GasAnalyzerVisuals
|
|
|
|
|
{
|
|
|
|
|
VisualState,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetSerializable]
|
|
|
|
|
[Serializable]
|
|
|
|
|
public enum GasAnalyzerVisualState
|
|
|
|
|
{
|
|
|
|
|
Off,
|
|
|
|
|
Working,
|
|
|
|
|
}
|
2020-08-08 18:24:41 +02:00
|
|
|
}
|