Skip to content

Commit a2e8ac8

Browse files
authored
Merge pull request #105 from mbiddle/origin/master
Add tpto shortcut command and move the return up for destEntity
2 parents 06bf20a + 0a502d9 commit a2e8ac8

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎Essentials/Commands/PlayerModule.cs‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public void Teleport(string entityToMove, string destination)
3131
{
3232
Utilities.TryGetEntityByNameOrId(destination, out IMyEntity destEntity);
3333

34+
if (destEntity == null)
35+
{
36+
Context.Respond("Destination entity not found");
37+
return;
38+
}
39+
3440
IMyEntity targetEntity;
3541
if (string.IsNullOrEmpty(entityToMove))
3642
targetEntity = Context.Player?.Controller.ControlledEntity.Entity;
@@ -43,12 +49,6 @@ public void Teleport(string entityToMove, string destination)
4349
return;
4450
}
4551

46-
if (destEntity == null)
47-
{
48-
Context.Respond("Destination entity not found");
49-
return;
50-
}
51-
5252
var targetPos = MyEntities.FindFreePlace(destEntity.GetPosition(), (float)targetEntity.WorldAABB.Extents.Max());
5353
if (targetPos == null)
5454
{
@@ -59,6 +59,13 @@ public void Teleport(string entityToMove, string destination)
5959
targetEntity.SetPosition(targetPos.Value);
6060
}
6161

62+
[Command("tpto", "Teleport directly to an another entity.")]
63+
[Permission(MyPromoteLevel.SpaceMaster)]
64+
public void TeleportTo(string destination, string entityToMove = null)
65+
{
66+
Teleport(entityToMove, destination);
67+
}
68+
6269
[Command("w", "Send a private message to another player.")]
6370
[Permission(MyPromoteLevel.None)]
6471
public void Whisper(string playerName)

0 commit comments

Comments
 (0)