Add "show region at" command to grid service to get the details of a region at a specific location. "show region" command becomes "show region name" to disambiguate
This is the same format as used by "show object name", etc. "deregister region" also becomes "deregister region id"0.7.3-extended
parent
03fc8cf155
commit
02fe1a676e
|
@ -85,19 +85,26 @@ namespace OpenSim.Services.GridService
|
|||
if (MainConsole.Instance != null)
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"deregister region",
|
||||
"deregister region <Region UUID>",
|
||||
"deregister region id",
|
||||
"deregister region id <Region UUID>",
|
||||
"Deregister a region manually.",
|
||||
String.Empty,
|
||||
HandleDeregisterRegion);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"show region",
|
||||
"show region <Region name>",
|
||||
"show region name",
|
||||
"show region name <Region name>",
|
||||
"Show details on a region",
|
||||
String.Empty,
|
||||
HandleShowRegion);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"show region at",
|
||||
"show region at <x-coord> <y-coord>",
|
||||
"Show details on a region at the given co-ordinate.",
|
||||
"For example, show region at 1000 1000",
|
||||
HandleShowRegionAt);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"set region flags",
|
||||
"set region flags <Region name> <flags>",
|
||||
|
@ -504,13 +511,13 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
private void HandleDeregisterRegion(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 3)
|
||||
if (cmd.Length != 4)
|
||||
{
|
||||
MainConsole.Instance.Output("Syntax: degregister region <Region UUID>");
|
||||
MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>");
|
||||
return;
|
||||
}
|
||||
|
||||
string rawRegionUuid = cmd[2];
|
||||
string rawRegionUuid = cmd[3];
|
||||
UUID regionUuid;
|
||||
|
||||
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
|
||||
|
@ -542,19 +549,56 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
private void HandleShowRegion(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 3)
|
||||
if (cmd.Length != 4)
|
||||
{
|
||||
MainConsole.Instance.Output("Syntax: show region <region name>");
|
||||
return;
|
||||
}
|
||||
List<RegionData> regions = m_Database.Get(cmd[2], UUID.Zero);
|
||||
if (regions == null || regions.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("Region not found");
|
||||
MainConsole.Instance.Output("Syntax: show region name <region name>");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (RegionData r in regions)
|
||||
string regionName = cmd[3];
|
||||
|
||||
List<RegionData> regions = m_Database.Get(regionName, UUID.Zero);
|
||||
if (regions == null || regions.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("No region with name {0} found", regionName);
|
||||
return;
|
||||
}
|
||||
|
||||
OutputRegionsToConsole(regions);
|
||||
}
|
||||
|
||||
private void HandleShowRegionAt(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 5)
|
||||
{
|
||||
MainConsole.Instance.Output("Syntax: show region at <x-coord> <y-coord>");
|
||||
return;
|
||||
}
|
||||
|
||||
int x, y;
|
||||
if (!int.TryParse(cmd[3], out x))
|
||||
{
|
||||
MainConsole.Instance.Output("x-coord must be an integer");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(cmd[4], out y))
|
||||
{
|
||||
MainConsole.Instance.Output("y-coord must be an integer");
|
||||
return;
|
||||
}
|
||||
|
||||
RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero);
|
||||
if (region == null)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
OutputRegionToConsole(region);
|
||||
}
|
||||
|
||||
private void OutputRegionToConsole(RegionData r)
|
||||
{
|
||||
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
||||
|
||||
|
@ -569,7 +613,10 @@ namespace OpenSim.Services.GridService
|
|||
MainConsole.Instance.Output(dispList.ToString());
|
||||
}
|
||||
|
||||
return;
|
||||
private void OutputRegionsToConsole(List<RegionData> regions)
|
||||
{
|
||||
foreach (RegionData r in regions)
|
||||
OutputRegionToConsole(r);
|
||||
}
|
||||
|
||||
private int ParseFlags(int prev, string flags)
|
||||
|
|
Loading…
Reference in New Issue