diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs index de9ccbbf50..fa92a3e18f 100644 --- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs @@ -57,12 +57,43 @@ public sealed partial class ObjectsTab : Control private void TeleportTo(NetEntity nent) { - _console.ExecuteCommand($"tpto {nent}"); + var selection = _selections[ObjectTypeOptions.SelectedId]; + switch (selection) + { + case ObjectsTabSelection.Grids: + { + // directly teleport to the entity + _console.ExecuteCommand($"tpto {nent}"); + } + break; + case ObjectsTabSelection.Maps: + { + // teleport to the map, not to the map entity (which is in nullspace) + if (!_entityManager.TryGetEntity(nent, out var map) || !_entityManager.TryGetComponent(map, out var mapComp)) + break; + _console.ExecuteCommand($"tp 0 0 {mapComp.MapId}"); + break; + } + case ObjectsTabSelection.Stations: + { + // teleport to the station's largest grid, not to the station entity (which is in nullspace) + if (!_entityManager.TryGetEntity(nent, out var station)) + break; + var largestGrid = _entityManager.EntitySysManager.GetEntitySystem().GetLargestGrid(station.Value); + if (largestGrid == null) + break; + _console.ExecuteCommand($"tpto {largestGrid.Value}"); + break; + } + default: + throw new NotImplementedException(); + } } private void Delete(NetEntity nent) { _console.ExecuteCommand($"delete {nent}"); + RefreshObjectList(); } public void RefreshObjectList() @@ -79,25 +110,21 @@ public sealed partial class ObjectsTab : Control entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem().GetStationNames()); break; case ObjectsTabSelection.Grids: - { - var query = _entityManager.AllEntityQueryEnumerator(); - while (query.MoveNext(out var uid, out _, out var metadata)) { - entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid))); - } + var query = _entityManager.AllEntityQueryEnumerator(); + while (query.MoveNext(out var uid, out _, out var metadata)) + entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid))); - break; - } + break; + } case ObjectsTabSelection.Maps: - { - var query = _entityManager.AllEntityQueryEnumerator(); - while (query.MoveNext(out var uid, out _, out var metadata)) { - entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid))); - } + var query = _entityManager.AllEntityQueryEnumerator(); + while (query.MoveNext(out var uid, out _, out var metadata)) + entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid))); - break; - } + break; + } default: throw new ArgumentOutOfRangeException(nameof(selection), selection, null); } diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml index c561125a30..7c9dde79b5 100644 --- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml +++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml @@ -1,5 +1,6 @@  -