- Further cleanups

- Added TeleportFinish event to the event-queue. It works better than
  before (you can teleport), but it doesn't work quite right yet (you
  start TPing after the TP again).
  Beware: Still experimental and non-working.
0.6.0-stable
Homer Horwitz 2008-09-28 14:19:26 +00:00
parent 4452121227
commit 1cc927ad97
2 changed files with 58 additions and 30 deletions

View File

@ -52,6 +52,15 @@ namespace OpenSim.Region.Environment
};
}
private static LLSD buildEvent(string eventName, LLSD eventBody)
{
LLSDMap llsdEvent = new LLSDMap(2);
llsdEvent.Add("message", new LLSDString(eventName));
llsdEvent.Add("body", eventBody);
return llsdEvent;
}
public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
{
LLSDMap llsdSimInfo = new LLSDMap(3);
@ -66,16 +75,12 @@ namespace OpenSim.Region.Environment
LLSDMap llsdBody = new LLSDMap(1);
llsdBody.Add("SimulatorInfo", arr);
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
return buildEvent("EnableSimulator", llsdBody);
}
public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID AgentID, UUID SessionID)
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID AgentID, UUID SessionID)
{
LLSDArray LookAtArr = new LLSDArray(3);
LookAtArr.Add(LLSD.FromReal(lookAt.X));
@ -110,28 +115,40 @@ namespace OpenSim.Region.Environment
LLSDArray RegionDataArr = new LLSDArray(1);
RegionDataArr.Add(RegionDataMap);
LLSDMap llsdBody = new LLSDMap(3);
llsdBody.Add("Info", InfoArr);
llsdBody.Add("AgentData", AgentDataArr);
llsdBody.Add("RegionData", RegionDataArr);
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("CrossedRegion"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
return buildEvent("CrossedRegion", llsdBody);
}
public static LLSD TeleportFinishEvent(
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID AgentID)
{
LLSDMap info = new LLSDMap();
info.Add("AgentID", LLSD.FromUUID(AgentID));
info.Add("LocationID", LLSD.FromInteger(4)); // TODO what is this?
info.Add("RegionHandle", LLSD.FromBinary(regionHandleToByteArray(regionHandle)));
info.Add("SeedCapability", LLSD.FromString(capsURL));
info.Add("SimAccess", LLSD.FromInteger(simAccess));
info.Add("SimIP", LLSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
info.Add("SimPort", LLSD.FromInteger(regionExternalEndPoint.Port));
info.Add("TeleportFlags", LLSD.FromBinary(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
LLSDArray infoArr = new LLSDArray();
infoArr.Add(info);
LLSDMap body = new LLSDMap();
body.Add("Info", infoArr);
return buildEvent("TeleportFinish", body);
}
public static LLSD KeepAliveEvent()
{
LLSDMap llsdSimInfo = new LLSDMap();
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("FAKEEVENT"));
llsdMessage.Add("body", llsdSimInfo);
return llsdMessage;
return buildEvent("FAKEEVENT", new LLSDMap());
}
}
}

View File

@ -687,8 +687,19 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, teleportFlags,
capsPath);
IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
LLSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, reg.ExternalEndPoint,
4, teleportFlags, capsPath, avatar.UUID);
eq.Enqueue(Item, avatar.UUID);
}
else
{
avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4,
teleportFlags, capsPath);
}
avatar.MakeChildAgent();
Thread.Sleep(5000);
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle);