* Remove the unnecessary NetID property from ComponentState. * Remove Component.NetworkSynchronizeExistence. * Removed Component.NetID. * Adds component netID automatic generation. * Removed NetIdAttribute from serverside components with no corresponding clientside registration. * Completely remove static NetIds. * Renamed NetIDAttribute to NetworkedComponentAttribute. * Add GenerateNetIds calls to client and server entry points. Add test to make sure auto generated NetIds are identical. * Component changes when rebasing that I am too lazy to rewrite into the branch. Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
102 lines
2.6 KiB
C#
102 lines
2.6 KiB
C#
using System;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Atmos.Components
|
|
{
|
|
[NetworkedComponent()]
|
|
public class SharedGasAnalyzerComponent : Component
|
|
{
|
|
public override string Name => "GasAnalyzer";
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum GasAnalyzerUiKey
|
|
{
|
|
Key,
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public class GasAnalyzerBoundUserInterfaceState : BoundUserInterfaceState
|
|
{
|
|
public float Pressure;
|
|
public float Temperature;
|
|
public GasEntry[]? Gases;
|
|
public string? Error;
|
|
|
|
public GasAnalyzerBoundUserInterfaceState(float pressure, float temperature, GasEntry[]? gases, string? error = null)
|
|
{
|
|
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()
|
|
{
|
|
// e.g. "Plasma: 2000 mol"
|
|
return Loc.GetString(
|
|
"gas-entry-info",
|
|
("gasName", Name),
|
|
("gasAmount", Amount));
|
|
}
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public class GasAnalyzerRefreshMessage : BoundUserInterfaceMessage
|
|
{
|
|
public GasAnalyzerRefreshMessage() {}
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum GasAnalyzerDanger
|
|
{
|
|
Nominal,
|
|
Warning,
|
|
Hazard
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public class GasAnalyzerComponentState : ComponentState
|
|
{
|
|
public GasAnalyzerDanger Danger;
|
|
|
|
public GasAnalyzerComponentState(GasAnalyzerDanger danger)
|
|
{
|
|
Danger = danger;
|
|
}
|
|
}
|
|
}
|
|
|
|
[NetSerializable]
|
|
[Serializable]
|
|
public enum GasAnalyzerVisuals
|
|
{
|
|
VisualState,
|
|
}
|
|
|
|
[NetSerializable]
|
|
[Serializable]
|
|
public enum GasAnalyzerVisualState
|
|
{
|
|
Off,
|
|
Working,
|
|
}
|
|
}
|