Display help commander topics in capitalized form - the commands themselves are still lowercase.

Also convert the estate commands to simply AddCommand() calls so that commands from two different modules can be placed in the same category
0.7.4.1
Justin Clark-Casey (justincc) 2012-03-08 02:17:45 +00:00
parent 430304c176
commit 650d761c06
3 changed files with 14 additions and 45 deletions

View File

@ -242,8 +242,10 @@ namespace OpenSim
foreach (string topic in topics) foreach (string topic in topics)
{ {
m_console.Commands.AddCommand(topic, false, "help " + topic, string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
"help " + topic,
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
"help " + capitalizedTopic,
"Get help on plugin command '" + topic + "'", "Get help on plugin command '" + topic + "'",
HandleCommanderHelp); HandleCommanderHelp);
// //
@ -267,7 +269,7 @@ namespace OpenSim
foreach (string command in commander.Commands.Keys) foreach (string command in commander.Commands.Keys)
{ {
m_console.Commands.AddCommand(topic, false, m_console.Commands.AddCommand(capitalizedTopic, false,
topic + " " + command, topic + " " + command,
topic + " " + commander.Commands[command].ShortHelp(), topic + " " + commander.Commands[command].ShortHelp(),
String.Empty, HandleCommanderCommand); String.Empty, HandleCommanderCommand);
@ -286,7 +288,7 @@ namespace OpenSim
// Only safe for the interactive console, since it won't // Only safe for the interactive console, since it won't
// let us come here unless both scene and commander exist // let us come here unless both scene and commander exist
// //
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]); ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1].ToLower());
if (moduleCommander != null) if (moduleCommander != null)
m_console.Output(moduleCommander.Help); m_console.Output(moduleCommander.Help);
} }

View File

@ -62,58 +62,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
m_module.Scene.AddCommand("estate", m_module, "set terrain texture", m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
"set terrain texture <number> <uuid> [<x>] [<y>]", "set terrain texture <number> <uuid> [<x>] [<y>]",
"Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate.", " that coordinate.",
consoleSetTerrainTexture); consoleSetTerrainTexture);
m_module.Scene.AddCommand("estate", m_module, "set terrain heights", m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
"set terrain heights <corner> <min> <max> [<x>] [<y>]", "set terrain heights <corner> <min> <max> [<x>] [<y>]",
"Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
consoleSetTerrainHeights); consoleSetTerrainHeights);
Command showCommand m_module.Scene.AddCommand(
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator."); "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", "", ShowEstatesCommand);
m_commander.RegisterCommand("show", showCommand);
m_module.Scene.RegisterModuleCommander(m_commander);
m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
} }
public void Close() public void Close() {}
{
m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
m_module.Scene.UnregisterModuleCommander(m_commander.Name);
}
/// <summary>
/// Processes commandline input. Do not call directly.
/// </summary>
/// <param name="args">Commandline arguments</param>
protected void EventManagerOnPluginConsole(string[] args)
{
if (args[0] == "estate")
{
if (args.Length == 1)
{
m_commander.ProcessConsoleCommand("help", new string[0]);
return;
}
string[] tmpArgs = new string[args.Length - 2];
int i;
for (i = 2; i < args.Length; i++)
tmpArgs[i - 2] = args[i];
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
}
}
protected void consoleSetTerrainTexture(string module, string[] args) protected void consoleSetTerrainTexture(string module, string[] args)
{ {
@ -201,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
protected void ShowEstatesCommand(Object[] args) protected void ShowEstatesCommand(string module, string[] cmd)
{ {
StringBuilder report = new StringBuilder(); StringBuilder report = new StringBuilder();
RegionInfo ri = m_module.Scene.RegionInfo; RegionInfo ri = m_module.Scene.RegionInfo;

View File

@ -596,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion Region Settings #endregion Region Settings
MainConsole.Instance.Commands.AddCommand("estate", false, "reload estate", MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
"reload estate", "reload estate",
"Reload the estate data", HandleReloadEstate); "Reload the estate data", HandleReloadEstate);