diff options
author | UbitUmarov | 2016-09-05 14:26:52 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-05 14:26:52 +0100 |
commit | 4f80c525096c9dcbf743a07f78af19f12d3eece5 (patch) | |
tree | 0a14d695900c28ab693926ec03dcbc566e81795f | |
parent | fix console comand Show Neighbours and enable it (diff) | |
download | opensim-SC-4f80c525096c9dcbf743a07f78af19f12d3eece5.zip opensim-SC-4f80c525096c9dcbf743a07f78af19f12d3eece5.tar.gz opensim-SC-4f80c525096c9dcbf743a07f78af19f12d3eece5.tar.bz2 opensim-SC-4f80c525096c9dcbf743a07f78af19f12d3eece5.tar.xz |
add console comand show regionsinview lists the regions that can be seen from a region so may also get child agents from it
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index e740fe8..1271561 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -142,7 +142,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
142 | // will have instantiated us directly. | 142 | // will have instantiated us directly. |
143 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", | 143 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", |
144 | "show neighbours", | 144 | "show neighbours", |
145 | "Shows the local regions' neighbours", HandleShowNeighboursCommand); | 145 | "Shows the local region neighbours", HandleShowNeighboursCommand); |
146 | |||
147 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show regionsinview", | ||
148 | "show regions that can be seen", | ||
149 | "Shows regions that can be seen from a region", HandleShowRegionsInViewCommand); | ||
146 | } | 150 | } |
147 | 151 | ||
148 | public void Close() | 152 | public void Close() |
@@ -323,5 +327,46 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
323 | MainConsole.Instance.Output(caps.ToString()); | 327 | MainConsole.Instance.Output(caps.ToString()); |
324 | 328 | ||
325 | } | 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}) view {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 | } | ||
326 | } | 371 | } |
327 | } | 372 | } |