From 93206ef0fa6dffe93313455b3354ce3787e7262d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Mar 2013 00:39:03 +0000
Subject: Add "show borders" command to show the borders of a region.
This is relevant to mega-regions where the borders are very different to a regular region.
Also adds some method doc and other code comments.
---
.../EntityTransfer/EntityTransferModule.cs | 4 +++
OpenSim/Region/Framework/Scenes/Border.cs | 7 +++--
OpenSim/Region/Framework/Scenes/Scene.cs | 1 -
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++++++---
.../World/SceneCommands/SceneCommandsModule.cs | 31 ++++++++++++++++++++++
.../RegionCombinerModule/RegionCombinerModule.cs | 8 +++---
6 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 26267e2..136caad 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -994,6 +994,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
Scene scene = agent.Scene;
Vector3 pos = agent.AbsolutePosition;
+
+// m_log.DebugFormat(
+// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
+
Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
uint neighbourx = scene.RegionInfo.RegionLocX;
uint neighboury = scene.RegionInfo.RegionLocY;
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index c6a6511..08c0c31 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -33,8 +33,7 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes
{
public class Border
- {
-
+ {
///
/// Line perpendicular to the Direction Cardinal. Z value is the
///
@@ -81,6 +80,10 @@ namespace OpenSim.Region.Framework.Scenes
TriggerRegionY = triggerRegionY;
}
+ ///
+ /// Tests to see if the given position would cross this border.
+ ///
+ ///
public bool TestCross(Vector3 position)
{
bool result = false;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c9c0662..e8f00a4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2541,7 +2541,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
-
return null;
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6d96c93..f7ae3a2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -442,9 +442,9 @@ namespace OpenSim.Region.Framework.Scenes
{
m_pos = PhysicsActor.Position;
- //m_log.DebugFormat(
- // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
- // m_pos, Name, Scene.RegionInfo.RegionName);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Set position of {0} in {1} to {2} via getting AbsolutePosition!",
+// Name, Scene.Name, m_pos);
}
else
{
@@ -471,6 +471,9 @@ namespace OpenSim.Region.Framework.Scenes
}
set
{
+// m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} in {1} to {2}", Name, Scene.Name, value);
+// Util.PrintCallStack();
+
if (PhysicsActor != null)
{
try
@@ -878,6 +881,7 @@ namespace OpenSim.Region.Framework.Scenes
// before the inventory is processed in MakeRootAgent. This fixes a race condition
// related to the handling of attachments
//m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
+
if (m_scene.TestBorderCross(pos, Cardinals.E))
{
Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
@@ -2909,6 +2913,10 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsInTransit)
{
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}",
+// pos2, Name, Scene.Name);
+
// Checks if where it's headed exists a region
bool needsTransit = false;
if (m_scene.TestBorderCross(pos2, Cardinals.W))
diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
index 5fb74b0..29b39e0 100644
--- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
+++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
@@ -116,6 +116,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
+ "If teleport is true then some extra teleport debug information is logged.\n"
+ "If updates is true then any frame which exceeds double the maximum desired frame time is logged.",
HandleDebugSceneSetCommand);
+
+ scene.AddCommand(
+ "Regions",
+ this, "show borders", "show borders", "Show border information for regions", HandleShowBordersCommand);
+ }
+
+ private void HandleShowBordersCommand(string module, string[] args)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.AppendFormat("Borders for {0}:\n", m_scene.Name);
+
+ ConsoleDisplayTable cdt = new ConsoleDisplayTable();
+ cdt.AddColumn("Cross Direction", 15);
+ cdt.AddColumn("Line", 34);
+ cdt.AddColumn("Trigger Region", 14);
+
+ foreach (Border b in m_scene.NorthBorders)
+ cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));
+
+ foreach (Border b in m_scene.EastBorders)
+ cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));
+
+ foreach (Border b in m_scene.SouthBorders)
+ cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));
+
+ foreach (Border b in m_scene.WestBorders)
+ cdt.AddRow(b.CrossDirection, b.BorderLine, string.Format("{0}, {1}", b.TriggerRegionX, b.TriggerRegionY));
+
+ cdt.AddToStringBuilder(sb);
+
+ MainConsole.Instance.Output(sb.ToString());
}
private void HandleDebugSceneGetCommand(string module, string[] args)
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 905540d..7127c73 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -415,18 +415,17 @@ namespace OpenSim.Region.RegionCombinerModule
*/
#endregion
- // If we're one region over +x y
+ // If we're one region over +x y (i.e. root region is to the west)
//xxx
//xxy
//xxx
-
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
{
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
break;
}
- // If we're one region over x +y
+ // If we're one region over x +y (i.e. root region is to the south)
//xyx
//xxx
//xxx
@@ -436,7 +435,7 @@ namespace OpenSim.Region.RegionCombinerModule
break;
}
- // If we're one region over +x +y
+ // If we're one region over +x +y (i.e. root region is to the south-west)
//xxy
//xxx
//xxx
@@ -646,7 +645,6 @@ namespace OpenSim.Region.RegionCombinerModule
{
if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
{
-
rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
lock (rootConn.RegionScene.NorthBorders)
--
cgit v1.1