2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
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";
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
2007-08-10 20:16:19 +00:00
|
|
|
|
|
|
|
|
public override string Execute(string[] args, LLUUID fromAgentID)
|
|
|
|
|
{
|
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;
|
|
|
|
|
Helpers.LongToUInts(Client.Network.CurrentSim.Handle, out regionX, out regionY);
|
|
|
|
|
|
2007-11-06 09:26:10 +00:00
|
|
|
double x, y, z;
|
2007-11-29 19:50:44 +00:00
|
|
|
if (!Double.TryParse(args[0], out x) ||
|
|
|
|
|
!Double.TryParse(args[1], out y) ||
|
|
|
|
|
!Double.TryParse(args[2], out z))
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
|
|
|
return String.Format("Attempting to move to <{0},{1},{2}>", x, y, z);
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|