using Robust.Shared.Toolshed;
using Robust.Shared.Utility;
using System.Linq;
+using System.Numerics;
+using Robust.Shared.Physics.Components;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Server.Administration.Systems
Text = Loc.GetString("admin-verbs-teleport-to"),
Category = VerbCategory.Admin,
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/open.svg.192dpi.png")),
- Act = () => _console.ExecuteCommand(player, $"tpto {args.Target}"),
+ Act = () =>
+ {
+ _console.ExecuteCommand(player, $"tpto {GetNetEntity(args.Target)}");
+ },
Impact = LogImpact.Low
});
{
if (player.AttachedEntity != null)
{
- var mapPos = Transform(player.AttachedEntity.Value).MapPosition;
- _console.ExecuteCommand(player, $"tpgrid {args.Target} {mapPos.X} {mapPos.Y} {mapPos.MapId}");
+ var mapPos = _transformSystem.GetMapCoordinates(player.AttachedEntity.Value);
+ if (TryComp(args.Target, out PhysicsComponent? targetPhysics))
+ {
+ var offset = targetPhysics.LocalCenter;
+ var rotation = _transformSystem.GetWorldRotation(args.Target);
+ offset = rotation.RotateVec(offset);
+
+ mapPos = mapPos.Offset(-offset);
+ }
+
+ _console.ExecuteCommand(player, $"tpgrid {GetNetEntity(args.Target)} {mapPos.X} {mapPos.Y} {mapPos.MapId}");
}
}
else