corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 using System;
2  
3 namespace OpenMetaverse.TestClient.Commands.Movement
4 {
5 class BackCommand : Command
6 {
7 public BackCommand(TestClient client)
8 {
9 Name = "back";
10 Description = "Sends the move back command to the server for a single packet or a given number of seconds. Usage: back [seconds]";
11 Category = CommandCategory.Movement;
12 }
13  
14 public override string Execute(string[] args, UUID fromAgentID)
15 {
16 if (args.Length > 1)
17 return "Usage: back [seconds]";
18  
19 if (args.Length == 0)
20 {
21 Client.Self.Movement.SendManualUpdate(AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, Client.Self.Movement.Camera.Position,
22 Client.Self.Movement.Camera.AtAxis, Client.Self.Movement.Camera.LeftAxis, Client.Self.Movement.Camera.UpAxis,
23 Client.Self.Movement.BodyRotation, Client.Self.Movement.HeadRotation, Client.Self.Movement.Camera.Far, AgentFlags.None,
24 AgentState.None, true);
25 }
26 else
27 {
28 // Parse the number of seconds
29 int duration;
30 if (!Int32.TryParse(args[0], out duration))
31 return "Usage: back [seconds]";
32 // Convert to milliseconds
33 duration *= 1000;
34  
35 int start = Environment.TickCount;
36  
37 Client.Self.Movement.AtNeg = true;
38  
39 while (Environment.TickCount - start < duration)
40 {
41 // The movement timer will do this automatically, but we do it here as an example
42 // and to make sure updates are being sent out fast enough
43 Client.Self.Movement.SendUpdate(false);
44 System.Threading.Thread.Sleep(100);
45 }
46  
47 Client.Self.Movement.AtNeg = false;
48 }
49  
50 return "Moved backward";
51 }
52 }
53 }