diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 644 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 8e85559..8831791 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -10,6 +10,7 @@ | |||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> | 11 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> |
12 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | 12 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> |
13 | <RegionModule id="RegionCombinerModule" type="OpenSim.Region.CoreModules.World.Land.RegionCombinerModule" /> | ||
13 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> | 14 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> |
14 | <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" /> | 15 | <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" /> |
15 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> | 16 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index c917840..5c2e136 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -549,6 +549,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
549 | int x; | 549 | int x; |
550 | int y; | 550 | int y; |
551 | 551 | ||
552 | if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) | ||
553 | return null; | ||
552 | try | 554 | try |
553 | { | 555 | { |
554 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); | 556 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); |
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs new file mode 100644 index 0000000..381d5ec --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs | |||
@@ -0,0 +1,641 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | using log4net; | ||
5 | using Nini.Config; | ||
6 | using OpenMetaverse; | ||
7 | using OpenSim.Framework; | ||
8 | using OpenSim.Region.Framework.Interfaces; | ||
9 | using OpenSim.Region.Framework.Scenes; | ||
10 | |||
11 | namespace OpenSim.Region.CoreModules.World.Land | ||
12 | { | ||
13 | public class RegionCombinerModule : ISharedRegionModule | ||
14 | { | ||
15 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
16 | |||
17 | public string Name { get { return "RegionCombinerModule"; } } | ||
18 | public Type ReplaceableInterface | ||
19 | { | ||
20 | get { return null; } | ||
21 | } | ||
22 | |||
23 | public Type ReplacableInterface { get { return null; } } | ||
24 | |||
25 | private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>(); | ||
26 | private bool enabledYN = false; | ||
27 | public void Initialise(IConfigSource source) | ||
28 | { | ||
29 | IConfig myConfig = source.Configs["Startup"]; | ||
30 | enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); | ||
31 | |||
32 | } | ||
33 | |||
34 | public void Close() | ||
35 | { | ||
36 | |||
37 | } | ||
38 | |||
39 | public void AddRegion(Scene scene) | ||
40 | { | ||
41 | if (!enabledYN) | ||
42 | return; | ||
43 | |||
44 | RegionConnections regionConnections = new RegionConnections(); | ||
45 | regionConnections.ConnectedRegions = new List<RegionData>(); | ||
46 | regionConnections.RegionScene = scene; | ||
47 | regionConnections.RegionLandChannel = scene.LandChannel; | ||
48 | regionConnections.RegionId = scene.RegionInfo.originRegionID; | ||
49 | regionConnections.X = scene.RegionInfo.RegionLocX; | ||
50 | regionConnections.Y = scene.RegionInfo.RegionLocY; | ||
51 | regionConnections.XEnd = (int)Constants.RegionSize; | ||
52 | regionConnections.YEnd = (int)Constants.RegionSize; | ||
53 | lock (m_regions) | ||
54 | { | ||
55 | bool connectedYN = false; | ||
56 | |||
57 | foreach (RegionConnections conn in m_regions.Values) | ||
58 | { | ||
59 | #region commented | ||
60 | /* | ||
61 | // If we're one region over +x +y | ||
62 | //xxy | ||
63 | //xxx | ||
64 | //xxx | ||
65 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd | ||
66 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
67 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
68 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
69 | { | ||
70 | Vector3 offset = Vector3.Zero; | ||
71 | offset.X = (((regionConnections.X * (int) Constants.RegionSize)) - | ||
72 | ((conn.X * (int) Constants.RegionSize))); | ||
73 | offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) - | ||
74 | ((conn.Y * (int) Constants.RegionSize))); | ||
75 | |||
76 | Vector3 extents = Vector3.Zero; | ||
77 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
78 | extents.X = conn.XEnd + conn.XEnd; | ||
79 | |||
80 | m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}", | ||
81 | conn.RegionScene.RegionInfo.RegionName, | ||
82 | regionConnections.RegionScene.RegionInfo.RegionName, | ||
83 | offset, extents); | ||
84 | |||
85 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
86 | |||
87 | connectedYN = true; | ||
88 | break; | ||
89 | } | ||
90 | */ | ||
91 | |||
92 | /* | ||
93 | //If we're one region over x +y | ||
94 | //xxx | ||
95 | //xxx | ||
96 | //xyx | ||
97 | if ((((int)conn.X * (int)Constants.RegionSize) | ||
98 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
99 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
100 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
101 | { | ||
102 | Vector3 offset = Vector3.Zero; | ||
103 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
104 | ((conn.X * (int)Constants.RegionSize))); | ||
105 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
106 | ((conn.Y * (int)Constants.RegionSize))); | ||
107 | |||
108 | Vector3 extents = Vector3.Zero; | ||
109 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
110 | extents.X = conn.XEnd; | ||
111 | |||
112 | m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}", | ||
113 | conn.RegionScene.RegionInfo.RegionName, | ||
114 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
115 | |||
116 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
117 | connectedYN = true; | ||
118 | break; | ||
119 | } | ||
120 | */ | ||
121 | |||
122 | /* | ||
123 | // If we're one region over -x +y | ||
124 | //xxx | ||
125 | //xxx | ||
126 | //yxx | ||
127 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
128 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
129 | && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd | ||
130 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
131 | { | ||
132 | Vector3 offset = Vector3.Zero; | ||
133 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
134 | ((conn.X * (int)Constants.RegionSize))); | ||
135 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
136 | ((conn.Y * (int)Constants.RegionSize))); | ||
137 | |||
138 | Vector3 extents = Vector3.Zero; | ||
139 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
140 | extents.X = conn.XEnd + conn.XEnd; | ||
141 | |||
142 | m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}", | ||
143 | conn.RegionScene.RegionInfo.RegionName, | ||
144 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
145 | |||
146 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
147 | |||
148 | |||
149 | connectedYN = true; | ||
150 | break; | ||
151 | } | ||
152 | */ | ||
153 | |||
154 | /* | ||
155 | // If we're one region over -x y | ||
156 | //xxx | ||
157 | //yxx | ||
158 | //xxx | ||
159 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
160 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
161 | && (((int)conn.Y * (int)Constants.RegionSize) | ||
162 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
163 | { | ||
164 | Vector3 offset = Vector3.Zero; | ||
165 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
166 | ((conn.X * (int)Constants.RegionSize))); | ||
167 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
168 | ((conn.Y * (int)Constants.RegionSize))); | ||
169 | |||
170 | Vector3 extents = Vector3.Zero; | ||
171 | extents.Y = regionConnections.YEnd; | ||
172 | extents.X = conn.XEnd + conn.XEnd; | ||
173 | |||
174 | m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}", | ||
175 | conn.RegionScene.RegionInfo.RegionName, | ||
176 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
177 | |||
178 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
179 | |||
180 | connectedYN = true; | ||
181 | break; | ||
182 | } | ||
183 | */ | ||
184 | |||
185 | /* | ||
186 | // If we're one region over -x -y | ||
187 | //yxx | ||
188 | //xxx | ||
189 | //xxx | ||
190 | if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd | ||
191 | == (regionConnections.X * (int)Constants.RegionSize)) | ||
192 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | ||
193 | == (regionConnections.Y * (int)Constants.RegionSize))) | ||
194 | { | ||
195 | Vector3 offset = Vector3.Zero; | ||
196 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
197 | ((conn.X * (int)Constants.RegionSize))); | ||
198 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
199 | ((conn.Y * (int)Constants.RegionSize))); | ||
200 | |||
201 | Vector3 extents = Vector3.Zero; | ||
202 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
203 | extents.X = conn.XEnd + conn.XEnd; | ||
204 | |||
205 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | ||
206 | conn.RegionScene.RegionInfo.RegionName, | ||
207 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
208 | |||
209 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); | ||
210 | |||
211 | connectedYN = true; | ||
212 | break; | ||
213 | } | ||
214 | */ | ||
215 | #endregion | ||
216 | |||
217 | // If we're one region over +x y | ||
218 | //xxx | ||
219 | //xxy | ||
220 | //xxx | ||
221 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd | ||
222 | >= (regionConnections.X * (int)Constants.RegionSize)) | ||
223 | && (((int)conn.Y * (int)Constants.RegionSize) | ||
224 | >= (regionConnections.Y * (int)Constants.RegionSize))) | ||
225 | { | ||
226 | Vector3 offset = Vector3.Zero; | ||
227 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
228 | ((conn.X * (int)Constants.RegionSize))); | ||
229 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
230 | ((conn.Y * (int)Constants.RegionSize))); | ||
231 | |||
232 | Vector3 extents = Vector3.Zero; | ||
233 | extents.Y = conn.YEnd; | ||
234 | extents.X = conn.XEnd + regionConnections.XEnd; | ||
235 | |||
236 | conn.UpdateExtents(extents); | ||
237 | |||
238 | |||
239 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", | ||
240 | conn.RegionScene.RegionInfo.RegionName, | ||
241 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
242 | |||
243 | |||
244 | scene.BordersLocked = true; | ||
245 | conn.RegionScene.BordersLocked = true; | ||
246 | |||
247 | RegionData ConnectedRegion = new RegionData(); | ||
248 | ConnectedRegion.Offset = offset; | ||
249 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
250 | ConnectedRegion.RegionScene = scene; | ||
251 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
252 | |||
253 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | ||
254 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
255 | |||
256 | lock (conn.RegionScene.EastBorders) | ||
257 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
258 | |||
259 | lock (conn.RegionScene.NorthBorders) | ||
260 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
261 | |||
262 | lock (conn.RegionScene.SouthBorders) | ||
263 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
264 | |||
265 | lock (scene.WestBorders) | ||
266 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | ||
267 | |||
268 | // Reset Terrain.. since terrain normally loads first. | ||
269 | // | ||
270 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
271 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
272 | |||
273 | conn.RegionScene.BordersLocked = false; | ||
274 | scene.BordersLocked = false; | ||
275 | connectedYN = true; | ||
276 | break; | ||
277 | } | ||
278 | |||
279 | |||
280 | |||
281 | // If we're one region over x +y | ||
282 | //xyx | ||
283 | //xxx | ||
284 | //xxx | ||
285 | if ((((int)conn.X * (int)Constants.RegionSize) | ||
286 | >= (regionConnections.X * (int)Constants.RegionSize)) | ||
287 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | ||
288 | >= (regionConnections.Y * (int)Constants.RegionSize))) | ||
289 | { | ||
290 | Vector3 offset = Vector3.Zero; | ||
291 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
292 | ((conn.X * (int)Constants.RegionSize))); | ||
293 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
294 | ((conn.Y * (int)Constants.RegionSize))); | ||
295 | |||
296 | Vector3 extents = Vector3.Zero; | ||
297 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
298 | extents.X = conn.XEnd; | ||
299 | conn.UpdateExtents(extents); | ||
300 | |||
301 | |||
302 | scene.BordersLocked = true; | ||
303 | conn.RegionScene.BordersLocked = true; | ||
304 | |||
305 | RegionData ConnectedRegion = new RegionData(); | ||
306 | ConnectedRegion.Offset = offset; | ||
307 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
308 | ConnectedRegion.RegionScene = scene; | ||
309 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
310 | |||
311 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | ||
312 | conn.RegionScene.RegionInfo.RegionName, | ||
313 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
314 | conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); | ||
315 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
316 | |||
317 | lock(conn.RegionScene.NorthBorders) | ||
318 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
319 | lock(conn.RegionScene.EastBorders) | ||
320 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
321 | lock(conn.RegionScene.WestBorders) | ||
322 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
323 | lock(scene.SouthBorders) | ||
324 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | ||
325 | |||
326 | // Reset Terrain.. since terrain normally loads first. | ||
327 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
328 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
329 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
330 | |||
331 | scene.BordersLocked = false; | ||
332 | conn.RegionScene.BordersLocked = false; | ||
333 | |||
334 | connectedYN = true; | ||
335 | break; | ||
336 | } | ||
337 | |||
338 | // If we're one region over +x +y | ||
339 | //xxy | ||
340 | //xxx | ||
341 | //xxx | ||
342 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd | ||
343 | >= (regionConnections.X * (int)Constants.RegionSize)) | ||
344 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | ||
345 | >= (regionConnections.Y * (int)Constants.RegionSize))) | ||
346 | { | ||
347 | Vector3 offset = Vector3.Zero; | ||
348 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | ||
349 | ((conn.X * (int)Constants.RegionSize))); | ||
350 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | ||
351 | ((conn.Y * (int)Constants.RegionSize))); | ||
352 | |||
353 | Vector3 extents = Vector3.Zero; | ||
354 | extents.Y = regionConnections.YEnd + conn.YEnd; | ||
355 | extents.X = regionConnections.XEnd + conn.XEnd; | ||
356 | conn.UpdateExtents(extents); | ||
357 | |||
358 | scene.BordersLocked = true; | ||
359 | conn.RegionScene.BordersLocked = true; | ||
360 | |||
361 | RegionData ConnectedRegion = new RegionData(); | ||
362 | ConnectedRegion.Offset = offset; | ||
363 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
364 | ConnectedRegion.RegionScene = scene; | ||
365 | |||
366 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
367 | |||
368 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", | ||
369 | conn.RegionScene.RegionInfo.RegionName, | ||
370 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | ||
371 | |||
372 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | ||
373 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | ||
374 | lock(conn.RegionScene.NorthBorders) | ||
375 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) | ||
376 | { | ||
377 | //compound border | ||
378 | // already locked above | ||
379 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
380 | |||
381 | lock(conn.RegionScene.EastBorders) | ||
382 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
383 | lock(conn.RegionScene.WestBorders) | ||
384 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
385 | |||
386 | |||
387 | |||
388 | } | ||
389 | lock(scene.SouthBorders) | ||
390 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | ||
391 | |||
392 | lock(conn.RegionScene.EastBorders) | ||
393 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | ||
394 | { | ||
395 | |||
396 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
397 | lock(conn.RegionScene.NorthBorders) | ||
398 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
399 | lock(conn.RegionScene.SouthBorders) | ||
400 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
401 | |||
402 | |||
403 | } | ||
404 | |||
405 | lock (scene.WestBorders) | ||
406 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | ||
407 | /* | ||
408 | else | ||
409 | { | ||
410 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
411 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
412 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
413 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | ||
414 | } | ||
415 | */ | ||
416 | |||
417 | |||
418 | // Reset Terrain.. since terrain normally loads first. | ||
419 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
420 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
421 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | ||
422 | scene.BordersLocked = false; | ||
423 | conn.RegionScene.BordersLocked = false; | ||
424 | |||
425 | connectedYN = true; | ||
426 | |||
427 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | ||
428 | |||
429 | break; | ||
430 | } | ||
431 | |||
432 | |||
433 | } | ||
434 | if (!connectedYN) | ||
435 | { | ||
436 | RegionData rdata = new RegionData(); | ||
437 | rdata.Offset = Vector3.Zero; | ||
438 | rdata.RegionId = scene.RegionInfo.originRegionID; | ||
439 | rdata.RegionScene = scene; | ||
440 | regionConnections.RegionLandChannel = scene.LandChannel; | ||
441 | |||
442 | LargeLandChannel lnd = new LargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); | ||
443 | scene.LandChannel = lnd; | ||
444 | |||
445 | m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); | ||
446 | } | ||
447 | |||
448 | } | ||
449 | } | ||
450 | |||
451 | public void RemoveRegion(Scene scene) | ||
452 | { | ||
453 | |||
454 | } | ||
455 | |||
456 | public void RegionLoaded(Scene scene) | ||
457 | { | ||
458 | |||
459 | } | ||
460 | |||
461 | public void PostInitialise() | ||
462 | { | ||
463 | |||
464 | } | ||
465 | public void OnFrame() | ||
466 | { | ||
467 | |||
468 | } | ||
469 | |||
470 | |||
471 | public RegionData GetRegionFromPosition(Vector3 pPosition) | ||
472 | { | ||
473 | pPosition = pPosition/(int) Constants.RegionSize; | ||
474 | int OffsetX = (int) pPosition.X; | ||
475 | int OffsetY = (int) pPosition.Y; | ||
476 | foreach (RegionConnections regConn in m_regions.Values) | ||
477 | { | ||
478 | foreach (RegionData reg in regConn.ConnectedRegions) | ||
479 | { | ||
480 | if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) | ||
481 | return reg; | ||
482 | } | ||
483 | } | ||
484 | return new RegionData(); | ||
485 | } | ||
486 | } | ||
487 | public class RegionConnections | ||
488 | { | ||
489 | public UUID RegionId; | ||
490 | public Scene RegionScene; | ||
491 | public ILandChannel RegionLandChannel; | ||
492 | public uint X; | ||
493 | public uint Y; | ||
494 | public int XEnd; | ||
495 | public int YEnd; | ||
496 | public List<RegionData> ConnectedRegions; | ||
497 | public void UpdateExtents(Vector3 extents) | ||
498 | { | ||
499 | XEnd = (int)extents.X; | ||
500 | YEnd = (int)extents.Y; | ||
501 | } | ||
502 | |||
503 | } | ||
504 | |||
505 | public class RegionData | ||
506 | { | ||
507 | public UUID RegionId; | ||
508 | public Scene RegionScene; | ||
509 | public Vector3 Offset; | ||
510 | |||
511 | } | ||
512 | |||
513 | public class LargeLandChannel : ILandChannel | ||
514 | { | ||
515 | private static readonly ILog m_log = | ||
516 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
517 | private RegionData RegData; | ||
518 | private ILandChannel RootRegionLandChannel; | ||
519 | private readonly List<RegionData> RegionConnections; | ||
520 | |||
521 | #region ILandChannel Members | ||
522 | |||
523 | public LargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,List<RegionData> regionConnections) | ||
524 | { | ||
525 | RegData = regData; | ||
526 | RootRegionLandChannel = rootRegionLandChannel; | ||
527 | RegionConnections = regionConnections; | ||
528 | } | ||
529 | |||
530 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | ||
531 | { | ||
532 | //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position); | ||
533 | return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset); | ||
534 | } | ||
535 | |||
536 | public List<ILandObject> AllParcels() | ||
537 | { | ||
538 | |||
539 | return RootRegionLandChannel.AllParcels(); | ||
540 | |||
541 | } | ||
542 | |||
543 | public ILandObject GetLandObject(int x, int y) | ||
544 | { | ||
545 | //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); | ||
546 | |||
547 | if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
548 | { | ||
549 | return RootRegionLandChannel.GetLandObject(x, y); | ||
550 | } | ||
551 | else | ||
552 | { | ||
553 | int offsetX = (x / (int)Constants.RegionSize); | ||
554 | int offsetY = (x / (int)Constants.RegionSize); | ||
555 | offsetX *= (int)Constants.RegionSize; | ||
556 | offsetY *= (int)Constants.RegionSize; | ||
557 | |||
558 | foreach (RegionData regionData in RegionConnections) | ||
559 | { | ||
560 | if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
561 | { | ||
562 | return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
563 | } | ||
564 | } | ||
565 | ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
566 | obj.landData.Name = "NO LAND"; | ||
567 | return obj; | ||
568 | } | ||
569 | } | ||
570 | |||
571 | public ILandObject GetLandObject(int localID) | ||
572 | { | ||
573 | return RootRegionLandChannel.GetLandObject(localID); | ||
574 | } | ||
575 | |||
576 | public ILandObject GetLandObject(float x, float y) | ||
577 | { | ||
578 | //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y); | ||
579 | |||
580 | if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
581 | { | ||
582 | return RootRegionLandChannel.GetLandObject(x, y); | ||
583 | } | ||
584 | else | ||
585 | { | ||
586 | int offsetX = (int)(x/(int) Constants.RegionSize); | ||
587 | int offsetY = (int)(x/(int) Constants.RegionSize); | ||
588 | offsetX *= (int) Constants.RegionSize; | ||
589 | offsetY *= (int) Constants.RegionSize; | ||
590 | |||
591 | foreach (RegionData regionData in RegionConnections) | ||
592 | { | ||
593 | if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
594 | { | ||
595 | return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
596 | } | ||
597 | } | ||
598 | ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
599 | obj.landData.Name = "NO LAND"; | ||
600 | return obj; | ||
601 | } | ||
602 | } | ||
603 | |||
604 | public bool IsLandPrimCountTainted() | ||
605 | { | ||
606 | return RootRegionLandChannel.IsLandPrimCountTainted(); | ||
607 | } | ||
608 | |||
609 | public bool IsForcefulBansAllowed() | ||
610 | { | ||
611 | return RootRegionLandChannel.IsForcefulBansAllowed(); | ||
612 | } | ||
613 | |||
614 | public void UpdateLandObject(int localID, LandData data) | ||
615 | { | ||
616 | RootRegionLandChannel.UpdateLandObject(localID, data); | ||
617 | } | ||
618 | |||
619 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | ||
620 | { | ||
621 | RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); | ||
622 | } | ||
623 | |||
624 | public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) | ||
625 | { | ||
626 | RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel); | ||
627 | } | ||
628 | |||
629 | public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) | ||
630 | { | ||
631 | RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel); | ||
632 | } | ||
633 | |||
634 | public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | ||
635 | { | ||
636 | RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime); | ||
637 | } | ||
638 | |||
639 | #endregion | ||
640 | } | ||
641 | } | ||