- 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) public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
{ {
LLSDMap llsdSimInfo = new LLSDMap(3); LLSDMap llsdSimInfo = new LLSDMap(3);
@ -66,11 +75,7 @@ namespace OpenSim.Region.Environment
LLSDMap llsdBody = new LLSDMap(1); LLSDMap llsdBody = new LLSDMap(1);
llsdBody.Add("SimulatorInfo", arr); llsdBody.Add("SimulatorInfo", arr);
LLSDMap llsdMessage = new LLSDMap(2); return buildEvent("EnableSimulator", llsdBody);
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
} }
public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt, public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
@ -110,28 +115,40 @@ namespace OpenSim.Region.Environment
LLSDArray RegionDataArr = new LLSDArray(1); LLSDArray RegionDataArr = new LLSDArray(1);
RegionDataArr.Add(RegionDataMap); RegionDataArr.Add(RegionDataMap);
LLSDMap llsdBody = new LLSDMap(3); LLSDMap llsdBody = new LLSDMap(3);
llsdBody.Add("Info", InfoArr); llsdBody.Add("Info", InfoArr);
llsdBody.Add("AgentData", AgentDataArr); llsdBody.Add("AgentData", AgentDataArr);
llsdBody.Add("RegionData", RegionDataArr); llsdBody.Add("RegionData", RegionDataArr);
LLSDMap llsdMessage = new LLSDMap(2); return buildEvent("CrossedRegion", llsdBody);
llsdMessage.Add("message", new LLSDString("CrossedRegion"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
} }
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() public static LLSD KeepAliveEvent()
{ {
LLSDMap llsdSimInfo = new LLSDMap(); return buildEvent("FAKEEVENT", new LLSDMap());
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("FAKEEVENT"));
llsdMessage.Add("body", llsdSimInfo);
return llsdMessage;
} }
} }
} }

View File

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