Enhancement of osRegionRestart

Signed-off-by: Mandarinka Tasty <mandarinka.tasty@gmail.com>
Signed-off-by: Melanie Thielker <melanie@t-data.com>
LSLKeyTest
Mandarinka Tasty 2016-05-30 01:25:06 +02:00 committed by Melanie Thielker
parent bcee4e3772
commit 77af32cdbf
3 changed files with 56 additions and 14 deletions

View File

@ -523,29 +523,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (seconds < 15)
{
restartModule.AbortRestart("Restart aborted");
restartModule.AbortRestart("Region restart has been aborted\n");
return 1;
}
RegionRestart(seconds, String.Empty);
return 1;
}
else
{
return 0;
}
}
public int osRegionRestart(double seconds, string msg)
{
CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
m_host.AddScriptLPS(1);
if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
{
if (seconds < 15)
{
restartModule.AbortRestart("Region restart has been aborted\n");
return 1;
}
RegionRestart(seconds, msg);
return 1;
}
else
{
return 0;
}
}
private void RegionRestart(double seconds, string msg)
{
IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
List<int> times = new List<int>();
while (seconds > 0)
{
times.Add((int)seconds);
if (seconds > 300)
seconds -= 120;
else if (seconds > 30)
else if (seconds > 120)
seconds -= 60;
else if (seconds > 60)
seconds -= 30;
else
seconds -= 15;
}
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
return 1;
}
if (msg == String.Empty)
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);
else
{
return 0;
}
restartModule.ScheduleRestart(UUID.Zero, msg + "\n\nTime remained: {0}.\n", times.ToArray(), true);
}
public void osRegionNotice(string msg)

View File

@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osTerrainFlush();
int osRegionRestart(double seconds);
int osRegionRestart(double seconds, string msg);
void osRegionNotice(string msg);
bool osConsoleCommand(string Command);
void osSetParcelMediaURL(string url);

View File

@ -209,6 +209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osRegionRestart(seconds);
}
public int osRegionRestart(double seconds, string msg)
{
return m_OSSL_Functions.osRegionRestart(seconds, msg);
}
public void osRegionNotice(string msg)
{
m_OSSL_Functions.osRegionNotice(msg);