add current script status to "scripts show" command (running, suspended, etc.)

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-19 20:24:07 +01:00
parent 1a29ddf328
commit 22e1298e97
3 changed files with 31 additions and 7 deletions

View File

@ -59,10 +59,15 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
public interface IScriptInstance public interface IScriptInstance
{ {
/// <summary> /// <summary>
/// Is this script currently running? /// Is the script currently running?
/// </summary> /// </summary>
bool Running { get; set; } bool Running { get; set; }
/// <summary>
/// Is the script suspended?
/// </summary>
bool Suspended { get; set; }
bool ShuttingDown { get; set; } bool ShuttingDown { get; set; }
string State { get; set; } string State { get; set; }
IScriptEngine Engine { get; } IScriptEngine Engine { get; }

View File

@ -95,7 +95,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState; private bool m_startedFromSavedState;
private UUID m_CurrentStateHash; private UUID m_CurrentStateHash;
private UUID m_RegionID; private UUID m_RegionID;
private bool m_Suspended = false;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
m_LineMap; m_LineMap;
@ -139,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
set { m_RunEvents = value; } set { m_RunEvents = value; }
} }
public bool Suspended { get; set; }
public bool ShuttingDown public bool ShuttingDown
{ {
get { return m_ShuttingDown; } get { return m_ShuttingDown; }
@ -644,7 +645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// <returns></returns> /// <returns></returns>
public object EventProcessor() public object EventProcessor()
{ {
if (m_Suspended) if (Suspended)
return 0; return 0;
lock (m_Script) lock (m_Script)
@ -1026,12 +1027,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Suspend() public void Suspend()
{ {
m_Suspended = true; Suspended = true;
} }
public void Resume() public void Resume()
{ {
m_Suspended = false; Suspended = false;
} }
} }
} }

View File

@ -286,11 +286,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (IScriptInstance instance in m_Scripts.Values) foreach (IScriptInstance instance in m_Scripts.Values)
{ {
SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); 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( 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, instance.PrimName, instance.ScriptName, instance.AssetID, instance.ObjectID,
sop.AbsolutePosition, m_Scene.RegionInfo.RegionName); sop.AbsolutePosition, status);
} }
} }
} }