* Converted all timers to System.Threading timers to fix problems running in services and the CF * UDPBase now uses our own ReaderWriterLock that is more efficient, and CF compatible * Login uses a hand-created LoginProxy object instead of dynamically building the class with reflection .Emit() * Replaced ParameterizedThreadStart calls with class-wide variables for CF compat. * Removed transfer timeout code (irrelevant now that uploads go through CAPS) * Added several new Helpers methods to wrap desktop and CF conditional code * Replaced Monitor calls with AutoResetEvent in BlockingQueue * InventoryNodeDictionary uses generics now * Removed final lingering piece of XML serialization * Added CookComputing.XmlRpc.CF.dll for the CF git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1479 52acb1d6-8a22-11de-b505-999d5b087335
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using libsecondlife;
|
|
using libsecondlife.Packets;
|
|
|
|
namespace libsecondlife.TestClient
|
|
{
|
|
public class SitCommand: Command
|
|
{
|
|
public SitCommand(TestClient testClient)
|
|
{
|
|
Name = "sit";
|
|
Description = "Attempt to sit on the closest prim";
|
|
}
|
|
|
|
public override string Execute(string[] args, LLUUID fromAgentID)
|
|
{
|
|
Primitive closest = null;
|
|
double closestDistance = Double.MaxValue;
|
|
|
|
Client.Network.CurrentSim.Objects.ForEach(
|
|
delegate(Primitive prim)
|
|
{
|
|
float distance = LLVector3.Dist(Client.Self.SimPosition, prim.Position);
|
|
|
|
if (closest == null || distance < closestDistance)
|
|
{
|
|
closest = prim;
|
|
closestDistance = distance;
|
|
}
|
|
}
|
|
);
|
|
|
|
if (closest != null)
|
|
{
|
|
Client.Self.RequestSit(closest.ID, LLVector3.Zero);
|
|
Client.Self.Sit();
|
|
|
|
return "Sat on " + closest.ID + ". Distance: " + closestDistance;
|
|
}
|
|
else
|
|
{
|
|
return "Couldn't find a nearby prim to sit on";
|
|
}
|
|
}
|
|
}
|
|
}
|