aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
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
parentFix a line deletion that should not have been deleted (diff)
downloadopensim-SC-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.zip
opensim-SC-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.tar.gz
opensim-SC-77af32cdbf939422d7f76ba6bb1de8f67c7b16e1.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs58
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
3 files changed, 53 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
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 6fc5db4..e1bb139 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
135 void osTerrainFlush(); 135 void osTerrainFlush();
136 136
137 int osRegionRestart(double seconds); 137 int osRegionRestart(double seconds);
138 int osRegionRestart(double seconds, string msg);
138 void osRegionNotice(string msg); 139 void osRegionNotice(string msg);
139 bool osConsoleCommand(string Command); 140 bool osConsoleCommand(string Command);
140 void osSetParcelMediaURL(string url); 141 void osSetParcelMediaURL(string url);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index ee07eee..0022020 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -209,6 +209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
209 return m_OSSL_Functions.osRegionRestart(seconds); 209 return m_OSSL_Functions.osRegionRestart(seconds);
210 } 210 }
211 211
212 public int osRegionRestart(double seconds, string msg)
213 {
214 return m_OSSL_Functions.osRegionRestart(seconds, msg);
215 }
216
212 public void osRegionNotice(string msg) 217 public void osRegionNotice(string msg)
213 { 218 {
214 m_OSSL_Functions.osRegionNotice(msg); 219 m_OSSL_Functions.osRegionNotice(msg);