Files
wwdpublic/Content.Shared/Robotics/RoboticsConsoleUi.cs
Kai5 b86ec297b2 [Port Feature] И снова ИИ кукловод (#567)
* B.O.R.I.S ai remote control brain (#380)

* ai remote brain

* system fixes, code formatting

* fixes

(cherry picked from commit 1fc1d81e74254df82b48e57af272a0abaf795843)

* B.O.R.I.S ai remote control brain (#380)

* ai remote brain

* system fixes, code formatting

* fixes

(cherry picked from commit 1fc1d81e74254df82b48e57af272a0abaf795843)

* Фикс локализации

* Фикс локализации 2

* Update Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/Robotics/RoboticsConsoleUi.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/_CorvaxNext/Silicons/Borgs/Components/AiRemoteBrainComponent.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/Robotics/RoboticsConsoleUi.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/Robotics/RoboticsConsoleUi.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Update Content.Shared/_CorvaxNext/Silicons/Borgs/Components/SharedAiRemoteControllerComponent.cs

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>

* Да

* Теперь должно работать

* Окончательный перенос всякого

* неймспейсы

* Some fix

* fix locale

* blya

---------

Co-authored-by: KillanGenifer <157119956+killangenifer@users.noreply.github.com>
Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>
2025-06-16 21:12:42 +03:00

141 lines
3.9 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>
/// Whether the borg can currently be disabled if the brain is installed,
/// if on cooldown then can't queue up multiple disables.
/// </summary>
[DataField]
public bool CanDisable;
/// <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;
// WD EDIT START
[DataField]
public bool IsAiControllable;
// WD EDIT END
public CyborgControlData(SpriteSpecifier? chassisSprite, string chassisName, string name, float charge, int moduleCount, bool hasBrain, bool canDisable, bool isAiControllable) // WD EDIT
{
ChassisSprite = chassisSprite;
ChassisName = chassisName;
Name = name;
Charge = charge;
ModuleCount = moduleCount;
HasBrain = hasBrain;
CanDisable = canDisable;
IsAiControllable = isAiControllable; // WD EDIT
}
}
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";
}