@@ -57,12 +57,43 @@ public sealed partial class ObjectsTab : Control
|
|||||||
|
|
||||||
private void TeleportTo(NetEntity nent)
|
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<MapComponent>(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<StationSystem>().GetLargestGrid(station.Value);
|
||||||
|
if (largestGrid == null)
|
||||||
|
break;
|
||||||
|
_console.ExecuteCommand($"tpto {largestGrid.Value}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Delete(NetEntity nent)
|
private void Delete(NetEntity nent)
|
||||||
{
|
{
|
||||||
_console.ExecuteCommand($"delete {nent}");
|
_console.ExecuteCommand($"delete {nent}");
|
||||||
|
RefreshObjectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshObjectList()
|
public void RefreshObjectList()
|
||||||
@@ -79,25 +110,21 @@ public sealed partial class ObjectsTab : Control
|
|||||||
entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem<StationSystem>().GetStationNames());
|
entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem<StationSystem>().GetStationNames());
|
||||||
break;
|
break;
|
||||||
case ObjectsTabSelection.Grids:
|
case ObjectsTabSelection.Grids:
|
||||||
{
|
|
||||||
var query = _entityManager.AllEntityQueryEnumerator<MapGridComponent, MetaDataComponent>();
|
|
||||||
while (query.MoveNext(out var uid, out _, out var metadata))
|
|
||||||
{
|
{
|
||||||
entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid)));
|
var query = _entityManager.AllEntityQueryEnumerator<MapGridComponent, MetaDataComponent>();
|
||||||
}
|
while (query.MoveNext(out var uid, out _, out var metadata))
|
||||||
|
entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObjectsTabSelection.Maps:
|
case ObjectsTabSelection.Maps:
|
||||||
{
|
|
||||||
var query = _entityManager.AllEntityQueryEnumerator<MapComponent, MetaDataComponent>();
|
|
||||||
while (query.MoveNext(out var uid, out _, out var metadata))
|
|
||||||
{
|
{
|
||||||
entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid)));
|
var query = _entityManager.AllEntityQueryEnumerator<MapComponent, MetaDataComponent>();
|
||||||
}
|
while (query.MoveNext(out var uid, out _, out var metadata))
|
||||||
|
entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(selection), selection, null);
|
throw new ArgumentOutOfRangeException(nameof(selection), selection, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<PanelContainer xmlns="https://spacestation14.io"
|
<PanelContainer xmlns="https://spacestation14.io"
|
||||||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||||
|
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||||
Name="BackgroundColorPanel">
|
Name="BackgroundColorPanel">
|
||||||
<BoxContainer Orientation="Horizontal"
|
<BoxContainer Orientation="Horizontal"
|
||||||
HorizontalExpand="True"
|
HorizontalExpand="True"
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
HorizontalExpand="True"
|
HorizontalExpand="True"
|
||||||
ClipText="True"/>
|
ClipText="True"/>
|
||||||
<customControls:VSeparator/>
|
<customControls:VSeparator/>
|
||||||
<Button Name="DeleteButton"
|
<controls:ConfirmButton Name="DeleteButton"
|
||||||
Text="{Loc object-tab-entity-delete}"
|
Text="{Loc object-tab-entity-delete}"
|
||||||
SizeFlagsStretchRatio="3"
|
SizeFlagsStretchRatio="3"
|
||||||
HorizontalExpand="True"
|
HorizontalExpand="True"
|
||||||
|
|||||||
Reference in New Issue
Block a user