diff options
author | Justin Clark-Casey (justincc) | 2011-10-19 21:40:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-19 21:40:28 +0100 |
commit | 32c3faedd609cbaf5f17a866c41925105b690766 (patch) | |
tree | 403d4c6455baea4fed89ddf592ced18c0fc72754 /OpenSim/Region | |
parent | minor: improve command help on scripts suspend/resume (diff) | |
download | opensim-SC-32c3faedd609cbaf5f17a866c41925105b690766.zip opensim-SC-32c3faedd609cbaf5f17a866c41925105b690766.tar.gz opensim-SC-32c3faedd609cbaf5f17a866c41925105b690766.tar.bz2 opensim-SC-32c3faedd609cbaf5f17a866c41925105b690766.tar.xz |
Add "scripts stop" and "scripts start" console commands.
These will stop all running scripts and start all stopped scripts respectively.
A stopped script does not save any events for later processing.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index acbf7df..003e735 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -276,17 +276,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
276 | "Synonym for scripts show command", HandleShowScripts); | 276 | "Synonym for scripts show command", HandleShowScripts); |
277 | 277 | ||
278 | MainConsole.Instance.Commands.AddCommand( | 278 | MainConsole.Instance.Commands.AddCommand( |
279 | "scripts", false, "scripts suspend", "scripts suspend", "Suspend all scripts", | 279 | "scripts", false, "scripts suspend", "scripts suspend", "Suspends all running scripts", |
280 | "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" | 280 | "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" |
281 | + " script that is currently processing an event.\n" | 281 | + " script that is currently processing an event.\n" |
282 | + "Suspended scripts will continue to accumulate events but won't process them.", | 282 | + "Suspended scripts will continue to accumulate events but won't process them.", |
283 | HandleSuspendScripts); | 283 | HandleSuspendScripts); |
284 | 284 | ||
285 | MainConsole.Instance.Commands.AddCommand( | 285 | MainConsole.Instance.Commands.AddCommand( |
286 | "scripts", false, "scripts resume", "scripts resume", "Resume all scripts", | 286 | "scripts", false, "scripts resume", "scripts resume", "Resumes all suspended scripts", |
287 | "Resumes all currently suspended scripts.\n" | 287 | "Resumes all currently suspended scripts.\n" |
288 | + "Resumed scripts will process all events accumulated whilst suspended.", | 288 | + "Resumed scripts will process all events accumulated whilst suspended.", |
289 | HandleResumeScripts); | 289 | HandleResumeScripts); |
290 | |||
291 | MainConsole.Instance.Commands.AddCommand( | ||
292 | "scripts", false, "scripts stop", "scripts stop", "Stops all running scripts", | ||
293 | HandleStopScripts); | ||
294 | |||
295 | MainConsole.Instance.Commands.AddCommand( | ||
296 | "scripts", false, "scripts start", "scripts start", "Starts all stopped scripts", | ||
297 | HandleStartScripts); | ||
290 | } | 298 | } |
291 | 299 | ||
292 | public void HandleShowScripts(string module, string[] cmdparams) | 300 | public void HandleShowScripts(string module, string[] cmdparams) |
@@ -364,6 +372,44 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
364 | } | 372 | } |
365 | } | 373 | } |
366 | 374 | ||
375 | public void HandleStartScripts(string module, string[] cmdparams) | ||
376 | { | ||
377 | lock (m_Scripts) | ||
378 | { | ||
379 | foreach (IScriptInstance instance in m_Scripts.Values) | ||
380 | { | ||
381 | if (!instance.Running) | ||
382 | { | ||
383 | instance.Start(); | ||
384 | |||
385 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); | ||
386 | MainConsole.Instance.OutputFormat( | ||
387 | "Started {0}.{1}, item UUID {2}, prim UUID {3} @ {4}", | ||
388 | instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, sop.AbsolutePosition); | ||
389 | } | ||
390 | } | ||
391 | } | ||
392 | } | ||
393 | |||
394 | public void HandleStopScripts(string module, string[] cmdparams) | ||
395 | { | ||
396 | lock (m_Scripts) | ||
397 | { | ||
398 | foreach (IScriptInstance instance in m_Scripts.Values) | ||
399 | { | ||
400 | if (instance.Running) | ||
401 | { | ||
402 | instance.Stop(0); | ||
403 | |||
404 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); | ||
405 | MainConsole.Instance.OutputFormat( | ||
406 | "Stopped {0}.{1}, item UUID {2}, prim UUID {3} @ {4}", | ||
407 | instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, sop.AbsolutePosition); | ||
408 | } | ||
409 | } | ||
410 | } | ||
411 | } | ||
412 | |||
367 | public void RemoveRegion(Scene scene) | 413 | public void RemoveRegion(Scene scene) |
368 | { | 414 | { |
369 | if (!m_Enabled) | 415 | if (!m_Enabled) |