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

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-19 20:24:07 +01:00
parent ecad9f9fd5
commit 116fbe8258
3 changed files with 31 additions and 7 deletions

View File

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

View File

@ -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<int, int>, KeyValuePair<int, int>>
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
/// <returns></returns>
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;
}
}
}

View File

@ -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);
}
}
}