2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-08-08 18:24:41 +02:00
|
|
|
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
|
|
|
{
|
2022-09-08 14:22:14 +00:00
|
|
|
|
2020-08-08 18:24:41 +02:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum GasAnalyzerUiKey
|
|
|
|
|
{
|
|
|
|
|
Key,
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 14:22:14 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Atmospheric data is gathered in the system and sent to the user
|
|
|
|
|
/// </summary>
|
2020-08-08 18:24:41 +02:00
|
|
|
[Serializable, NetSerializable]
|
2022-09-08 14:22:14 +00:00
|
|
|
public sealed class GasAnalyzerUserMessage : BoundUserInterfaceMessage
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
2022-09-08 14:22:14 +00:00
|
|
|
public string DeviceName;
|
|
|
|
|
public EntityUid DeviceUid;
|
|
|
|
|
public bool DeviceFlipped;
|
2021-03-15 21:55:49 +01:00
|
|
|
public string? Error;
|
2022-09-08 14:22:14 +00:00
|
|
|
public GasMixEntry[] NodeGasMixes;
|
|
|
|
|
public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, EntityUid deviceUid, bool deviceFlipped, string? error = null)
|
|
|
|
|
{
|
|
|
|
|
NodeGasMixes = nodeGasMixes;
|
|
|
|
|
DeviceName = deviceName;
|
|
|
|
|
DeviceUid = deviceUid;
|
|
|
|
|
DeviceFlipped = deviceFlipped;
|
|
|
|
|
Error = error;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-08 18:24:41 +02:00
|
|
|
|
2022-09-08 14:22:14 +00:00
|
|
|
/// <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 Pressure;
|
|
|
|
|
public readonly float Temperature;
|
|
|
|
|
public readonly GasEntry[]? Gases;
|
|
|
|
|
|
|
|
|
|
public GasMixEntry(string name, float pressure, float temperature, GasEntry[]? gases = null)
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
2022-09-08 14:22:14 +00:00
|
|
|
Name = name;
|
2020-08-08 18:24:41 +02:00
|
|
|
Pressure = pressure;
|
|
|
|
|
Temperature = temperature;
|
|
|
|
|
Gases = gases;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 14:22:14 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Individual gas entry data for populating the UI
|
|
|
|
|
/// </summary>
|
2020-08-08 18:24:41 +02:00
|
|
|
[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-09-08 14:22:14 +00:00
|
|
|
public sealed class GasAnalyzerDisableMessage : BoundUserInterfaceMessage
|
2020-08-08 18:24:41 +02:00
|
|
|
{
|
2022-09-08 14:22:14 +00:00
|
|
|
public GasAnalyzerDisableMessage() {}
|
2020-08-08 18:24:41 +02:00
|
|
|
}
|
2021-06-19 13:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-08 14:22:14 +00:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum GasAnalyzerVisuals : byte
|
2021-06-19 13:25:05 +02:00
|
|
|
{
|
2022-09-08 14:22:14 +00:00
|
|
|
Enabled,
|
2021-06-19 13:25:05 +02:00
|
|
|
}
|
2020-08-08 18:24:41 +02:00
|
|
|
}
|