aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorHomer Horwitz2008-09-28 14:19:26 +0000
committerHomer Horwitz2008-09-28 14:19:26 +0000
commit1cc927ad97beaf1d2554392b3975c54145f4387e (patch)
tree6756cbcf76987074ddc5558c7d1de05d504d5174 /OpenSim/Region
parentRefactor to avoid some duplicate code. (diff)
downloadopensim-SC_OLD-1cc927ad97beaf1d2554392b3975c54145f4387e.zip
opensim-SC_OLD-1cc927ad97beaf1d2554392b3975c54145f4387e.tar.gz
opensim-SC_OLD-1cc927ad97beaf1d2554392b3975c54145f4387e.tar.bz2
opensim-SC_OLD-1cc927ad97beaf1d2554392b3975c54145f4387e.tar.xz
- 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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs71
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs15
2 files changed, 57 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
index 41a03d9..93ee4f8 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment
35 public class EventQueueHelper 35 public class EventQueueHelper
36 { 36 {
37 private EventQueueHelper() {} // no construction possible, it's an utility class 37 private EventQueueHelper() {} // no construction possible, it's an utility class
38 38
39 private static byte[] regionHandleToByteArray(ulong regionHandle) 39 private static byte[] regionHandleToByteArray(ulong regionHandle)
40 { 40 {
41 // Reverse endianness of RegionHandle 41 // Reverse endianness of RegionHandle
@@ -51,31 +51,36 @@ namespace OpenSim.Region.Environment
51 (byte)(regionHandle % 256) 51 (byte)(regionHandle % 256)
52 }; 52 };
53 } 53 }
54 54
55 private static LLSD buildEvent(string eventName, LLSD eventBody)
56 {
57 LLSDMap llsdEvent = new LLSDMap(2);
58 llsdEvent.Add("message", new LLSDString(eventName));
59 llsdEvent.Add("body", eventBody);
60
61 return llsdEvent;
62 }
63
55 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint) 64 public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
56 { 65 {
57 LLSDMap llsdSimInfo = new LLSDMap(3); 66 LLSDMap llsdSimInfo = new LLSDMap(3);
58 67
59 llsdSimInfo.Add("Handle", new LLSDBinary(regionHandleToByteArray(Handle))); 68 llsdSimInfo.Add("Handle", new LLSDBinary(regionHandleToByteArray(Handle)));
60 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes())); 69 llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
61 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port)); 70 llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
62 71
63 LLSDArray arr = new LLSDArray(1); 72 LLSDArray arr = new LLSDArray(1);
64 arr.Add(llsdSimInfo); 73 arr.Add(llsdSimInfo);
65 74
66 LLSDMap llsdBody = new LLSDMap(1); 75 LLSDMap llsdBody = new LLSDMap(1);
67 llsdBody.Add("SimulatorInfo", arr); 76 llsdBody.Add("SimulatorInfo", arr);
68 77
69 LLSDMap llsdMessage = new LLSDMap(2); 78 return buildEvent("EnableSimulator", llsdBody);
70 llsdMessage.Add("message", new LLSDString("EnableSimulator"));
71 llsdMessage.Add("body", llsdBody);
72
73 return llsdMessage;
74 } 79 }
75 80
76 public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt, 81 public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
77 IPEndPoint newRegionExternalEndPoint, 82 IPEndPoint newRegionExternalEndPoint,
78 string capsURL, UUID AgentID, UUID SessionID) 83 string capsURL, UUID AgentID, UUID SessionID)
79 { 84 {
80 LLSDArray LookAtArr = new LLSDArray(3); 85 LLSDArray LookAtArr = new LLSDArray(3);
81 LookAtArr.Add(LLSD.FromReal(lookAt.X)); 86 LookAtArr.Add(LLSD.FromReal(lookAt.X));
@@ -110,28 +115,40 @@ namespace OpenSim.Region.Environment
110 LLSDArray RegionDataArr = new LLSDArray(1); 115 LLSDArray RegionDataArr = new LLSDArray(1);
111 RegionDataArr.Add(RegionDataMap); 116 RegionDataArr.Add(RegionDataMap);
112 117
113
114
115
116 LLSDMap llsdBody = new LLSDMap(3); 118 LLSDMap llsdBody = new LLSDMap(3);
117 llsdBody.Add("Info", InfoArr); 119 llsdBody.Add("Info", InfoArr);
118 llsdBody.Add("AgentData", AgentDataArr); 120 llsdBody.Add("AgentData", AgentDataArr);
119 llsdBody.Add("RegionData", RegionDataArr); 121 llsdBody.Add("RegionData", RegionDataArr);
120 122
121 LLSDMap llsdMessage = new LLSDMap(2); 123 return buildEvent("CrossedRegion", llsdBody);
122 llsdMessage.Add("message", new LLSDString("CrossedRegion")); 124 }
123 llsdMessage.Add("body", llsdBody);
124 125
125 return llsdMessage; 126 public static LLSD TeleportFinishEvent(
127 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
128 uint locationID, uint flags, string capsURL, UUID AgentID)
129 {
130 LLSDMap info = new LLSDMap();
131 info.Add("AgentID", LLSD.FromUUID(AgentID));
132 info.Add("LocationID", LLSD.FromInteger(4)); // TODO what is this?
133 info.Add("RegionHandle", LLSD.FromBinary(regionHandleToByteArray(regionHandle)));
134 info.Add("SeedCapability", LLSD.FromString(capsURL));
135 info.Add("SimAccess", LLSD.FromInteger(simAccess));
136 info.Add("SimIP", LLSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
137 info.Add("SimPort", LLSD.FromInteger(regionExternalEndPoint.Port));
138 info.Add("TeleportFlags", LLSD.FromBinary(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
139
140 LLSDArray infoArr = new LLSDArray();
141 infoArr.Add(info);
142
143 LLSDMap body = new LLSDMap();
144 body.Add("Info", infoArr);
145
146 return buildEvent("TeleportFinish", body);
126 } 147 }
148
127 public static LLSD KeepAliveEvent() 149 public static LLSD KeepAliveEvent()
128 { 150 {
129 LLSDMap llsdSimInfo = new LLSDMap(); 151 return buildEvent("FAKEEVENT", new LLSDMap());
130 LLSDMap llsdMessage = new LLSDMap(2);
131 llsdMessage.Add("message", new LLSDString("FAKEEVENT"));
132 llsdMessage.Add("body", llsdSimInfo);
133
134 return llsdMessage;
135 } 152 }
136 } 153 }
137} 154}
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index a340fe2..3f3a68d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -687,8 +687,19 @@ namespace OpenSim.Region.Environment.Scenes
687 m_log.DebugFormat( 687 m_log.DebugFormat(
688 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 688 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
689 689
690 avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, teleportFlags, 690 IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>();
691 capsPath); 691 if (eq != null)
692 {
693 LLSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, reg.ExternalEndPoint,
694 4, teleportFlags, capsPath, avatar.UUID);
695 eq.Enqueue(Item, avatar.UUID);
696 }
697 else
698 {
699 avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4,
700 teleportFlags, capsPath);
701 }
702
692 avatar.MakeChildAgent(); 703 avatar.MakeChildAgent();
693 Thread.Sleep(5000); 704 Thread.Sleep(5000);
694 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle); 705 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle);