From d63632c81ca736c6475cc136102a44c3e77d0213 Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Tue, 11 Jun 2024 04:52:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BF=D0=BE=D1=80=D1=82=D0=B0=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB=D0=B8=20=D0=B3=D1=80=D0=B8=D0=B4?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs | 20 ++++++++++++++++++- .../UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml | 12 +++++++++++ .../Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs | 6 +++++- .../UI/Tabs/ObjectsTab/ObjectsTabHeader.xaml | 6 ++++++ .../administration/ui/tabs/object-tab.ftl | 4 ++++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 Resources/Locale/ru-RU/administration/ui/tabs/object-tab.ftl diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs index c8606ca80d..866c4e788f 100644 --- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs @@ -1,6 +1,7 @@ using Content.Client.Station; using Content.Client.UserInterface.Controls; using Robust.Client.AutoGenerated; +using Robust.Client.Console; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; @@ -14,6 +15,7 @@ public sealed partial class ObjectsTab : Control { [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IClientConsoleHost _console = default!; private readonly List _objects = new(); private readonly List _selections = new(); @@ -27,6 +29,9 @@ public sealed partial class ObjectsTab : Control private readonly TimeSpan _updateFrequency = TimeSpan.FromSeconds(2); private TimeSpan _nextUpdate; + private Action? TeleportToObjAction { get; set; } + private Action? DeleteObjAction { get; set; } + public ObjectsTab() { RobustXamlLoader.Load(this); @@ -57,6 +62,19 @@ public sealed partial class ObjectsTab : Control // Initialize the next update time _nextUpdate = TimeSpan.Zero; + + TeleportToObjAction += TeleportToObj; + DeleteObjAction += DeleteObj; + } + + private void TeleportToObj(NetEntity nent) + { + _console.ExecuteCommand($"tpto {nent}"); + } + + private void DeleteObj(NetEntity nent) + { + _console.ExecuteCommand($"delete {nent}"); } protected override void FrameUpdate(FrameEventArgs args) @@ -129,7 +147,7 @@ public sealed partial class ObjectsTab : Control if (data is not ObjectsListData { Info: var info, BackgroundColor: var backgroundColor }) return; - var entry = new ObjectsTabEntry(info.Name, info.Entity, new StyleBoxFlat { BackgroundColor = backgroundColor }); + var entry = new ObjectsTabEntry(info.Name, info.Entity, new StyleBoxFlat { BackgroundColor = backgroundColor }, TeleportToObjAction, DeleteObjAction); button.ToolTip = $"{info.Name}, {info.Entity}"; button.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(args, data); diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml index 83c4cc5697..8b7a2055c2 100644 --- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml +++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml @@ -13,5 +13,17 @@ SizeFlagsStretchRatio="3" HorizontalExpand="True" ClipText="True"/> + +