corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Text; |
||
4 | using OpenMetaverse; |
||
5 | using OpenMetaverse.Packets; |
||
6 | |||
7 | namespace OpenMetaverse.TestClient |
||
8 | { |
||
9 | public class SitCommand: Command |
||
10 | { |
||
11 | public SitCommand(TestClient testClient) |
||
12 | { |
||
13 | Name = "sit"; |
||
14 | Description = "Attempt to sit on the closest prim"; |
||
15 | Category = CommandCategory.Movement; |
||
16 | } |
||
17 | |||
18 | public override string Execute(string[] args, UUID fromAgentID) |
||
19 | { |
||
20 | Primitive closest = null; |
||
21 | double closestDistance = Double.MaxValue; |
||
22 | |||
23 | Client.Network.CurrentSim.ObjectsPrimitives.ForEach( |
||
24 | delegate(Primitive prim) |
||
25 | { |
||
26 | float distance = Vector3.Distance(Client.Self.SimPosition, prim.Position); |
||
27 | |||
28 | if (closest == null || distance < closestDistance) |
||
29 | { |
||
30 | closest = prim; |
||
31 | closestDistance = distance; |
||
32 | } |
||
33 | } |
||
34 | ); |
||
35 | |||
36 | if (closest != null) |
||
37 | { |
||
38 | Client.Self.RequestSit(closest.ID, Vector3.Zero); |
||
39 | Client.Self.Sit(); |
||
40 | |||
41 | return "Sat on " + closest.ID + " (" + closest.LocalID + "). Distance: " + closestDistance; |
||
42 | } |
||
43 | else |
||
44 | { |
||
45 | return "Couldn't find a nearby prim to sit on"; |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | } |