aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorMandarinka Tasty2016-05-30 01:25:06 +0200
committerMelanie Thielker2016-05-30 15:58:39 +0200
commit77af32cdbf939422d7f76ba6bb1de8f67c7b16e1 (patch)
treed20e97e96c225627b9cd97745b633bb5522ed84a /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentFix a line deletion that should not have been deleted (diff)
downloadopensim-SC_OLD-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.zip
opensim-SC_OLD-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.tar.gz
opensim-SC_OLD-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.tar.bz2
opensim-SC_OLD-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.tar.xz
Enhancement of osRegionRestart
Signed-off-by: Mandarinka Tasty <mandarinka.tasty@gmail.com> Signed-off-by: Melanie Thielker <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs58
1 files changed, 47 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7e88365..b215ae1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -523,23 +523,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
523 { 523 {
524 if (seconds < 15) 524 if (seconds < 15)
525 { 525 {
526 restartModule.AbortRestart("Restart aborted"); 526 restartModule.AbortRestart("Region restart has been aborted\n");
527 return 1; 527 return 1;
528 } 528 }
529 529
530 List<int> times = new List<int>(); 530 RegionRestart(seconds, String.Empty);
531 while (seconds > 0) 531 return 1;
532 }
533 else
534 {
535 return 0;
536 }
537 }
538
539 public int osRegionRestart(double seconds, string msg)
540 {
541 CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
542
543 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
544 m_host.AddScriptLPS(1);
545 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
546 {
547 if (seconds < 15)
532 { 548 {
533 times.Add((int)seconds); 549 restartModule.AbortRestart("Region restart has been aborted\n");
534 if (seconds > 300) 550 return 1;
535 seconds -= 120;
536 else if (seconds > 30)
537 seconds -= 30;
538 else
539 seconds -= 15;
540 } 551 }
541 552
542 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); 553 RegionRestart(seconds, msg);
543 return 1; 554 return 1;
544 } 555 }
545 else 556 else
@@ -548,6 +559,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
548 } 559 }
549 } 560 }
550 561
562 private void RegionRestart(double seconds, string msg)
563 {
564 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
565
566 List<int> times = new List<int>();
567 while (seconds > 0)
568 {
569 times.Add((int)seconds);
570 if (seconds > 300)
571 seconds -= 120;
572 else if (seconds > 120)
573 seconds -= 60;
574 else if (seconds > 60)
575 seconds -= 30;
576 else
577 seconds -= 15;
578 }
579
580 if (msg == String.Empty)
581 restartModule.ScheduleRestart(UUID.Zero, "Region: " + World.RegionInfo.RegionName + " is about to restart.\n\nIf You stay here You will be logged out.\n\n\nTime remained: {0}.\n", times.ToArray(), true);
582
583 else
584 restartModule.ScheduleRestart(UUID.Zero, msg + "\n\nTime remained: {0}.\n", times.ToArray(), true);
585 }
586
551 public void osRegionNotice(string msg) 587 public void osRegionNotice(string msg)
552 { 588 {
553 // This implementation provides absolutely no security 589 // This implementation provides absolutely no security