diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f41e329..3a9a146 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -244,31 +244,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) | 244 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
248 | if (engines == null) // No engine at all | ||
249 | return; | ||
250 | |||
251 | Items.LockItemsForRead(true); | 247 | Items.LockItemsForRead(true); |
252 | foreach (TaskInventoryItem item in Items.Values) | 248 | foreach (TaskInventoryItem item in Items.Values) |
253 | { | 249 | { |
254 | if (item.InvType == (int)InventoryType.LSL) | 250 | if (item.InvType == (int)InventoryType.LSL) |
255 | { | 251 | { |
256 | foreach (IScriptModule e in engines) | 252 | bool running; |
257 | { | 253 | if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running)) |
258 | bool running; | 254 | item.ScriptRunning = running; |
259 | |||
260 | if (e.HasScript(item.ItemID, out running)) | ||
261 | { | ||
262 | item.ScriptRunning = running; | ||
263 | break; | ||
264 | } | ||
265 | } | ||
266 | } | 255 | } |
267 | } | 256 | } |
268 | 257 | ||
269 | Items.LockItemsForRead(false); | 258 | Items.LockItemsForRead(false); |
270 | } | 259 | } |
271 | 260 | ||
261 | public bool TryGetScriptInstanceRunning(UUID itemId, out bool running) | ||
262 | { | ||
263 | running = false; | ||
264 | |||
265 | TaskInventoryItem item = GetInventoryItem(itemId); | ||
266 | |||
267 | if (item == null) | ||
268 | return false; | ||
269 | |||
270 | return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running); | ||
271 | } | ||
272 | |||
273 | public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running) | ||
274 | { | ||
275 | running = false; | ||
276 | |||
277 | if (item.InvType != (int)InventoryType.LSL) | ||
278 | return false; | ||
279 | |||
280 | IScriptModule[] engines = scene.RequestModuleInterfaces<IScriptModule>(); | ||
281 | if (engines == null) // No engine at all | ||
282 | return false; | ||
283 | |||
284 | foreach (IScriptModule e in engines) | ||
285 | { | ||
286 | if (e.HasScript(item.ItemID, out running)) | ||
287 | return true; | ||
288 | } | ||
289 | |||
290 | return false; | ||
291 | } | ||
292 | |||
272 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 293 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
273 | { | 294 | { |
274 | int scriptsValidForStarting = 0; | 295 | int scriptsValidForStarting = 0; |