diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index bdb0446..db723fa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -232,31 +232,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) | 232 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) |
233 | return; | 233 | return; |
234 | 234 | ||
235 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
236 | if (engines == null) // No engine at all | ||
237 | return; | ||
238 | |||
239 | lock (Items) | 235 | lock (Items) |
240 | { | 236 | { |
241 | foreach (TaskInventoryItem item in Items.Values) | 237 | foreach (TaskInventoryItem item in Items.Values) |
242 | { | 238 | { |
243 | if (item.InvType == (int)InventoryType.LSL) | 239 | bool running; |
244 | { | 240 | if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running)) |
245 | foreach (IScriptModule e in engines) | 241 | item.ScriptRunning = running; |
246 | { | ||
247 | bool running; | ||
248 | |||
249 | if (e.HasScript(item.ItemID, out running)) | ||
250 | { | ||
251 | item.ScriptRunning = running; | ||
252 | break; | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | } | 242 | } |
257 | } | 243 | } |
258 | } | 244 | } |
259 | 245 | ||
246 | public bool TryGetScriptInstanceRunning(UUID itemId, out bool running) | ||
247 | { | ||
248 | running = false; | ||
249 | |||
250 | TaskInventoryItem item = GetInventoryItem(itemId); | ||
251 | |||
252 | if (item == null) | ||
253 | return false; | ||
254 | |||
255 | return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running); | ||
256 | } | ||
257 | |||
258 | public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running) | ||
259 | { | ||
260 | running = false; | ||
261 | |||
262 | if (item.InvType != (int)InventoryType.LSL) | ||
263 | return false; | ||
264 | |||
265 | IScriptModule[] engines = scene.RequestModuleInterfaces<IScriptModule>(); | ||
266 | if (engines == null) // No engine at all | ||
267 | return false; | ||
268 | |||
269 | foreach (IScriptModule e in engines) | ||
270 | { | ||
271 | if (e.HasScript(item.ItemID, out running)) | ||
272 | return true; | ||
273 | } | ||
274 | |||
275 | return false; | ||
276 | } | ||
277 | |||
260 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 278 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
261 | { | 279 | { |
262 | int scriptsValidForStarting = 0; | 280 | int scriptsValidForStarting = 0; |