diff options
author | Justin Clark-Casey (justincc) | 2009-09-07 18:26:53 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-07 18:26:53 +0100 |
commit | 116933bee5adfa4a3c1815fb7f3866bdaa584c41 (patch) | |
tree | b1aaf689ad7c9ef07e495e94d64f5978a1d5c9c3 /OpenSim/Region/CoreModules | |
parent | T012_EstateSettingsRandomStorage() which wasn't being run because the method ... (diff) | |
parent | Merge branch 'master' of ssh://MyConnection/var/git/opensim (diff) | |
download | opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.zip opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.gz opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.bz2 opensim-SC-116933bee5adfa4a3c1815fb7f3866bdaa584c41.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
4 files changed, 413 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index a5894c6..613dbe9 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | 40 | using OpenSim.Framework.Communications.Services; |
@@ -115,6 +116,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
115 | 116 | ||
116 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); | 117 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); |
117 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); | 118 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); |
119 | httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); | ||
120 | httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); | ||
118 | 121 | ||
119 | } | 122 | } |
120 | } | 123 | } |
@@ -256,5 +259,64 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
256 | scene = null; | 259 | scene = null; |
257 | return false; | 260 | return false; |
258 | } | 261 | } |
262 | |||
263 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
264 | { | ||
265 | XmlRpcResponse response = new XmlRpcResponse(); | ||
266 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
267 | AvatarAppearance appearance; | ||
268 | Hashtable responseData; | ||
269 | if (requestData.Contains("owner")) | ||
270 | { | ||
271 | appearance = m_firstScene.CommsManager.AvatarService.GetUserAppearance(new UUID((string)requestData["owner"])); | ||
272 | if (appearance == null) | ||
273 | { | ||
274 | responseData = new Hashtable(); | ||
275 | responseData["error_type"] = "no appearance"; | ||
276 | responseData["error_desc"] = "There was no appearance found for this avatar"; | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | responseData = appearance.ToHashTable(); | ||
281 | } | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | responseData = new Hashtable(); | ||
286 | responseData["error_type"] = "unknown_avatar"; | ||
287 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
288 | } | ||
289 | |||
290 | response.Value = responseData; | ||
291 | return response; | ||
292 | } | ||
293 | |||
294 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
295 | { | ||
296 | XmlRpcResponse response = new XmlRpcResponse(); | ||
297 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
298 | Hashtable responseData; | ||
299 | if (requestData.Contains("owner")) | ||
300 | { | ||
301 | AvatarAppearance appearance = new AvatarAppearance(requestData); | ||
302 | |||
303 | // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when | ||
304 | // the TextureEntry is null. When that happens, this check can be removed | ||
305 | if (appearance.Texture != null) | ||
306 | m_firstScene.CommsManager.AvatarService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | ||
307 | |||
308 | responseData = new Hashtable(); | ||
309 | responseData["returnString"] = "TRUE"; | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | responseData = new Hashtable(); | ||
314 | responseData["error_type"] = "unknown_avatar"; | ||
315 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
316 | } | ||
317 | response.Value = responseData; | ||
318 | return response; | ||
319 | } | ||
259 | } | 320 | } |
321 | |||
260 | } | 322 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs index fcd0304..cca5bb4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
42 | LogManager.GetLogger( | 42 | LogManager.GetLogger( |
43 | MethodBase.GetCurrentMethod().DeclaringType); | 43 | MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private IUserAccountDataService m_UserService; | 45 | private IUserAccountService m_UserService; |
46 | 46 | ||
47 | private bool m_Enabled = false; | 47 | private bool m_Enabled = false; |
48 | 48 | ||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
82 | 82 | ||
83 | Object[] args = new Object[] { source }; | 83 | Object[] args = new Object[] { source }; |
84 | m_UserService = | 84 | m_UserService = |
85 | ServerUtils.LoadPlugin<IUserAccountDataService>(serviceDll, | 85 | ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, |
86 | args); | 86 | args); |
87 | 87 | ||
88 | if (m_UserService == null) | 88 | if (m_UserService == null) |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
113 | if (!m_Enabled) | 113 | if (!m_Enabled) |
114 | return; | 114 | return; |
115 | 115 | ||
116 | scene.RegisterModuleInterface<IUserAccountDataService>(m_UserService); | 116 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); |
117 | } | 117 | } |
118 | 118 | ||
119 | public void RemoveRegion(Scene scene) | 119 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs index a2b854b..cef9129 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Services.Connectors; | |||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | 37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User |
38 | { | 38 | { |
39 | public class RemoteUserServicesConnector : UserServicesConnector, | 39 | public class RemoteUserServicesConnector : UserServicesConnector, |
40 | ISharedRegionModule, IUserAccountDataService | 40 | ISharedRegionModule, IUserAccountService |
41 | { | 41 | { |
42 | private static readonly ILog m_log = | 42 | private static readonly ILog m_log = |
43 | LogManager.GetLogger( | 43 | LogManager.GetLogger( |
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | |||
96 | if (!m_Enabled) | 96 | if (!m_Enabled) |
97 | return; | 97 | return; |
98 | 98 | ||
99 | scene.RegisterModuleInterface<IUserAccountDataService>(this); | 99 | scene.RegisterModuleInterface<IUserAccountService>(this); |
100 | } | 100 | } |
101 | 101 | ||
102 | public void RemoveRegion(Scene scene) | 102 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index 5c5f164..9da869c 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Client; | ||
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | 38 | ||
@@ -71,6 +72,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
71 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
72 | { | 73 | { |
73 | 74 | ||
75 | |||
76 | |||
77 | } | ||
78 | |||
79 | public void RemoveRegion(Scene scene) | ||
80 | { | ||
81 | |||
82 | |||
83 | } | ||
84 | |||
85 | public void RegionLoaded(Scene scene) | ||
86 | { | ||
74 | if (!enabledYN) | 87 | if (!enabledYN) |
75 | return; | 88 | return; |
76 | 89 | ||
@@ -295,8 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
295 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", | 308 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", |
296 | conn.RegionScene.RegionInfo.RegionName, | 309 | conn.RegionScene.RegionInfo.RegionName, |
297 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 310 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
298 | 311 | ||
299 | 312 | ||
300 | scene.BordersLocked = true; | 313 | scene.BordersLocked = true; |
301 | conn.RegionScene.BordersLocked = true; | 314 | conn.RegionScene.BordersLocked = true; |
302 | 315 | ||
@@ -325,9 +338,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
325 | // | 338 | // |
326 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 339 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
327 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 340 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
328 | 341 | ||
329 | conn.RegionScene.BordersLocked = false; | 342 | conn.RegionScene.BordersLocked = false; |
330 | scene.BordersLocked = false; | 343 | scene.BordersLocked = false; |
344 | if (conn.ClientEventForwarder != null) | ||
345 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
331 | connectedYN = true; | 346 | connectedYN = true; |
332 | break; | 347 | break; |
333 | } | 348 | } |
@@ -367,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
367 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | 382 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", |
368 | conn.RegionScene.RegionInfo.RegionName, | 383 | conn.RegionScene.RegionInfo.RegionName, |
369 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 384 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
370 | conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); | 385 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
371 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 386 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
372 | 387 | ||
373 | lock (conn.RegionScene.NorthBorders) | 388 | lock (conn.RegionScene.NorthBorders) |
@@ -386,7 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | 401 | ||
387 | scene.BordersLocked = false; | 402 | scene.BordersLocked = false; |
388 | conn.RegionScene.BordersLocked = false; | 403 | conn.RegionScene.BordersLocked = false; |
389 | 404 | if (conn.ClientEventForwarder != null) | |
405 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
390 | connectedYN = true; | 406 | connectedYN = true; |
391 | break; | 407 | break; |
392 | } | 408 | } |
@@ -424,52 +440,52 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
424 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", | 440 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", |
425 | conn.RegionScene.RegionInfo.RegionName, | 441 | conn.RegionScene.RegionInfo.RegionName, |
426 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 442 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
427 | 443 | ||
428 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 444 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
429 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 445 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
430 | lock (conn.RegionScene.NorthBorders) | 446 | lock (conn.RegionScene.NorthBorders) |
431 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) | 447 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) |
432 | { | 448 | { |
433 | //compound border | 449 | //compound border |
434 | // already locked above | 450 | // already locked above |
435 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 451 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
436 | 452 | ||
437 | lock (conn.RegionScene.EastBorders) | 453 | lock (conn.RegionScene.EastBorders) |
438 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 454 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
439 | lock (conn.RegionScene.WestBorders) | 455 | lock (conn.RegionScene.WestBorders) |
440 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 456 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
441 | 457 | ||
442 | |||
443 | 458 | ||
444 | } | 459 | |
460 | } | ||
445 | lock (scene.SouthBorders) | 461 | lock (scene.SouthBorders) |
446 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 462 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south |
447 | 463 | ||
448 | lock (conn.RegionScene.EastBorders) | 464 | lock (conn.RegionScene.EastBorders) |
449 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | 465 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) |
450 | { | 466 | { |
451 | 467 | ||
452 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 468 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
453 | lock (conn.RegionScene.NorthBorders) | 469 | lock (conn.RegionScene.NorthBorders) |
454 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 470 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
455 | lock (conn.RegionScene.SouthBorders) | 471 | lock (conn.RegionScene.SouthBorders) |
456 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 472 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
457 | 473 | ||
458 | 474 | ||
459 | } | 475 | } |
460 | 476 | ||
461 | lock (scene.WestBorders) | 477 | lock (scene.WestBorders) |
462 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | 478 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West |
463 | /* | 479 | /* |
464 | else | 480 | else |
465 | { | 481 | { |
466 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 482 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
467 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 483 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
468 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 484 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
469 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 485 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south |
470 | } | 486 | } |
471 | */ | 487 | */ |
472 | 488 | ||
473 | 489 | ||
474 | // Reset Terrain.. since terrain normally loads first. | 490 | // Reset Terrain.. since terrain normally loads first. |
475 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 491 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
@@ -478,6 +494,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
478 | scene.BordersLocked = false; | 494 | scene.BordersLocked = false; |
479 | conn.RegionScene.BordersLocked = false; | 495 | conn.RegionScene.BordersLocked = false; |
480 | 496 | ||
497 | if (conn.ClientEventForwarder != null) | ||
498 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
499 | |||
481 | connectedYN = true; | 500 | connectedYN = true; |
482 | 501 | ||
483 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | 502 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); |
@@ -495,7 +514,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
495 | rdata.RegionScene = scene; | 514 | rdata.RegionScene = scene; |
496 | regionConnections.RegionLandChannel = scene.LandChannel; | 515 | regionConnections.RegionLandChannel = scene.LandChannel; |
497 | 516 | ||
498 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); | 517 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, |
518 | regionConnections.ConnectedRegions); | ||
499 | scene.LandChannel = lnd; | 519 | scene.LandChannel = lnd; |
500 | lock (m_regions) | 520 | lock (m_regions) |
501 | { | 521 | { |
@@ -504,24 +524,157 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
504 | ForwardPermissionRequests(regionConnections, r.RegionScene); | 524 | ForwardPermissionRequests(regionConnections, r.RegionScene); |
505 | } | 525 | } |
506 | } | 526 | } |
507 | 527 | ||
508 | m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); | 528 | regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); |
529 | scene.EventManager.OnNewPresence += SetCourseLocationDelegate; | ||
530 | m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); | ||
531 | |||
509 | } | 532 | } |
510 | 533 | ||
511 | } | 534 | } |
512 | AdjustLargeRegionBounds(); | 535 | AdjustLargeRegionBounds(); |
513 | |||
514 | } | 536 | } |
515 | 537 | ||
516 | public void RemoveRegion(Scene scene) | 538 | private void SetCourseLocationDelegate(ScenePresence presence) |
517 | { | 539 | { |
518 | 540 | presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); | |
519 | |||
520 | } | 541 | } |
521 | 542 | ||
522 | public void RegionLoaded(Scene scene) | 543 | private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence) |
523 | { | 544 | { |
545 | RegionConnections connectiondata = null; | ||
546 | lock (m_regions) | ||
547 | { | ||
548 | if (m_regions.ContainsKey(sceneId)) | ||
549 | connectiondata = m_regions[sceneId]; | ||
550 | else | ||
551 | return; | ||
552 | } | ||
553 | |||
554 | List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars(); | ||
555 | List<Vector3> CoarseLocations = new List<Vector3>(); | ||
556 | List<UUID> AvatarUUIDs = new List<UUID>(); | ||
557 | for (int i = 0; i < avatars.Count; i++) | ||
558 | { | ||
559 | if (avatars[i].UUID != presence.UUID) | ||
560 | { | ||
561 | if (avatars[i].ParentID != 0) | ||
562 | { | ||
563 | // sitting avatar | ||
564 | SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); | ||
565 | if (sop != null) | ||
566 | { | ||
567 | CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); | ||
568 | AvatarUUIDs.Add(avatars[i].UUID); | ||
569 | } | ||
570 | else | ||
571 | { | ||
572 | // we can't find the parent.. ! arg! | ||
573 | CoarseLocations.Add(avatars[i].AbsolutePosition); | ||
574 | AvatarUUIDs.Add(avatars[i].UUID); | ||
575 | } | ||
576 | } | ||
577 | else | ||
578 | { | ||
579 | CoarseLocations.Add(avatars[i].AbsolutePosition); | ||
580 | AvatarUUIDs.Add(avatars[i].UUID); | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); | ||
585 | } | ||
586 | |||
587 | private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids, | ||
588 | RegionConnections connectiondata, ScenePresence rootPresence) | ||
589 | { | ||
590 | RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); | ||
591 | List<IClientAPI> clients = new List<IClientAPI>(); | ||
592 | Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>(); | ||
524 | 593 | ||
594 | |||
595 | // Root Region entry | ||
596 | RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct(); | ||
597 | rootupdatedata.Locations = new List<Vector3>(); | ||
598 | rootupdatedata.Uuids = new List<UUID>(); | ||
599 | rootupdatedata.Offset = Vector2.Zero; | ||
600 | |||
601 | rootupdatedata.UserAPI = rootPresence.ControllingClient; | ||
602 | |||
603 | if (rootupdatedata.UserAPI != null) | ||
604 | updates.Add(Vector2.Zero, rootupdatedata); | ||
605 | |||
606 | //Each Region needs an entry or we will end up with dead minimap dots | ||
607 | foreach (RegionData regiondata in rdata) | ||
608 | { | ||
609 | Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y); | ||
610 | RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); | ||
611 | updatedata.Locations = new List<Vector3>(); | ||
612 | updatedata.Uuids = new List<UUID>(); | ||
613 | updatedata.Offset = offset; | ||
614 | |||
615 | if (offset == Vector2.Zero) | ||
616 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
617 | else | ||
618 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
619 | |||
620 | if (updatedata.UserAPI != null) | ||
621 | updates.Add(offset, updatedata); | ||
622 | } | ||
623 | |||
624 | // go over the locations and assign them to an IClientAPI | ||
625 | for (int i = 0; i < locations.Count;i++ ) | ||
626 | //{locations[i]/(int) Constants.RegionSize; | ||
627 | { | ||
628 | Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize, | ||
629 | (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z); | ||
630 | Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize, | ||
631 | pPosition.Y*(int) Constants.RegionSize); | ||
632 | |||
633 | if (!updates.ContainsKey(offset)) | ||
634 | { | ||
635 | // This shouldn't happen | ||
636 | RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); | ||
637 | updatedata.Locations = new List<Vector3>(); | ||
638 | updatedata.Uuids = new List<UUID>(); | ||
639 | updatedata.Offset = offset; | ||
640 | |||
641 | if (offset == Vector2.Zero) | ||
642 | updatedata.UserAPI = rootPresence.ControllingClient; | ||
643 | else | ||
644 | updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata); | ||
645 | |||
646 | updates.Add(offset,updatedata); | ||
647 | |||
648 | } | ||
649 | |||
650 | updates[offset].Locations.Add(locations[i]); | ||
651 | updates[offset].Uuids.Add(uuids[i]); | ||
652 | |||
653 | } | ||
654 | |||
655 | // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is | ||
656 | foreach (Vector2 offset in updates.Keys) | ||
657 | { | ||
658 | if (updates[offset].UserAPI != null) | ||
659 | { | ||
660 | updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations); | ||
661 | } | ||
662 | } | ||
663 | |||
664 | } | ||
665 | |||
666 | private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata) | ||
667 | { | ||
668 | IClientAPI returnclient = null; | ||
669 | foreach (RegionData r in rdata) | ||
670 | { | ||
671 | if (r.Offset.X == offset.X && r.Offset.Y == offset.Y) | ||
672 | { | ||
673 | return r.RegionScene.SceneGraph.GetControllingClient(uUID); | ||
674 | } | ||
675 | } | ||
676 | |||
677 | return returnclient; | ||
525 | } | 678 | } |
526 | 679 | ||
527 | public void PostInitialise() | 680 | public void PostInitialise() |
@@ -529,6 +682,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
529 | 682 | ||
530 | } | 683 | } |
531 | 684 | ||
685 | |||
686 | |||
532 | public void UnCombineRegion(RegionData rdata) | 687 | public void UnCombineRegion(RegionData rdata) |
533 | { | 688 | { |
534 | lock (m_regions) | 689 | lock (m_regions) |
@@ -733,6 +888,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
733 | public int YEnd; | 888 | public int YEnd; |
734 | public List<RegionData> ConnectedRegions; | 889 | public List<RegionData> ConnectedRegions; |
735 | public RegionCombinerPermissionModule PermissionModule; | 890 | public RegionCombinerPermissionModule PermissionModule; |
891 | public RegionCombinerClientEventForwarder ClientEventForwarder; | ||
736 | public void UpdateExtents(Vector3 extents) | 892 | public void UpdateExtents(Vector3 extents) |
737 | { | 893 | { |
738 | XEnd = (int)extents.X; | 894 | XEnd = (int)extents.X; |
@@ -748,6 +904,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
748 | public Vector3 Offset; | 904 | public Vector3 Offset; |
749 | 905 | ||
750 | } | 906 | } |
907 | struct RegionCourseLocationStruct | ||
908 | { | ||
909 | public List<Vector3> Locations; | ||
910 | public List<UUID> Uuids; | ||
911 | public IClientAPI UserAPI; | ||
912 | public Vector2 Offset; | ||
913 | } | ||
751 | 914 | ||
752 | public class RegionCombinerLargeLandChannel : ILandChannel | 915 | public class RegionCombinerLargeLandChannel : ILandChannel |
753 | { | 916 | { |
@@ -759,7 +922,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
759 | 922 | ||
760 | #region ILandChannel Members | 923 | #region ILandChannel Members |
761 | 924 | ||
762 | public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,List<RegionData> regionConnections) | 925 | public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel, |
926 | List<RegionData> regionConnections) | ||
763 | { | 927 | { |
764 | RegData = regData; | 928 | RegData = regData; |
765 | RootRegionLandChannel = rootRegionLandChannel; | 929 | RootRegionLandChannel = rootRegionLandChannel; |
@@ -790,7 +954,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
790 | else | 954 | else |
791 | { | 955 | { |
792 | int offsetX = (x / (int)Constants.RegionSize); | 956 | int offsetX = (x / (int)Constants.RegionSize); |
793 | int offsetY = (x / (int)Constants.RegionSize); | 957 | int offsetY = (y / (int)Constants.RegionSize); |
794 | offsetX *= (int)Constants.RegionSize; | 958 | offsetX *= (int)Constants.RegionSize; |
795 | offsetY *= (int)Constants.RegionSize; | 959 | offsetY *= (int)Constants.RegionSize; |
796 | 960 | ||
@@ -823,7 +987,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
823 | else | 987 | else |
824 | { | 988 | { |
825 | int offsetX = (int)(x/(int) Constants.RegionSize); | 989 | int offsetX = (int)(x/(int) Constants.RegionSize); |
826 | int offsetY = (int)(x/(int) Constants.RegionSize); | 990 | int offsetY = (int)(y/(int) Constants.RegionSize); |
827 | offsetX *= (int) Constants.RegionSize; | 991 | offsetX *= (int) Constants.RegionSize; |
828 | offsetY *= (int) Constants.RegionSize; | 992 | offsetY *= (int) Constants.RegionSize; |
829 | 993 | ||
@@ -886,6 +1050,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
886 | m_rootScene = RootScene; | 1050 | m_rootScene = RootScene; |
887 | } | 1051 | } |
888 | 1052 | ||
1053 | #region Permission Override | ||
889 | public bool BypassPermissions() | 1054 | public bool BypassPermissions() |
890 | { | 1055 | { |
891 | return m_rootScene.Permissions.BypassPermissions(); | 1056 | return m_rootScene.Permissions.BypassPermissions(); |
@@ -1110,5 +1275,137 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1110 | { | 1275 | { |
1111 | return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); | 1276 | return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist); |
1112 | } | 1277 | } |
1278 | #endregion | ||
1279 | } | ||
1280 | |||
1281 | public class RegionCombinerClientEventForwarder | ||
1282 | { | ||
1283 | private Scene m_rootScene; | ||
1284 | private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>(); | ||
1285 | private Dictionary<UUID,RegionCombinerModuleIndividualForwarder> m_forwarders = new Dictionary<UUID, | ||
1286 | RegionCombinerModuleIndividualForwarder>(); | ||
1287 | public RegionCombinerClientEventForwarder(RegionConnections rootScene) | ||
1288 | { | ||
1289 | m_rootScene = rootScene.RegionScene; | ||
1290 | |||
1291 | |||
1292 | } | ||
1293 | |||
1294 | public void AddSceneToEventForwarding( Scene virtualScene ) | ||
1295 | { | ||
1296 | lock (m_virtScene) | ||
1297 | { | ||
1298 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1299 | { | ||
1300 | m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene; | ||
1301 | } | ||
1302 | else | ||
1303 | { | ||
1304 | m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene); | ||
1305 | } | ||
1306 | } | ||
1307 | |||
1308 | lock (m_forwarders) | ||
1309 | { | ||
1310 | // TODO: Fix this to unregister if this happens | ||
1311 | if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1312 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
1313 | |||
1314 | RegionCombinerModuleIndividualForwarder forwarder = | ||
1315 | new RegionCombinerModuleIndividualForwarder(m_rootScene, virtualScene); | ||
1316 | m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder); | ||
1317 | |||
1318 | virtualScene.EventManager.OnNewClient += forwarder.ClientConnect; | ||
1319 | virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed; | ||
1320 | } | ||
1321 | } | ||
1322 | |||
1323 | public void RemoveSceneFromEventForwarding (Scene virtualScene) | ||
1324 | { | ||
1325 | lock (m_forwarders) | ||
1326 | { | ||
1327 | RegionCombinerModuleIndividualForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID]; | ||
1328 | virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect; | ||
1329 | virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed; | ||
1330 | m_forwarders.Remove(virtualScene.RegionInfo.originRegionID); | ||
1331 | } | ||
1332 | lock (m_virtScene) | ||
1333 | { | ||
1334 | if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID)) | ||
1335 | { | ||
1336 | m_virtScene.Remove(virtualScene.RegionInfo.originRegionID); | ||
1337 | } | ||
1338 | } | ||
1339 | } | ||
1340 | } | ||
1341 | |||
1342 | public class RegionCombinerModuleIndividualForwarder | ||
1343 | { | ||
1344 | private Scene m_rootScene; | ||
1345 | private Scene m_virtScene; | ||
1346 | public RegionCombinerModuleIndividualForwarder(Scene rootScene, Scene virtScene) | ||
1347 | { | ||
1348 | m_rootScene = rootScene; | ||
1349 | m_virtScene = virtScene; | ||
1350 | } | ||
1351 | |||
1352 | public void ClientConnect(IClientAPI client) | ||
1353 | { | ||
1354 | |||
1355 | m_virtScene.UnSubscribeToClientPrimEvents(client); | ||
1356 | m_virtScene.UnSubscribeToClientPrimRezEvents(client); | ||
1357 | m_virtScene.UnSubscribeToClientInventoryEvents(client); | ||
1358 | m_virtScene.UnSubscribeToClientAttachmentEvents(client); | ||
1359 | m_virtScene.UnSubscribeToClientTeleportEvents(client); | ||
1360 | m_virtScene.UnSubscribeToClientScriptEvents(client); | ||
1361 | m_virtScene.UnSubscribeToClientGodEvents(client); | ||
1362 | m_virtScene.UnSubscribeToClientNetworkEvents(client); | ||
1363 | |||
1364 | m_rootScene.SubscribeToClientPrimEvents(client); | ||
1365 | client.OnAddPrim += LocalAddNewPrim; | ||
1366 | client.OnRezObject += LocalRezObject; | ||
1367 | m_rootScene.SubscribeToClientInventoryEvents(client); | ||
1368 | m_rootScene.SubscribeToClientAttachmentEvents(client); | ||
1369 | m_rootScene.SubscribeToClientTeleportEvents(client); | ||
1370 | m_rootScene.SubscribeToClientScriptEvents(client); | ||
1371 | m_rootScene.SubscribeToClientGodEvents(client); | ||
1372 | m_rootScene.SubscribeToClientNetworkEvents(client); | ||
1373 | } | ||
1374 | public void ClientClosed(UUID clientid, Scene scene) | ||
1375 | { | ||
1376 | |||
1377 | } | ||
1378 | |||
1379 | |||
1380 | private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, | ||
1381 | UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, | ||
1382 | UUID fromtaskid) | ||
1383 | { | ||
1384 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
1385 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
1386 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
1387 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
1388 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
1389 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
1390 | |||
1391 | m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast, | ||
1392 | rayendisintersection, rezselected, removeitem, fromtaskid); | ||
1393 | |||
1394 | } | ||
1395 | |||
1396 | private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot, | ||
1397 | PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid, | ||
1398 | byte rayendisintersection) | ||
1399 | { | ||
1400 | int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; | ||
1401 | int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; | ||
1402 | rayend.X += differenceX * (int)Constants.RegionSize; | ||
1403 | rayend.Y += differenceY * (int)Constants.RegionSize; | ||
1404 | raystart.X += differenceX * (int)Constants.RegionSize; | ||
1405 | raystart.Y += differenceY * (int)Constants.RegionSize; | ||
1406 | m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid, | ||
1407 | rayendisintersection); | ||
1408 | |||
1409 | } | ||
1113 | } | 1410 | } |
1114 | } | 1411 | } |