+using Content.Client.Administration.Managers;
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.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map.Components;
-using Robust.Shared.Timing;
namespace Content.Client.Administration.UI.Tabs.ObjectsTab;
[GenerateTypedNameReferences]
public sealed partial class ObjectsTab : Control
{
+ [Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
+ [Dependency] private readonly IClientConsoleHost _console = default!;
private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
RefreshListButton.OnPressed += _ => RefreshObjectList();
var defaultSelection = ObjectsTabSelection.Grids;
- ObjectTypeOptions.SelectId((int) defaultSelection);
+ ObjectTypeOptions.SelectId((int)defaultSelection);
RefreshObjectList(defaultSelection);
}
+ private void TeleportTo(NetEntity nent)
+ {
+ _console.ExecuteCommand($"tpto {nent}");
+ }
+
+ private void Delete(NetEntity nent)
+ {
+ _console.ExecuteCommand($"delete {nent}");
+ }
+
public void RefreshObjectList()
{
RefreshObjectList(_selections[ObjectTypeOptions.SelectedId]);
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(_admin, info.Name, info.Entity, new StyleBoxFlat { BackgroundColor = backgroundColor });
+ entry.OnTeleport += TeleportTo;
+ entry.OnDelete += Delete;
button.ToolTip = $"{info.Name}, {info.Entity}";
button.AddChild(entry);
HorizontalExpand="True"
SeparationOverride="4">
<Label Name="NameLabel"
- SizeFlagsStretchRatio="3"
+ SizeFlagsStretchRatio="5"
HorizontalExpand="True"
ClipText="True"/>
<customControls:VSeparator/>
<Label Name="EIDLabel"
+ SizeFlagsStretchRatio="5"
+ HorizontalExpand="True"
+ ClipText="True"/>
+ <customControls:VSeparator/>
+ <Button Name="TeleportButton"
+ Text="{Loc object-tab-entity-teleport}"
SizeFlagsStretchRatio="3"
HorizontalExpand="True"
ClipText="True"/>
+ <customControls:VSeparator/>
+ <Button Name="DeleteButton"
+ Text="{Loc object-tab-entity-delete}"
+ SizeFlagsStretchRatio="3"
+ HorizontalExpand="True"
+ ClipText="True"/>
</BoxContainer>
</PanelContainer>
-using Robust.Client.AutoGenerated;
+using Content.Client.Administration.Managers;
+using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
{
public NetEntity AssocEntity;
- public ObjectsTabEntry(string name, NetEntity nent, StyleBox styleBox)
+ public Action<NetEntity>? OnTeleport;
+ public Action<NetEntity>? OnDelete;
+
+ public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox)
{
RobustXamlLoader.Load(this);
+
AssocEntity = nent;
EIDLabel.Text = nent.ToString();
NameLabel.Text = name;
BackgroundColorPanel.PanelOverride = styleBox;
+
+ TeleportButton.Disabled = !manager.CanCommand("tpto");
+ DeleteButton.Disabled = !manager.CanCommand("delete");
+
+ TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent);
+ DeleteButton.OnPressed += _ => OnDelete?.Invoke(nent);
}
}
HorizontalExpand="True"
SeparationOverride="4">
<Label Name="ObjectNameLabel"
- SizeFlagsStretchRatio="3"
+ SizeFlagsStretchRatio="5"
HorizontalExpand="True"
ClipText="True"
Text="{Loc object-tab-object-name}"
MouseFilter="Pass"/>
<cc:VSeparator/>
<Label Name="EntityIDLabel"
- SizeFlagsStretchRatio="3"
+ SizeFlagsStretchRatio="5"
HorizontalExpand="True"
ClipText="True"
Text="{Loc object-tab-entity-id}"
MouseFilter="Pass"/>
+ <Label Name="EntityTeleportLabel"
+ SizeFlagsStretchRatio="3"
+ HorizontalExpand="True"/>
+ <Label Name="EntityDeleteLabel"
+ SizeFlagsStretchRatio="3"
+ HorizontalExpand="True"/>
</BoxContainer>
</Control>
object-tab-object-type-maps = Maps
object-tab-object-type-stations = Stations
object-tab-refresh-button = Refresh
+
+object-tab-entity-teleport = Teleport
+object-tab-entity-delete = Delete