-
Notifications
You must be signed in to change notification settings - Fork 31
[PORT] B.O.R.I.S ai remote control brain (#2745) #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me> | ||
| // SPDX-FileCopyrightText: 2025 ImHoks <imhokzzzz@gmail.com> | ||
| // SPDX-FileCopyrightText: 2025 KillanGenifer <killangenifer@gmail.com> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| using Content.Shared._CorvaxNext.Silicons.Borgs; | ||
|
|
||
| namespace Content.Client._CorvaxNext.Silicons.Borgs; | ||
|
|
||
| public sealed partial class AiRemoteControlSystem : SharedAiRemoteControlSystem | ||
| { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Control xmlns="https://spacestation14.io" | ||
| xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
| Margin="0 0 0 10"> | ||
| <PanelContainer VerticalExpand="True" StyleClasses="BackgroundDark"> | ||
| <BoxContainer Orientation="Vertical" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True" | ||
| Margin="5 5 5 5"> | ||
| <customControls:HSeparator Margin="0 5 0 5"/> | ||
| <RichTextLabel Name="DeviceName"/> | ||
| <BoxContainer Name="RemoteControlButtons" Orientation="Horizontal" HorizontalExpand="True" Margin="0 5 0 0"> | ||
| <Button Name="MoveButton" StyleClasses="chatSelectorOptionButton" Text="{Loc ai-remote-ui-menu-moveto}"/> | ||
| <Control Margin="2 0 0 0"/> | ||
| <Button Name="TakeControlButton" StyleClasses="chatSelectorOptionButton" Text="{Loc ai-remote-control}"/> | ||
| </BoxContainer> | ||
| </BoxContainer> | ||
| </PanelContainer> | ||
| </Control> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me> | ||
| // SPDX-FileCopyrightText: 2025 ImHoks <imhokzzzz@gmail.com> | ||
| // SPDX-FileCopyrightText: 2025 KillanGenifer <killangenifer@gmail.com> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| using Robust.Client.UserInterface; | ||
| using Robust.Client.AutoGenerated; | ||
| using Robust.Client.UserInterface.XAML; | ||
| using Content.Shared._CorvaxNext.Silicons.Borgs.Components; | ||
|
|
||
| namespace Content.Client._CorvaxNext.Silicons.Laws.Ui; | ||
|
|
||
| [GenerateTypedNameReferences] | ||
| public sealed partial class RemoteDeviceDisplay : Control | ||
| { | ||
| public event Action<RemoteDeviceActionEvent>? OnRemoteDeviceAction; | ||
|
|
||
| public RemoteDeviceDisplay(NetEntity netEntityUid, string displayName) | ||
| { | ||
| RobustXamlLoader.Load(this); | ||
|
|
||
| DeviceName.SetMessage(displayName); | ||
|
|
||
| MoveButton.OnPressed += _ => | ||
| { | ||
| OnRemoteDeviceAction?.Invoke(new RemoteDeviceActionEvent( | ||
| RemoteDeviceActionEvent.RemoteDeviceActionType.MoveToDevice, | ||
| netEntityUid)); | ||
| }; | ||
|
|
||
| TakeControlButton.OnPressed += _ => | ||
| { | ||
| OnRemoteDeviceAction?.Invoke(new RemoteDeviceActionEvent( | ||
| RemoteDeviceActionEvent.RemoteDeviceActionType.TakeControl, | ||
| netEntityUid)); | ||
| }; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me> | ||
| // SPDX-FileCopyrightText: 2025 ImHoks <imhokzzzz@gmail.com> | ||
| // SPDX-FileCopyrightText: 2025 KillanGenifer <killangenifer@gmail.com> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| using Content.Shared._CorvaxNext.Silicons.Borgs.Components; | ||
| using Robust.Client.UserInterface; | ||
| using static Content.Shared._CorvaxNext.Silicons.Borgs.Components.AiRemoteControllerComponent; | ||
|
|
||
| namespace Content.Client._CorvaxNext.Silicons.Laws.Ui; | ||
|
|
||
| public sealed class RemoteDevicesBoundUserInterface : BoundUserInterface | ||
| { | ||
| private RemoteDevicesMenu? _menu; | ||
| private EntityUid _owner; | ||
|
|
||
| public RemoteDevicesBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
| { | ||
| _owner = owner; | ||
| } | ||
|
|
||
| protected override void Open() | ||
| { | ||
| base.Open(); | ||
|
|
||
| _menu = this.CreateWindow<RemoteDevicesMenu>(); | ||
| _menu.OnRemoteDeviceAction += SendAction; | ||
| } | ||
|
|
||
| protected override void UpdateState(BoundUserInterfaceState state) | ||
| { | ||
| base.UpdateState(state); | ||
|
|
||
| if (state is not RemoteDevicesBuiState msg) | ||
| return; | ||
|
|
||
| _menu?.Update(_owner, msg); | ||
| } | ||
|
|
||
| public void SendAction(RemoteDeviceActionEvent action) | ||
| { | ||
| SendMessage(new RemoteDeviceActionMessage(action)); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <controls:FancyWindow xmlns="https://spacestation14.io" | ||
| xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
| xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
| Title="{Loc ai-remote-ui-menu-title}" | ||
| MinSize="355 100" | ||
| SetSize="355 415"> | ||
| <BoxContainer Orientation="Vertical" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True"> | ||
| <PanelContainer VerticalExpand="True" Margin="10 10 10 10"> | ||
| <PanelContainer.PanelOverride> | ||
| <gfx:StyleBoxFlat BackgroundColor="#1B1B1E"/> | ||
| </PanelContainer.PanelOverride> | ||
| <ScrollContainer | ||
| HScrollEnabled="False" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True"> | ||
| <BoxContainer | ||
| Name="RemoteDevicesDisplayContainer" | ||
| Orientation="Vertical" | ||
| VerticalExpand="True" | ||
| Margin="10 10 10 0"> | ||
| </BoxContainer> | ||
| </ScrollContainer> | ||
| </PanelContainer> | ||
| </BoxContainer> | ||
| </controls:FancyWindow> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me> | ||
| // SPDX-FileCopyrightText: 2025 ImHoks <imhokzzzz@gmail.com> | ||
| // SPDX-FileCopyrightText: 2025 KillanGenifer <killangenifer@gmail.com> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| using Robust.Client.UserInterface.XAML; | ||
| using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow; | ||
| using Robust.Client.AutoGenerated; | ||
| using Content.Shared._CorvaxNext.Silicons.Borgs.Components; | ||
|
|
||
| namespace Content.Client._CorvaxNext.Silicons.Laws.Ui; | ||
|
|
||
| [GenerateTypedNameReferences] | ||
| public sealed partial class RemoteDevicesMenu : FancyWindow | ||
| { | ||
| public event Action<RemoteDeviceActionEvent>? OnRemoteDeviceAction; | ||
|
|
||
| public RemoteDevicesMenu() | ||
| { | ||
| RobustXamlLoader.Load(this); | ||
| } | ||
|
|
||
| public void Update(EntityUid uid, RemoteDevicesBuiState state) | ||
| { | ||
| RemoteDevicesDisplayContainer.Children.Clear(); | ||
|
|
||
| if (state.DeviceList == null) | ||
| return; | ||
|
|
||
| foreach (var device in state.DeviceList) | ||
| { | ||
| var control = new RemoteDeviceDisplay(device.NetEntityUid, device.DisplayName); | ||
|
|
||
| control.OnRemoteDeviceAction += action => | ||
| { | ||
| OnRemoteDeviceAction?.Invoke(action); | ||
| }; | ||
|
|
||
| RemoteDevicesDisplayContainer.AddChild(control); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||||||||||||||||||||||||
| using Content.Server.Administration; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Server.Chat.Managers; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Server.Station.Systems; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared._CorvaxNext.Silicons.Borgs.Components; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Administration; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Chat; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Emag.Systems; | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -13,6 +14,8 @@ | |||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Roles.Components; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Silicons.Laws; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Silicons.Laws.Components; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Silicons.StationAi; | ||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Tag; | ||||||||||||||||||||||||||||||||||||||||||
| using Robust.Server.GameObjects; | ||||||||||||||||||||||||||||||||||||||||||
| using Robust.Shared.Audio; | ||||||||||||||||||||||||||||||||||||||||||
| using Robust.Shared.Containers; | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -32,6 +35,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem | |||||||||||||||||||||||||||||||||||||||||
| [Dependency] private readonly StationSystem _station = default!; | ||||||||||||||||||||||||||||||||||||||||||
| [Dependency] private readonly UserInterfaceSystem _userInterface = default!; | ||||||||||||||||||||||||||||||||||||||||||
| [Dependency] private readonly EmagSystem _emag = default!; | ||||||||||||||||||||||||||||||||||||||||||
| [Dependency] private readonly TagSystem _tagSystem = default!; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /// <inheritdoc/> | ||||||||||||||||||||||||||||||||||||||||||
| public override void Initialize() | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -61,6 +65,9 @@ private void OnMindAdded(EntityUid uid, SiliconLawBoundComponent component, Mind | |||||||||||||||||||||||||||||||||||||||||
| if (!TryComp<ActorComponent>(uid, out var actor)) | ||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (HasComp<AiRemoteControllerComponent>(uid) || _tagSystem.HasTag(uid, "StationAi")) | ||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var msg = Loc.GetString("laws-notify"); | ||||||||||||||||||||||||||||||||||||||||||
| var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", msg)); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -154,6 +161,9 @@ private void OnEmagLawsAdded(EntityUid uid, SiliconLawProviderComponent componen | |||||||||||||||||||||||||||||||||||||||||
| if (component.Lawset == null) | ||||||||||||||||||||||||||||||||||||||||||
| component.Lawset = GetLawset(component.Laws); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (HasComp<AiRemoteControllerComponent>(uid)) | ||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| // Show the silicon has been subverted. | ||||||||||||||||||||||||||||||||||||||||||
| component.Subverted = true; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -305,8 +315,26 @@ protected override void OnUpdaterInsert(Entity<SiliconLawUpdaterComponent> ent, | |||||||||||||||||||||||||||||||||||||||||
| while (query.MoveNext(out var update)) | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| SetLaws(lawset.Laws, update, provider.LawUploadSound); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (TryComp<StationAiHeldComponent>(update, out var heldComp) | ||||||||||||||||||||||||||||||||||||||||||
| && heldComp.CurrentConnectedEntity != null | ||||||||||||||||||||||||||||||||||||||||||
| && HasComp<SiliconLawProviderComponent>(heldComp.CurrentConnectedEntity)) | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| SetLaws(lawset.Laws, heldComp.CurrentConnectedEntity.Value, provider.LawUploadSound); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| public void SetLawsSilent(List<SiliconLaw> newLaws, EntityUid target, SoundSpecifier? cue = null) | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| if (!TryComp<SiliconLawProviderComponent>(target, out var component)) | ||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (component.Lawset == null) | ||||||||||||||||||||||||||||||||||||||||||
| component.Lawset = new SiliconLawset(); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| component.Lawset.Laws = newLaws; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+329
to
+338
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused The 🐛 Remove unused parameter- public void SetLawsSilent(List<SiliconLaw> newLaws, EntityUid target, SoundSpecifier? cue = null)
+ public void SetLawsSilent(List<SiliconLaw> newLaws, EntityUid target)
{
if (!TryComp<SiliconLawProviderComponent>(target, out var component))
return;
if (component.Lawset == null)
component.Lawset = new SiliconLawset();
component.Lawset.Laws = newLaws;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| [ToolshedCommand, AdminCommand(AdminFlags.Admin)] | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid vertical expansion on per-device row containers.
Line 4 and Line 7 force row expansion, which can cause oversized entries in a vertical list. Prefer size-to-content rows.
Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents