aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs36
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs12
4 files changed, 62 insertions, 2 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 362d365..3b40381 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -73,6 +73,9 @@ namespace OpenSim.Framework
73 73
74 private bool _ownerChanged = false; 74 private bool _ownerChanged = false;
75 75
76 // This used ONLY during copy. It can't be relied on at other times!
77 private bool _scriptRunning = true;
78
76 public UUID AssetID { 79 public UUID AssetID {
77 get { 80 get {
78 return _assetID; 81 return _assetID;
@@ -350,6 +353,15 @@ namespace OpenSim.Framework
350 } 353 }
351 } 354 }
352 355
356 public bool ScriptRunning {
357 get {
358 return _scriptRunning;
359 }
360 set {
361 _scriptRunning = value;
362 }
363 }
364
353 // See ICloneable 365 // See ICloneable
354 366
355 #region ICloneable Members 367 #region ICloneable Members
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index cbaf241..42dbedc 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -69,6 +69,8 @@ namespace OpenSim.Region.Framework.Interfaces
69 69
70 ArrayList GetScriptErrors(UUID itemID); 70 ArrayList GetScriptErrors(UUID itemID);
71 71
72 bool HasScript(UUID itemID, out bool running);
73
72 /// <summary> 74 /// <summary>
73 /// Returns true if a script is running. 75 /// Returns true if a script is running.
74 /// </summary> 76 /// </summary>
@@ -101,4 +103,4 @@ namespace OpenSim.Region.Framework.Interfaces
101 /// </returns> 103 /// </returns>
102 Dictionary<uint, float> GetObjectScriptsExecutionTimes(); 104 Dictionary<uint, float> GetObjectScriptsExecutionTimes();
103 } 105 }
104} \ No newline at end of file 106}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index c223474..6427014 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -89,6 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
89 { 89 {
90 m_items = value; 90 m_items = value;
91 m_inventorySerial++; 91 m_inventorySerial++;
92 QueryScriptStates();
92 } 93 }
93 } 94 }
94 95
@@ -217,6 +218,36 @@ namespace OpenSim.Region.Framework.Scenes
217 } 218 }
218 } 219 }
219 220
221 private void QueryScriptStates()
222 {
223 if (m_part == null || m_part.ParentGroup == null)
224 return;
225
226 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
227 if (engines == null) // No engine at all
228 return;
229
230 lock (Items)
231 {
232 foreach (TaskInventoryItem item in Items.Values)
233 {
234 if (item.InvType == (int)InventoryType.LSL)
235 {
236 foreach (IScriptModule e in engines)
237 {
238 bool running;
239
240 if (e.HasScript(item.ItemID, out running))
241 {
242 item.ScriptRunning = running;
243 break;
244 }
245 }
246 }
247 }
248 }
249 }
250
220 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 251 public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
221 { 252 {
222 int scriptsValidForStarting = 0; 253 int scriptsValidForStarting = 0;
@@ -321,6 +352,9 @@ namespace OpenSim.Region.Framework.Scenes
321 string script = Utils.BytesToString(asset.Data); 352 string script = Utils.BytesToString(asset.Data);
322 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 353 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
323 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); 354 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
355 if (!item.ScriptRunning)
356 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
357 m_part.LocalId, item.ItemID);
324 m_part.ParentGroup.AddActiveScriptCount(1); 358 m_part.ParentGroup.AddActiveScriptCount(1);
325 m_part.ScheduleFullUpdate(); 359 m_part.ScheduleFullUpdate();
326 360
@@ -1251,4 +1285,4 @@ namespace OpenSim.Region.Framework.Scenes
1251 } 1285 }
1252 } 1286 }
1253 } 1287 }
1254} \ No newline at end of file 1288}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 35fac4e..7f3bd76 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2081,5 +2081,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2081// else 2081// else
2082// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); 2082// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
2083 } 2083 }
2084
2085 public bool HasScript(UUID itemID, out bool running)
2086 {
2087 running = true;
2088
2089 IScriptInstance instance = GetInstance(itemID);
2090 if (instance == null)
2091 return false;
2092
2093 running = instance.Running;
2094 return true;
2095 }
2084 } 2096 }
2085} 2097}