Teleport and delete buttons in objects tab. (#28914)

* Тыкнул и нету ЦК

* review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Vigers Ray
2024-08-08 14:00:08 +03:00
committed by GitHub
parent aea28b7a99
commit bd51cf330b
5 changed files with 55 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
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;
@@ -10,12 +11,22 @@ public sealed partial class ObjectsTabEntry : PanelContainer
{
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);
}
}