2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient.Commands.Movement
|
2007-08-10 20:16:19 +00:00
|
|
|
{
|
|
|
|
|
class MovetoCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public MovetoCommand(TestClient client)
|
|
|
|
|
{
|
2007-04-28 20:54:02 +00:00
|
|
|
Name = "moveto";
|
2007-11-06 09:26:10 +00:00
|
|
|
Description = "Moves the avatar to the specified global position using simulator autopilot. Usage: moveto x y z";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Movement;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
2007-08-10 20:16:19 +00:00
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-08-10 20:16:19 +00:00
|
|
|
{
|
2007-04-28 20:54:02 +00:00
|
|
|
if (args.Length != 3)
|
2007-11-06 09:26:10 +00:00
|
|
|
return "Usage: moveto x y z";
|
2007-08-10 20:16:19 +00:00
|
|
|
|
|
|
|
|
uint regionX, regionY;
|
2008-10-06 22:34:38 +00:00
|
|
|
Utils.LongToUInts(Client.Network.CurrentSim.Handle, out regionX, out regionY);
|
2007-08-10 20:16:19 +00:00
|
|
|
|
2007-11-06 09:26:10 +00:00
|
|
|
double x, y, z;
|
2022-02-25 19:38:11 -06:00
|
|
|
if (!double.TryParse(args[0], out x) ||
|
|
|
|
|
!double.TryParse(args[1], out y) ||
|
|
|
|
|
!double.TryParse(args[2], out z))
|
2007-11-29 19:50:44 +00:00
|
|
|
{
|
|
|
|
|
return "Usage: moveto x y z";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert the local coordinates to global ones by adding the region handle parts to x and y
|
|
|
|
|
x += (double)regionX;
|
|
|
|
|
y += (double)regionY;
|
2007-11-06 09:26:10 +00:00
|
|
|
|
|
|
|
|
Client.Self.AutoPilot(x, y, z);
|
2007-08-10 20:16:19 +00:00
|
|
|
|
2022-02-25 19:38:11 -06:00
|
|
|
return $"Attempting to move to <{x},{y},{z}>";
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|