malf killer 9000 (robotics console) (#24855)

* create devicenet frequencies

* create borg transponder and give it to all nt borgs

* add robotics console

* actually implement battery charge display + some fix

* tab

* real explosion

* little safer

* disable destroy button clientside too when on cooldown

* m

* how do i do this when i review things...

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* webedit ops

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>

* ui updates

* oracle java

* do a thing

* update ui when a borg times out

* maybe fix test

* add IsLocked to LockSystem

* make destroying gib the chassis again, so emagging isnt sus

* use locking

* require using alt click to unlock so normal click is open ui

* the

* use LogType.Action

* take this L

* pocket lint?

* sharer

* pro ops

* robor pushmarkup

* m

* update and make it not use prototype anymore

* frame0

* update yaml

* untroll

* bad

* h

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
deltanedas
2024-05-09 06:36:07 +00:00
committed by GitHub
parent 24ab5c0982
commit b33730db22
21 changed files with 891 additions and 4 deletions

View File

@@ -0,0 +1,126 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Utility;
namespace Content.Shared.Robotics;
[Serializable, NetSerializable]
public enum RoboticsConsoleUiKey : byte
{
Key
}
[Serializable, NetSerializable]
public sealed class RoboticsConsoleState : BoundUserInterfaceState
{
/// <summary>
/// Map of device network addresses to cyborg data.
/// </summary>
public Dictionary<string, CyborgControlData> Cyborgs;
public RoboticsConsoleState(Dictionary<string, CyborgControlData> cyborgs)
{
Cyborgs = cyborgs;
}
}
/// <summary>
/// Message to disable the selected cyborg.
/// </summary>
[Serializable, NetSerializable]
public sealed class RoboticsConsoleDisableMessage : BoundUserInterfaceMessage
{
public readonly string Address;
public RoboticsConsoleDisableMessage(string address)
{
Address = address;
}
}
/// <summary>
/// Message to destroy the selected cyborg.
/// </summary>
[Serializable, NetSerializable]
public sealed class RoboticsConsoleDestroyMessage : BoundUserInterfaceMessage
{
public readonly string Address;
public RoboticsConsoleDestroyMessage(string address)
{
Address = address;
}
}
/// <summary>
/// All data a client needs to render the console UI for a single cyborg.
/// Created by <c>BorgTransponderComponent</c> and sent to clients by <c>RoboticsConsoleComponent</c>.
/// </summary>
[DataRecord, Serializable, NetSerializable]
public record struct CyborgControlData
{
/// <summary>
/// Texture of the borg chassis.
/// </summary>
[DataField(required: true)]
public SpriteSpecifier? ChassisSprite;
/// <summary>
/// Name of the borg chassis.
/// </summary>
[DataField(required: true)]
public string ChassisName = string.Empty;
/// <summary>
/// Name of the borg's entity, including its silicon id.
/// </summary>
[DataField(required: true)]
public string Name = string.Empty;
/// <summary>
/// Battery charge from 0 to 1.
/// </summary>
[DataField]
public float Charge;
/// <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.
/// </summary>
[DataField]
public int ModuleCount;
/// <summary>
/// Whether the borg has a brain installed or not.
/// </summary>
[DataField]
public bool HasBrain;
/// <summary>
/// When this cyborg's data will be deleted.
/// Set by the console when receiving the packet.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan Timeout = TimeSpan.Zero;
public CyborgControlData(SpriteSpecifier? chassisSprite, string chassisName, string name, float charge, int moduleCount, bool hasBrain)
{
ChassisSprite = chassisSprite;
ChassisName = chassisName;
Name = name;
Charge = charge;
ModuleCount = moduleCount;
HasBrain = hasBrain;
}
}
public static class RoboticsConsoleConstants
{
// broadcast by cyborgs on Robotics Console frequency
public const string NET_CYBORG_DATA = "cyborg-data";
// sent by robotics console to cyborgs on Cyborg Control frequency
public const string NET_DISABLE_COMMAND = "cyborg-disable";
public const string NET_DESTROY_COMMAND = "cyborg-destroy";
}