aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs36
2 files changed, 38 insertions, 2 deletions
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}