diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 383a75d5f71..b3191f5f827 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -20,19 +20,15 @@ **Changelog** - - diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs index c8606ca80d5..866c4e788f7 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 ObjectsTab() // 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 @@ private void GenerateButton(ListData data, ListContainerButton button) 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 83c4cc5697f..8b7a2055c26 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"/> + +