diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | 67 |
2 files changed, 66 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 563773a..70733fc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -138,15 +138,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
138 | 138 | ||
139 | public void PostInitialise() | 139 | public void PostInitialise() |
140 | { | 140 | { |
141 | // FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector | ||
142 | // will have instantiated us directly. | ||
143 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", | ||
144 | "show neighbours", | ||
145 | "Shows the local region neighbours", HandleShowNeighboursCommand); | ||
146 | |||
147 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show regionsinview", | ||
148 | "show regionsinview", | ||
149 | "Shows regions that can be seen from a region", HandleShowRegionsInViewCommand); | ||
150 | } | 141 | } |
151 | 142 | ||
152 | public void Close() | 143 | public void Close() |
@@ -304,69 +295,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
304 | 295 | ||
305 | #endregion | 296 | #endregion |
306 | 297 | ||
307 | public void HandleShowNeighboursCommand(string module, string[] cmdparams) | ||
308 | { | ||
309 | if(!m_Enabled || m_scenes.Count == 0) | ||
310 | return; | ||
311 | |||
312 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | ||
313 | |||
314 | List<Scene> scenes; | ||
315 | lock (m_scenes) | ||
316 | scenes = new List<Scene>(m_scenes); | ||
317 | |||
318 | foreach (Scene s in scenes) | ||
319 | { | ||
320 | RegionInfo sr = s.RegionInfo; | ||
321 | caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", sr.RegionName, sr.RegionID); | ||
322 | List<GridRegion> regions = GetNeighbours(sr.ScopeID, sr.RegionID); | ||
323 | foreach (GridRegion r in regions) | ||
324 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY)); | ||
325 | } | ||
326 | |||
327 | MainConsole.Instance.Output(caps.ToString()); | ||
328 | |||
329 | } | ||
330 | |||
331 | public void HandleShowRegionsInViewCommand(string module, string[] cmdparams) | ||
332 | { | ||
333 | if(!m_Enabled || m_scenes.Count == 0) | ||
334 | return; | ||
335 | |||
336 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | ||
337 | |||
338 | List<Scene> scenes; | ||
339 | lock (m_scenes) | ||
340 | scenes = new List<Scene>(m_scenes); | ||
341 | |||
342 | foreach (Scene s in scenes) | ||
343 | { | ||
344 | int maxview = (int)s.MaxRegionViewDistance; | ||
345 | RegionInfo sr = s.RegionInfo; | ||
346 | caps.AppendFormat("*** Regions that can be seen from {0} ({1}) (MaxRegionViewDistance {2}m) ***\n", sr.RegionName, sr.RegionID, maxview); | ||
347 | int startX = (int)sr.WorldLocX; | ||
348 | int endX = startX + (int)sr.RegionSizeX; | ||
349 | int startY = (int)sr.WorldLocY; | ||
350 | int endY = startY + (int)sr.RegionSizeY; | ||
351 | startX -= maxview; | ||
352 | if(startX < 0 ) | ||
353 | startX = 0; | ||
354 | startY -= maxview; | ||
355 | if(startY < 0) | ||
356 | startY = 0; | ||
357 | endX += maxview; | ||
358 | endY += maxview; | ||
359 | |||
360 | List<GridRegion> regions = GetRegionRange(sr.ScopeID, startX, endX, startY, endY); | ||
361 | foreach (GridRegion r in regions) | ||
362 | { | ||
363 | if(r.RegionHandle == sr.RegionHandle) | ||
364 | continue; | ||
365 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY)); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | MainConsole.Instance.Output(caps.ToString()); | ||
370 | } | ||
371 | } | 298 | } |
372 | } | 299 | } |
diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index b9bcb8b..411c4d6 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Console; | |||
40 | using OpenSim.Framework.Monitoring; | 40 | using OpenSim.Framework.Monitoring; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
43 | 44 | ||
44 | namespace OpenSim.Region.CoreModules.World.Objects.Commands | 45 | namespace OpenSim.Region.CoreModules.World.Objects.Commands |
45 | { | 46 | { |
@@ -107,6 +108,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
107 | + "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this." | 108 | + "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this." |
108 | + " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.", | 109 | + " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.", |
109 | HandleRegionSet); | 110 | HandleRegionSet); |
111 | |||
112 | m_console.Commands.AddCommand("Regions", false, "show neighbours", | ||
113 | "show neighbours", | ||
114 | "Shows the local region neighbours", HandleShowNeighboursCommand); | ||
115 | |||
116 | m_console.Commands.AddCommand("Regions", false, "show regionsinview", | ||
117 | "show regionsinview", | ||
118 | "Shows regions that can be seen from a region", HandleShowRegionsInViewCommand); | ||
119 | |||
110 | } | 120 | } |
111 | 121 | ||
112 | public void RemoveRegion(Scene scene) | 122 | public void RemoveRegion(Scene scene) |
@@ -309,5 +319,60 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
309 | 319 | ||
310 | MainConsole.Instance.Output(sb.ToString()); | 320 | MainConsole.Instance.Output(sb.ToString()); |
311 | } | 321 | } |
322 | |||
323 | public void HandleShowNeighboursCommand(string module, string[] cmdparams) | ||
324 | { | ||
325 | if(m_scene == null) | ||
326 | return; | ||
327 | |||
328 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
329 | return; | ||
330 | |||
331 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | ||
332 | |||
333 | RegionInfo sr = m_scene.RegionInfo; | ||
334 | caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", sr.RegionName, sr.RegionID); | ||
335 | List<GridRegion> regions = m_scene.GridService.GetNeighbours(sr.ScopeID, sr.RegionID); | ||
336 | foreach (GridRegion r in regions) | ||
337 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY)); | ||
338 | |||
339 | MainConsole.Instance.Output(caps.ToString()); | ||
340 | } | ||
341 | |||
342 | public void HandleShowRegionsInViewCommand(string module, string[] cmdparams) | ||
343 | { | ||
344 | if(m_scene == null) | ||
345 | return; | ||
346 | |||
347 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
348 | return; | ||
349 | |||
350 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | ||
351 | int maxview = (int)m_scene.MaxRegionViewDistance; | ||
352 | RegionInfo sr = m_scene.RegionInfo; | ||
353 | caps.AppendFormat("*** Regions that can be seen from {0} ({1}) (MaxRegionViewDistance {2}m) ***\n", sr.RegionName, sr.RegionID, maxview); | ||
354 | int startX = (int)sr.WorldLocX; | ||
355 | int endX = startX + (int)sr.RegionSizeX; | ||
356 | int startY = (int)sr.WorldLocY; | ||
357 | int endY = startY + (int)sr.RegionSizeY; | ||
358 | startX -= maxview; | ||
359 | if(startX < 0 ) | ||
360 | startX = 0; | ||
361 | startY -= maxview; | ||
362 | if(startY < 0) | ||
363 | startY = 0; | ||
364 | endX += maxview; | ||
365 | endY += maxview; | ||
366 | |||
367 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(sr.ScopeID, startX, endX, startY, endY); | ||
368 | foreach (GridRegion r in regions) | ||
369 | { | ||
370 | if(r.RegionHandle == sr.RegionHandle) | ||
371 | continue; | ||
372 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY)); | ||
373 | } | ||
374 | |||
375 | MainConsole.Instance.Output(caps.ToString()); | ||
376 | } | ||
312 | } | 377 | } |
313 | } \ No newline at end of file | 378 | } |