Merge branch 'master' of /home/opensim/var/repo/opensim
commit
91b4f45d47
|
@ -73,6 +73,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
private bool _ownerChanged = false;
|
private bool _ownerChanged = false;
|
||||||
|
|
||||||
|
// This used ONLY during copy. It can't be relied on at other times!
|
||||||
|
private bool _scriptRunning = true;
|
||||||
|
|
||||||
public UUID AssetID {
|
public UUID AssetID {
|
||||||
get {
|
get {
|
||||||
return _assetID;
|
return _assetID;
|
||||||
|
@ -350,6 +353,15 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ScriptRunning {
|
||||||
|
get {
|
||||||
|
return _scriptRunning;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_scriptRunning = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// See ICloneable
|
// See ICloneable
|
||||||
|
|
||||||
#region ICloneable Members
|
#region ICloneable Members
|
||||||
|
|
|
@ -69,6 +69,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
ArrayList GetScriptErrors(UUID itemID);
|
ArrayList GetScriptErrors(UUID itemID);
|
||||||
|
|
||||||
|
bool HasScript(UUID itemID, out bool running);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if a script is running.
|
/// Returns true if a script is running.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -101,4 +103,4 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
|
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_items = value;
|
m_items = value;
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
|
QueryScriptStates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +218,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void QueryScriptStates()
|
||||||
|
{
|
||||||
|
if (m_part == null || m_part.ParentGroup == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
if (engines == null) // No engine at all
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (Items)
|
||||||
|
{
|
||||||
|
foreach (TaskInventoryItem item in Items.Values)
|
||||||
|
{
|
||||||
|
if (item.InvType == (int)InventoryType.LSL)
|
||||||
|
{
|
||||||
|
foreach (IScriptModule e in engines)
|
||||||
|
{
|
||||||
|
bool running;
|
||||||
|
|
||||||
|
if (e.HasScript(item.ItemID, out running))
|
||||||
|
{
|
||||||
|
item.ScriptRunning = running;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
int scriptsValidForStarting = 0;
|
int scriptsValidForStarting = 0;
|
||||||
|
@ -321,6 +352,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
string script = Utils.BytesToString(asset.Data);
|
string script = Utils.BytesToString(asset.Data);
|
||||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||||
|
if (!item.ScriptRunning)
|
||||||
|
m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
|
||||||
|
m_part.LocalId, item.ItemID);
|
||||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||||
m_part.ScheduleFullUpdate();
|
m_part.ScheduleFullUpdate();
|
||||||
|
|
||||||
|
@ -1251,4 +1285,4 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2081,5 +2081,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// else
|
// else
|
||||||
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
|
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasScript(UUID itemID, out bool running)
|
||||||
|
{
|
||||||
|
running = true;
|
||||||
|
|
||||||
|
IScriptInstance instance = GetInstance(itemID);
|
||||||
|
if (instance == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
running = instance.Running;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue