From 20be8298b7d7b8132d26f6386c2110b8b3dc9d06 Mon Sep 17 00:00:00 2001 From: SpaceManiac Date: Sat, 7 Dec 2024 10:13:56 -0800 Subject: [PATCH 01/82] Organize the Sandbox Panel window (#33684) * Organize Sandbox Panel * Map Editing -> Editing * Unset ToggleMode on Suicide button. Can hardly un-suicide, no? * Remove 'Link machines' button that has done nothing for 3 years * Remember Sandbox window's position instead of forcing to center * Shows Spawns -> Show Spawns * Remove SandboxSystem.MachineLinking --- Content.Client/Sandbox/SandboxSystem.cs | 7 +------ .../Systems/Sandbox/SandboxUIController.cs | 16 +++++++++------- .../Systems/Sandbox/Windows/SandboxWindow.xaml | 18 +++++++++++------- .../Locale/en-US/sandbox/sandbox-manager.ftl | 8 ++++++-- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Content.Client/Sandbox/SandboxSystem.cs b/Content.Client/Sandbox/SandboxSystem.cs index 8a4c93fa354..abc717642c8 100644 --- a/Content.Client/Sandbox/SandboxSystem.cs +++ b/Content.Client/Sandbox/SandboxSystem.cs @@ -110,7 +110,7 @@ public bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid ui } // Try copy tile. - + if (!_map.TryFindGridAt(_transform.ToMapCoordinates(coords), out var gridUid, out var grid) || !_mapSystem.TryGetTileRef(gridUid, grid, coords, out var tileRef)) return false; @@ -157,10 +157,5 @@ public void ShowBb() { _consoleHost.ExecuteCommand("physics shapes"); } - - public void MachineLinking() - { - _consoleHost.ExecuteCommand("signallink"); - } } } diff --git a/Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs b/Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs index 58c8a1451bd..1924bf2b24c 100644 --- a/Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs +++ b/Content.Client/UserInterface/Systems/Sandbox/SandboxUIController.cs @@ -1,4 +1,5 @@ -using Content.Client.Administration.Managers; +using System.Numerics; +using Content.Client.Administration.Managers; using Content.Client.Gameplay; using Content.Client.Markers; using Content.Client.Sandbox; @@ -7,9 +8,7 @@ using Content.Client.UserInterface.Systems.DecalPlacer; using Content.Client.UserInterface.Systems.Sandbox.Windows; using Content.Shared.Input; -using Content.Shared.Silicons.StationAi; using JetBrains.Annotations; -using Robust.Client.Console; using Robust.Client.Debugging; using Robust.Client.Graphics; using Robust.Client.Input; @@ -109,9 +108,13 @@ public void LoadButton() private void EnsureWindow() { - if(_window is { Disposed: false }) + if (_window is { Disposed: false }) return; _window = UIManager.CreateWindow(); + // Pre-center the window without forcing it to the center every time. + _window.OpenCentered(); + _window.Close(); + _window.OnOpen += () => { SandboxButton!.Pressed = true; }; _window.OnClose += () => { SandboxButton!.Pressed = false; }; _window.ToggleLightButton.Pressed = !_light.Enabled; @@ -149,7 +152,6 @@ private void EnsureWindow() _window.ToggleSubfloorButton.OnPressed += _ => _sandbox.ToggleSubFloor(); _window.ShowMarkersButton.OnPressed += _ => _sandbox.ShowMarkers(); _window.ShowBbButton.OnPressed += _ => _sandbox.ShowBb(); - _window.MachineLinkingButton.OnPressed += _ => _sandbox.MachineLinking(); } private void CheckSandboxVisibility() @@ -164,7 +166,7 @@ public void OnStateExited(GameplayState state) { if (_window != null) { - _window.Dispose(); + _window.Close(); _window = null; } @@ -209,7 +211,7 @@ private void ToggleWindow() if (_sandbox.SandboxAllowed && _window.IsOpen != true) { UIManager.ClickSound(); - _window.OpenCentered(); + _window.Open(); } else { diff --git a/Content.Client/UserInterface/Systems/Sandbox/Windows/SandboxWindow.xaml b/Content.Client/UserInterface/Systems/Sandbox/Windows/SandboxWindow.xaml index 05e65cf29c3..bec1d6b4d6f 100644 --- a/Content.Client/UserInterface/Systems/Sandbox/Windows/SandboxWindow.xaml +++ b/Content.Client/UserInterface/Systems/Sandbox/Windows/SandboxWindow.xaml @@ -4,20 +4,24 @@ Title="{Loc sandbox-window-title}" Resizable="False"> -