diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 273 |
1 files changed, 133 insertions, 140 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index fa37bf1..92e3025 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -376,162 +376,155 @@ namespace OpenSim | |||
376 | { | 376 | { |
377 | string result = ""; | 377 | string result = ""; |
378 | 378 | ||
379 | if ((m_consoleRegion == null) || (command == "change-region") || (command == "shutdown")) | 379 | switch (command) |
380 | { | 380 | { |
381 | switch (command) | 381 | case "set-time": |
382 | { | 382 | m_localScenes.SetTimePhase(Convert.ToInt32(cmdparams[0])); |
383 | case "debug": | 383 | break; |
384 | if (cmdparams.Length > 0) | ||
385 | { | ||
386 | Debug(cmdparams); | ||
387 | } | ||
388 | break; | ||
389 | |||
390 | case "help": | ||
391 | m_log.Error("alert - send alert to a designated user or all users."); | ||
392 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | ||
393 | m_log.Error(" alert general [Message] - send an alert to all users."); | ||
394 | m_log.Error("backup - trigger a simulator backup"); | ||
395 | m_log.Error("debug - debugging commands"); | ||
396 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | ||
397 | m_log.Error("load-xml [filename] - load prims from XML"); | ||
398 | m_log.Error("save-xml [filename] - save prims to XML"); | ||
399 | m_log.Error("script - manually trigger scripts? or script commands?"); | ||
400 | m_log.Error("show uptime - show simulator startup and uptime."); | ||
401 | m_log.Error("show users - show info about connected users."); | ||
402 | m_log.Error("shutdown - disconnect all clients and shutdown."); | ||
403 | m_log.Error("terrain help - show help for terrain commands."); | ||
404 | m_log.Error("quit - equivalent to shutdown."); | ||
405 | break; | ||
406 | |||
407 | case "show": | ||
408 | if (cmdparams.Length > 0) | ||
409 | { | ||
410 | Show(cmdparams[0]); | ||
411 | } | ||
412 | break; | ||
413 | 384 | ||
414 | case "save-xml": | 385 | case "force-update": |
415 | if (cmdparams.Length > 0) | 386 | Console.WriteLine("Updating all clients"); |
416 | { | 387 | m_localScenes.ForceClientUpdate(); |
417 | m_localScenes.SavePrimsToXml(cmdparams[0]); | 388 | break; |
418 | } | ||
419 | else | ||
420 | { | ||
421 | m_localScenes.SavePrimsToXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
422 | } | ||
423 | break; | ||
424 | 389 | ||
425 | case "load-xml": | ||
426 | if (cmdparams.Length > 0) | ||
427 | { | ||
428 | m_localScenes.LoadPrimsFromXml(cmdparams[0]); | ||
429 | } | ||
430 | else | ||
431 | { | ||
432 | m_localScenes.LoadPrimsFromXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
433 | } | ||
434 | break; | ||
435 | 390 | ||
436 | case "terrain": | 391 | case "edit-scale": |
437 | if (!m_localScenes.RunTerrainCmd(cmdparams, ref result)) | 392 | if (cmdparams.Length == 4) |
438 | { | 393 | { |
439 | m_log.Error(result); | 394 | m_localScenes.HandleEditCommand(cmdparams); |
440 | } | 395 | } |
441 | break; | 396 | break; |
442 | |||
443 | // terrain-sim now obsolete: do change-region first, then terrain as usual | ||
444 | //case "terrain-sim": | ||
445 | // foreach (Scene scene in m_localScenes) | ||
446 | // { | ||
447 | // if (scene.RegionInfo.RegionName.ToLower() == cmdparams[0].ToLower()) | ||
448 | // { | ||
449 | // string[] tmpCmdparams = new string[cmdparams.Length - 1]; | ||
450 | // cmdparams.CopyTo(tmpCmdparams, 1); | ||
451 | |||
452 | // if (!scene.Terrain.RunTerrainCmd(tmpCmdparams, ref result, scene.RegionInfo.RegionName)) | ||
453 | // { | ||
454 | // m_log.Error(result); | ||
455 | // } | ||
456 | // } | ||
457 | // } | ||
458 | // break; | ||
459 | |||
460 | case "script": | ||
461 | m_localScenes.SendCommandToScripts(cmdparams); | ||
462 | break; | ||
463 | |||
464 | case "command-script": | ||
465 | if (cmdparams.Length > 0) | ||
466 | { | ||
467 | RunCommandScript(cmdparams[0]); | ||
468 | } | ||
469 | break; | ||
470 | 397 | ||
471 | case "permissions": | 398 | case "debug": |
472 | // Treats each user as a super-admin when disabled | 399 | if (cmdparams.Length > 0) |
473 | bool permissions = Convert.ToBoolean(cmdparams[0]); | 400 | { |
401 | Debug(cmdparams); | ||
402 | } | ||
403 | break; | ||
474 | 404 | ||
475 | m_localScenes.BypassPermissions(!permissions); | 405 | case "help": |
406 | m_log.Error("alert - send alert to a designated user or all users."); | ||
407 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | ||
408 | m_log.Error(" alert general [Message] - send an alert to all users."); | ||
409 | m_log.Error("backup - trigger a simulator backup"); | ||
410 | m_log.Error("debug - debugging commands"); | ||
411 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | ||
412 | m_log.Error("load-xml [filename] - load prims from XML"); | ||
413 | m_log.Error("save-xml [filename] - save prims to XML"); | ||
414 | m_log.Error("script - manually trigger scripts? or script commands?"); | ||
415 | m_log.Error("show uptime - show simulator startup and uptime."); | ||
416 | m_log.Error("show users - show info about connected users."); | ||
417 | m_log.Error("shutdown - disconnect all clients and shutdown."); | ||
418 | m_log.Error("terrain help - show help for terrain commands."); | ||
419 | m_log.Error("quit - equivalent to shutdown."); | ||
420 | break; | ||
476 | 421 | ||
477 | break; | 422 | case "show": |
423 | if (cmdparams.Length > 0) | ||
424 | { | ||
425 | Show(cmdparams[0]); | ||
426 | } | ||
427 | break; | ||
478 | 428 | ||
479 | case "backup": | 429 | case "save-xml": |
480 | m_localScenes.Backup(); | 430 | if (cmdparams.Length > 0) |
481 | break; | 431 | { |
432 | m_localScenes.SavePrimsToXml(cmdparams[0]); | ||
433 | } | ||
434 | else | ||
435 | { | ||
436 | m_localScenes.SavePrimsToXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
437 | } | ||
438 | break; | ||
482 | 439 | ||
483 | case "alert": | 440 | case "load-xml": |
484 | m_localScenes.HandleAlertCommand(cmdparams); | 441 | if (cmdparams.Length > 0) |
485 | break; | 442 | { |
443 | m_localScenes.LoadPrimsFromXml(cmdparams[0]); | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | m_localScenes.LoadPrimsFromXml(DEFAULT_PRIM_BACKUP_FILENAME); | ||
448 | } | ||
449 | break; | ||
486 | 450 | ||
487 | case "create": | 451 | case "terrain": |
488 | if (CreateAccount != null) | 452 | if (!m_localScenes.RunTerrainCmd(cmdparams, ref result)) |
489 | { | 453 | { |
490 | CreateAccount(cmdparams); | 454 | m_log.Error(result); |
491 | } | 455 | } |
492 | break; | 456 | break; |
493 | 457 | ||
494 | case "quit": | 458 | case "script": |
495 | case "shutdown": | 459 | m_localScenes.SendCommandToScripts(cmdparams); |
496 | Shutdown(); | 460 | break; |
497 | break; | ||
498 | 461 | ||
499 | case "change-region": | 462 | case "command-script": |
500 | if (cmdparams.Length > 0) | 463 | if (cmdparams.Length > 0) |
501 | { | 464 | { |
502 | string regionName = this.CombineParams(cmdparams, 0); | 465 | RunCommandScript(cmdparams[0]); |
503 | 466 | } | |
504 | if( m_localScenes.TrySetCurrentRegion( regionName ) ) | 467 | break; |
505 | { | 468 | |
506 | 469 | case "permissions": | |
507 | } | 470 | // Treats each user as a super-admin when disabled |
508 | else | 471 | bool permissions = Convert.ToBoolean(cmdparams[0]); |
509 | { | 472 | |
510 | MainLog.Instance.Error("Couldn't set current region to: " + regionName); | 473 | m_localScenes.BypassPermissions(!permissions); |
511 | } | 474 | |
512 | } | 475 | break; |
476 | |||
477 | case "backup": | ||
478 | m_localScenes.Backup(); | ||
479 | break; | ||
480 | |||
481 | case "alert": | ||
482 | m_localScenes.HandleAlertCommand(cmdparams); | ||
483 | break; | ||
484 | |||
485 | case "create": | ||
486 | if (CreateAccount != null) | ||
487 | { | ||
488 | CreateAccount(cmdparams); | ||
489 | } | ||
490 | break; | ||
491 | |||
492 | case "quit": | ||
493 | case "shutdown": | ||
494 | Shutdown(); | ||
495 | break; | ||
513 | 496 | ||
514 | if (m_localScenes.CurrentScene == null) | 497 | case "change-region": |
498 | if (cmdparams.Length > 0) | ||
499 | { | ||
500 | string regionName = this.CombineParams(cmdparams, 0); | ||
501 | |||
502 | if (m_localScenes.TrySetCurrentRegion(regionName)) | ||
515 | { | 503 | { |
516 | MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); | 504 | |
517 | } | 505 | } |
518 | else | 506 | else |
519 | { | 507 | { |
520 | MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); | 508 | MainLog.Instance.Error("Couldn't set current region to: " + regionName); |
521 | } | 509 | } |
510 | } | ||
522 | 511 | ||
523 | break; | 512 | if (m_localScenes.CurrentScene == null) |
513 | { | ||
514 | MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); | ||
515 | } | ||
516 | else | ||
517 | { | ||
518 | MainLog.Instance.Verbose("Current Region: " + m_localScenes.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); | ||
519 | } | ||
524 | 520 | ||
525 | default: | 521 | break; |
526 | m_log.Error("Unknown command"); | 522 | |
527 | break; | 523 | default: |
528 | } | 524 | m_log.Error("Unknown command"); |
529 | } | 525 | break; |
530 | else | ||
531 | { | ||
532 | //let the scene/region handle the command directly. | ||
533 | m_consoleRegion.ProcessConsoleCmd(command, cmdparams); | ||
534 | } | 526 | } |
527 | |||
535 | } | 528 | } |
536 | 529 | ||
537 | public void Debug(string[] args) | 530 | public void Debug(string[] args) |
@@ -579,12 +572,12 @@ namespace OpenSim | |||
579 | 572 | ||
580 | List<ScenePresence> avatars = m_localScenes.GetAvatars(); | 573 | List<ScenePresence> avatars = m_localScenes.GetAvatars(); |
581 | 574 | ||
582 | foreach( ScenePresence avatar in avatars ) | 575 | foreach (ScenePresence avatar in avatars) |
583 | { | 576 | { |
584 | RegionInfo regionInfo = m_localScenes.GetRegionInfo( avatar.RegionHandle ); | 577 | RegionInfo regionInfo = m_localScenes.GetRegionInfo(avatar.RegionHandle); |
585 | string regionName; | 578 | string regionName; |
586 | 579 | ||
587 | if( regionInfo == null ) | 580 | if (regionInfo == null) |
588 | { | 581 | { |
589 | regionName = "Unresolvable"; | 582 | regionName = "Unresolvable"; |
590 | } | 583 | } |
@@ -601,7 +594,7 @@ namespace OpenSim | |||
601 | avatar.ControllingClient.AgentId, | 594 | avatar.ControllingClient.AgentId, |
602 | "Unknown", | 595 | "Unknown", |
603 | "Unknown", | 596 | "Unknown", |
604 | regionName )); | 597 | regionName)); |
605 | } | 598 | } |
606 | 599 | ||
607 | break; | 600 | break; |