diff options
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneBase.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index da3b4dd..1e80f73 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -474,6 +474,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
474 | /// <summary> | 474 | /// <summary> |
475 | /// Call this from a region module to add a command to the OpenSim console. | 475 | /// Call this from a region module to add a command to the OpenSim console. |
476 | /// </summary> | 476 | /// </summary> |
477 | /// <param name="mod"> | ||
478 | /// The use of IRegionModuleBase is a cheap trick to get a different method signature, | ||
479 | /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. | ||
480 | /// </param> | ||
481 | /// <param name="category"> | ||
482 | /// Category of the command. This is the section under which it will appear when the user asks for help | ||
483 | /// </param> | ||
484 | /// <param name="command"></param> | ||
485 | /// <param name="shorthelp"></param> | ||
486 | /// <param name="longhelp"></param> | ||
487 | /// <param name="callback"></param> | ||
488 | public void AddCommand( | ||
489 | string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) | ||
490 | { | ||
491 | AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); | ||
492 | } | ||
493 | |||
494 | /// <summary> | ||
495 | /// Call this from a region module to add a command to the OpenSim console. | ||
496 | /// </summary> | ||
497 | /// <param name="mod"></param> | ||
498 | /// <param name="command"></param> | ||
499 | /// <param name="shorthelp"></param> | ||
500 | /// <param name="longhelp"></param> | ||
501 | /// <param name="descriptivehelp"></param> | ||
502 | /// <param name="callback"></param> | ||
503 | public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | ||
504 | { | ||
505 | string moduleName = ""; | ||
506 | |||
507 | if (mod != null) | ||
508 | { | ||
509 | if (mod is IRegionModule) | ||
510 | { | ||
511 | IRegionModule module = (IRegionModule)mod; | ||
512 | moduleName = module.Name; | ||
513 | } | ||
514 | else if (mod is IRegionModuleBase) | ||
515 | { | ||
516 | IRegionModuleBase module = (IRegionModuleBase)mod; | ||
517 | moduleName = module.Name; | ||
518 | } | ||
519 | else | ||
520 | { | ||
521 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); | ||
526 | } | ||
527 | |||
528 | /// <summary> | ||
529 | /// Call this from a region module to add a command to the OpenSim console. | ||
530 | /// </summary> | ||
531 | /// <param name="category"> | ||
532 | /// Category of the command. This is the section under which it will appear when the user asks for help | ||
533 | /// </param> | ||
477 | /// <param name="mod"></param> | 534 | /// <param name="mod"></param> |
478 | /// <param name="command"></param> | 535 | /// <param name="command"></param> |
479 | /// <param name="shorthelp"></param> | 536 | /// <param name="shorthelp"></param> |
@@ -481,12 +538,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
481 | /// <param name="descriptivehelp"></param> | 538 | /// <param name="descriptivehelp"></param> |
482 | /// <param name="callback"></param> | 539 | /// <param name="callback"></param> |
483 | public void AddCommand( | 540 | public void AddCommand( |
484 | object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 541 | string category, object mod, string command, |
542 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | ||
485 | { | 543 | { |
486 | if (MainConsole.Instance == null) | 544 | if (MainConsole.Instance == null) |
487 | return; | 545 | return; |
488 | 546 | ||
489 | string modulename = String.Empty; | ||
490 | bool shared = false; | 547 | bool shared = false; |
491 | 548 | ||
492 | if (mod != null) | 549 | if (mod != null) |
@@ -494,20 +551,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
494 | if (mod is IRegionModule) | 551 | if (mod is IRegionModule) |
495 | { | 552 | { |
496 | IRegionModule module = (IRegionModule)mod; | 553 | IRegionModule module = (IRegionModule)mod; |
497 | modulename = module.Name; | ||
498 | shared = module.IsSharedModule; | 554 | shared = module.IsSharedModule; |
499 | } | 555 | } |
500 | else if (mod is IRegionModuleBase) | 556 | else if (mod is IRegionModuleBase) |
501 | { | 557 | { |
502 | IRegionModuleBase module = (IRegionModuleBase)mod; | ||
503 | modulename = module.Name; | ||
504 | shared = mod is ISharedRegionModule; | 558 | shared = mod is ISharedRegionModule; |
505 | } | 559 | } |
506 | else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | 560 | else |
561 | { | ||
562 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
563 | } | ||
507 | } | 564 | } |
508 | 565 | ||
509 | MainConsole.Instance.Commands.AddCommand( | 566 | MainConsole.Instance.Commands.AddCommand( |
510 | modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback); | 567 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); |
511 | } | 568 | } |
512 | 569 | ||
513 | public virtual ISceneObject DeserializeObject(string representation) | 570 | public virtual ISceneObject DeserializeObject(string representation) |