mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* Toolshed Rejig * shorten hint string * Try fix conflicts. Ill make with work later * bodge * Fix ProtoIdTypeParser assert * comment * AllEntities * Remove more linq from WhereCommand * better help strings * Add ContainsCommand * loc strings * Add contains command description * Add $self variable * Errors for writing to readonly variables * A
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Robust.Shared.Toolshed.Commands.Entities.World;
|
|
|
|
[ToolshedCommand]
|
|
internal sealed class TpCommand : ToolshedCommand
|
|
{
|
|
private SharedTransformSystem? _xform;
|
|
|
|
[CommandImplementation("coords")]
|
|
public EntityUid TpCoords([PipedArgument] EntityUid teleporter, EntityCoordinates target)
|
|
{
|
|
_xform ??= GetSys<SharedTransformSystem>();
|
|
_xform.SetCoordinates(teleporter, target);
|
|
return teleporter;
|
|
}
|
|
|
|
[CommandImplementation("coords")]
|
|
public IEnumerable<EntityUid> TpCoords([PipedArgument] IEnumerable<EntityUid> teleporters, EntityCoordinates target)
|
|
=> teleporters.Select(x => TpCoords(x, target));
|
|
|
|
[CommandImplementation("to")]
|
|
public EntityUid TpTo([PipedArgument] EntityUid teleporter, EntityUid target)
|
|
{
|
|
_xform ??= GetSys<SharedTransformSystem>();
|
|
_xform.SetCoordinates(teleporter, Transform(target).Coordinates);
|
|
return teleporter;
|
|
}
|
|
|
|
[CommandImplementation("to")]
|
|
public IEnumerable<EntityUid> TpTo([PipedArgument] IEnumerable<EntityUid> teleporters, EntityUid target)
|
|
=> teleporters.Select(x => TpTo(x, target));
|
|
|
|
[CommandImplementation("into")]
|
|
public EntityUid TpInto([PipedArgument] EntityUid teleporter, EntityUid target)
|
|
{
|
|
_xform ??= GetSys<SharedTransformSystem>();
|
|
_xform.SetCoordinates(teleporter, new EntityCoordinates(target, Vector2.Zero));
|
|
return teleporter;
|
|
}
|
|
|
|
[CommandImplementation("into")]
|
|
public IEnumerable<EntityUid> TpInto([PipedArgument] IEnumerable<EntityUid> teleporters, EntityUid target)
|
|
=> teleporters.Select(x => TpInto(x, target));
|
|
}
|