aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs74
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
4 files changed, 95 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index a6e3859..4e03e95 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -14,7 +14,10 @@ namespace OpenSim.Region.CoreModules.World.Land
14 { 14 {
15 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 15 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
16 16
17 public string Name { get { return "RegionCombinerModule"; } } 17 public string Name { get
18 {
19 return "RegionCombinerModule";
20 } }
18 public Type ReplaceableInterface 21 public Type ReplaceableInterface
19 { 22 {
20 get { return null; } 23 get { return null; }
@@ -22,11 +25,15 @@ namespace OpenSim.Region.CoreModules.World.Land
22 25
23 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>(); 26 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
24 private bool enabledYN = false; 27 private bool enabledYN = false;
28 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
29
25 public void Initialise(IConfigSource source) 30 public void Initialise(IConfigSource source)
26 { 31 {
32
27 IConfig myConfig = source.Configs["Startup"]; 33 IConfig myConfig = source.Configs["Startup"];
28 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); 34 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
29 //enabledYN = true; 35 //enabledYN = true;
36
30 } 37 }
31 38
32 public void Close() 39 public void Close()
@@ -36,9 +43,13 @@ namespace OpenSim.Region.CoreModules.World.Land
36 43
37 public void AddRegion(Scene scene) 44 public void AddRegion(Scene scene)
38 { 45 {
46
39 if (!enabledYN) 47 if (!enabledYN)
40 return; 48 return;
41 49
50 lock (m_startingScenes)
51 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
52
42 Border northBorder = new Border(); 53 Border northBorder = new Border();
43 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- 54 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
44 northBorder.CrossDirection = Cardinals.N; 55 northBorder.CrossDirection = Cardinals.N;
@@ -464,11 +475,13 @@ namespace OpenSim.Region.CoreModules.World.Land
464 } 475 }
465 476
466 } 477 }
478
467 } 479 }
468 480
469 public void RemoveRegion(Scene scene) 481 public void RemoveRegion(Scene scene)
470 { 482 {
471 483
484
472 } 485 }
473 486
474 public void RegionLoaded(Scene scene) 487 public void RegionLoaded(Scene scene)
@@ -480,9 +493,62 @@ namespace OpenSim.Region.CoreModules.World.Land
480 { 493 {
481 494
482 } 495 }
483 public void OnFrame() 496
497 // Create a set of infinite borders around the whole aabb of the combined island.
498 private void MakeLargeRegionBounds()
484 { 499 {
485 500 lock (m_regions)
501 {
502 foreach (RegionConnections rconn in m_regions.Values)
503 {
504 Vector3 offset = Vector3.Zero;
505 rconn.RegionScene.BordersLocked = true;
506 foreach (RegionData rdata in rconn.ConnectedRegions)
507 {
508 if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
509 if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
510
511 }
512
513 lock (rconn.RegionScene.NorthBorders)
514 {
515 Border northBorder = new Border();
516 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
517 offset.Y); //<---
518 northBorder.CrossDirection = Cardinals.N;
519 rconn.RegionScene.NorthBorders.Add(northBorder);
520 }
521
522 lock (rconn.RegionScene.SouthBorders)
523 {
524 Border southBorder = new Border();
525 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
526 southBorder.CrossDirection = Cardinals.S;
527 rconn.RegionScene.SouthBorders.Add(southBorder);
528 }
529
530 lock (rconn.RegionScene.EastBorders)
531 {
532 Border eastBorder = new Border();
533 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y);
534 //<---
535 eastBorder.CrossDirection = Cardinals.E;
536 rconn.RegionScene.EastBorders.Add(eastBorder);
537 }
538
539 lock (rconn.RegionScene.WestBorders)
540 {
541 Border westBorder = new Border();
542 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
543 westBorder.CrossDirection = Cardinals.W;
544 rconn.RegionScene.WestBorders.Add(westBorder);
545 }
546
547
548
549 rconn.RegionScene.BordersLocked = false;
550 }
551 }
486 } 552 }
487 553
488 554
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b8c8f32..f4a0d2e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1710,7 +1710,12 @@ namespace OpenSim.Region.Framework.Scenes
1710 int thisx = (int)RegionInfo.RegionLocX; 1710 int thisx = (int)RegionInfo.RegionLocX;
1711 int thisy = (int)RegionInfo.RegionLocY; 1711 int thisy = (int)RegionInfo.RegionLocY;
1712 1712
1713 ulong newRegionHandle = 0; 1713
1714 // use this if no borders were crossed!
1715 ulong newRegionHandle
1716 = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize),
1717 (uint)((thisy) * Constants.RegionSize));
1718
1714 Vector3 pos = attemptedPosition; 1719 Vector3 pos = attemptedPosition;
1715 1720
1716 if (TestBorderCross(attemptedPosition, Cardinals.W)) 1721 if (TestBorderCross(attemptedPosition, Cardinals.W))
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e5c6bf1..d72ed7d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1477,8 +1477,26 @@ namespace OpenSim.Region.Framework.Scenes
1477 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1477 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
1478 dupe.m_isBackedUp = false; 1478 dupe.m_isBackedUp = false;
1479 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); 1479 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
1480
1481 // Warning, The following code related to previousAttachmentStatus is needed so that clones of
1482 // attachments do not bordercross while they're being duplicated. This is hacktastic!
1483 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
1484 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
1485 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
1486 // then restore it's attachment state
1487
1488 // This is only necessary when userExposed is false!
1489
1490 bool previousAttachmentStatus = dupe.RootPart.IsAttachment;
1491
1492 if (!userExposed)
1493 dupe.RootPart.IsAttachment = true;
1494
1480 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1495 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1481 1496
1497 if (!userExposed)
1498 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1499
1482 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1500 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1483 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1501 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1484 1502
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 46e3289..857dc11 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3509,8 +3509,8 @@ namespace OpenSim.Region.Framework.Scenes
3509 { 3509 {
3510 // Set the parent localID to 0 so it transfers over properly. 3510 // Set the parent localID to 0 so it transfers over properly.
3511 gobj.RootPart.SetParentLocalId(0); 3511 gobj.RootPart.SetParentLocalId(0);
3512 gobj.RootPart.IsAttachment = false;
3513 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 3512 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3513 gobj.RootPart.IsAttachment = false;
3514 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 3514 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3515 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); 3515 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
3516 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); 3516 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);