Better robotics console (#38023)

This commit is contained in:
Samuka-C
2025-08-11 15:57:39 -03:00
committed by GitHub
parent 47d7db0665
commit ed6f906e6f
6 changed files with 102 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Utility;
@@ -19,9 +19,15 @@ public sealed class RoboticsConsoleState : BoundUserInterfaceState
/// </summary>
public Dictionary<string, CyborgControlData> Cyborgs;
public RoboticsConsoleState(Dictionary<string, CyborgControlData> cyborgs)
/// <summary>
/// If the UI will have the buttons to disable and destroy.
/// </summary>
public bool AllowBorgControl;
public RoboticsConsoleState(Dictionary<string, CyborgControlData> cyborgs, bool allowBorgControl)
{
Cyborgs = cyborgs;
AllowBorgControl = allowBorgControl;
}
}
@@ -84,6 +90,12 @@ public partial record struct CyborgControlData
[DataField]
public float Charge;
/// <summary>
/// HP level from 0 to 1.
/// </summary>
[DataField]
public float HpPercent; // 0.0 to 1.0
/// <summary>
/// How many modules this borg has, just useful information for roboticists.
/// Lets them keep track of the latejoin borgs that need new modules and stuff.
@@ -111,12 +123,13 @@ public partial record struct CyborgControlData
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan Timeout = TimeSpan.Zero;
public CyborgControlData(SpriteSpecifier? chassisSprite, string chassisName, string name, float charge, int moduleCount, bool hasBrain, bool canDisable)
public CyborgControlData(SpriteSpecifier? chassisSprite, string chassisName, string name, float charge, float hpPercent, int moduleCount, bool hasBrain, bool canDisable)
{
ChassisSprite = chassisSprite;
ChassisName = chassisName;
Name = name;
Charge = charge;
HpPercent = hpPercent;
ModuleCount = moduleCount;
HasBrain = hasBrain;
CanDisable = canDisable;