From 4f80c525096c9dcbf743a07f78af19f12d3eece5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 5 Sep 2016 14:26:52 +0100 Subject: add console comand show regionsinview lists the regions that can be seen from a region so may also get child agents from it --- .../Grid/LocalGridServiceConnector.cs | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') 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 // will have instantiated us directly. MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", "show neighbours", - "Shows the local regions' neighbours", HandleShowNeighboursCommand); + "Shows the local region neighbours", HandleShowNeighboursCommand); + + MainConsole.Instance.Commands.AddCommand("Regions", false, "show regionsinview", + "show regions that can be seen", + "Shows regions that can be seen from a region", HandleShowRegionsInViewCommand); } public void Close() @@ -323,5 +327,46 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MainConsole.Instance.Output(caps.ToString()); } + + public void HandleShowRegionsInViewCommand(string module, string[] cmdparams) + { + if(!m_Enabled || m_scenes.Count == 0) + return; + + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + + List scenes; + lock (m_scenes) + scenes = new List(m_scenes); + + foreach (Scene s in scenes) + { + int maxview = (int)s.MaxRegionViewDistance; + RegionInfo sr = s.RegionInfo; + caps.AppendFormat("*** Regions that can be seen from {0} ({1}) view {2}m ***\n", sr.RegionName, sr.RegionID, maxview); + int startX = (int)sr.WorldLocX; + int endX = startX + (int)sr.RegionSizeX; + int startY = (int)sr.WorldLocY; + int endY = startY + (int)sr.RegionSizeY; + startX -= maxview; + if(startX < 0 ) + startX = 0; + startY -= maxview; + if(startY < 0) + startY = 0; + endX += maxview; + endY += maxview; + + List regions = GetRegionRange(sr.ScopeID, startX, endX, startY, endY); + foreach (GridRegion r in regions) + { + if(r.RegionHandle == sr.RegionHandle) + continue; + caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY)); + } + } + + MainConsole.Instance.Output(caps.ToString()); + } } } -- cgit v1.1