Change all restarting to use the restart module. Remove hardcoded behavior

This commit is contained in:
Melanie
2010-11-25 03:16:52 +00:00
parent fb97fe8307
commit 57c4def254
6 changed files with 62 additions and 77 deletions

View File

@@ -395,10 +395,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
m_host.AddScriptLPS(1);
if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false))
if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
{
World.Restart((float)seconds);
if (seconds < 15)
{
restartModule.AbortRestart("Restart aborted");
return 1;
}
List<int> times = new List<int>();
while (seconds > 0)
{
times.Add((int)seconds);
if (seconds > 300)
seconds -= 120;
else if (seconds > 30)
seconds -= 30;
else
seconds -= 15;
}
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
return 1;
}
else
@@ -2315,4 +2334,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
}
}
}