From 116fbe8258e336be3f6ac1e11119214629799faa Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 19 Oct 2011 20:24:07 +0100
Subject: add current script status to "scripts show" command (running,
suspended, etc.)
---
.../ScriptEngine/Interfaces/IScriptInstance.cs | 7 ++++++-
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 9 +++++----
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 22 ++++++++++++++++++++--
3 files changed, 31 insertions(+), 7 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 0cc0fe7..d3200d5 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -59,10 +59,15 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
public interface IScriptInstance
{
///
- /// Is this script currently running?
+ /// Is the script currently running?
///
bool Running { get; set; }
+ ///
+ /// Is the script suspended?
+ ///
+ bool Suspended { get; set; }
+
bool ShuttingDown { get; set; }
string State { get; set; }
IScriptEngine Engine { get; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 3313b18..9d48e94 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -95,7 +95,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState;
private UUID m_CurrentStateHash;
private UUID m_RegionID;
- private bool m_Suspended = false;
private Dictionary, KeyValuePair>
m_LineMap;
@@ -139,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
set { m_RunEvents = value; }
}
+ public bool Suspended { get; set; }
+
public bool ShuttingDown
{
get { return m_ShuttingDown; }
@@ -644,7 +645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
///
public object EventProcessor()
{
- if (m_Suspended)
+ if (Suspended)
return 0;
lock (m_Script)
@@ -1026,12 +1027,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Suspend()
{
- m_Suspended = true;
+ Suspended = true;
}
public void Resume()
{
- m_Suspended = false;
+ Suspended = false;
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9f8ee1c..c74cd64 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -286,11 +286,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (IScriptInstance instance in m_Scripts.Values)
{
SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
+ string status;
+
+ if (instance.ShuttingDown)
+ {
+ status = "shutting down";
+ }
+ else if (instance.Suspended)
+ {
+ status = "suspended";
+ }
+ else if (!instance.Running)
+ {
+ status = "stopped";
+ }
+ else
+ {
+ status = "running";
+ }
MainConsole.Instance.OutputFormat(
- "{0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
+ "{0}.{1}, script UUID {2}, prim UUID {3} @ {4} ({5})",
instance.PrimName, instance.ScriptName, instance.AssetID, instance.ObjectID,
- sop.AbsolutePosition, m_Scene.RegionInfo.RegionName);
+ sop.AbsolutePosition, status);
}
}
}
--
cgit v1.1