2008-09-15 20:06:36 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace OpenMetaverse.TestClient.Commands.Movement
|
|
|
|
|
{
|
|
|
|
|
class BackCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public BackCommand(TestClient client)
|
|
|
|
|
{
|
|
|
|
|
Name = "back";
|
|
|
|
|
Description = "Sends the move back command to the server for a single packet or a given number of seconds. Usage: back [seconds]";
|
|
|
|
|
Category = CommandCategory.Movement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length > 1)
|
|
|
|
|
return "Usage: back [seconds]";
|
|
|
|
|
|
|
|
|
|
if (args.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Client.Self.Movement.SendManualUpdate(AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, Client.Self.Movement.Camera.Position,
|
|
|
|
|
Client.Self.Movement.Camera.AtAxis, Client.Self.Movement.Camera.LeftAxis, Client.Self.Movement.Camera.UpAxis,
|
2009-02-03 18:14:11 +00:00
|
|
|
Client.Self.Movement.BodyRotation, Client.Self.Movement.HeadRotation, Client.Self.Movement.Camera.Far, AgentFlags.None,
|
|
|
|
|
AgentState.None, true);
|
2008-09-15 20:06:36 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Parse the number of seconds
|
|
|
|
|
int duration;
|
2022-02-25 19:38:11 -06:00
|
|
|
if (!int.TryParse(args[0], out duration))
|
2008-09-15 20:06:36 +00:00
|
|
|
return "Usage: back [seconds]";
|
|
|
|
|
// Convert to milliseconds
|
|
|
|
|
duration *= 1000;
|
|
|
|
|
|
|
|
|
|
int start = Environment.TickCount;
|
|
|
|
|
|
|
|
|
|
Client.Self.Movement.AtNeg = true;
|
|
|
|
|
|
|
|
|
|
while (Environment.TickCount - start < duration)
|
|
|
|
|
{
|
|
|
|
|
// The movement timer will do this automatically, but we do it here as an example
|
|
|
|
|
// and to make sure updates are being sent out fast enough
|
|
|
|
|
Client.Self.Movement.SendUpdate(false);
|
|
|
|
|
System.Threading.Thread.Sleep(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Client.Self.Movement.AtNeg = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "Moved backward";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|