2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2007-08-10 20:16:19 +00:00
|
|
|
namespace libsecondlife.TestClient.Commands.Movement
|
|
|
|
|
{
|
|
|
|
|
class MovetoCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public MovetoCommand(TestClient client)
|
|
|
|
|
{
|
2007-04-28 20:54:02 +00:00
|
|
|
Name = "moveto";
|
|
|
|
|
Description = "Moves the avatar to the specified global position using simulator autopilot.";
|
|
|
|
|
}
|
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)
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
float x = Client.Self.Position.X + (ulong)regionX;
|
|
|
|
|
float y = Client.Self.Position.Y + (ulong)regionY;
|
2007-04-28 20:54:02 +00:00
|
|
|
float z = Client.Self.Position.Z;
|
|
|
|
|
float.TryParse(args[0], out x);
|
|
|
|
|
float.TryParse(args[1], out y);
|
|
|
|
|
float.TryParse(args[2], out z);
|
|
|
|
|
Client.Self.AutoPilot((ulong)x, (ulong)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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|