diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 49 |
2 files changed, 48 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 9d921de..8028d87 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -152,6 +152,19 @@ namespace OpenSim.Region.Framework.Interfaces | |||
152 | void StopScriptInstance(UUID itemId); | 152 | void StopScriptInstance(UUID itemId); |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Try to get the script running status. | ||
156 | /// </summary> | ||
157 | /// <returns> | ||
158 | /// Returns true if a script for the item was found in one of the simulator's script engines. In this case, | ||
159 | /// the running parameter will reflect the running status. | ||
160 | /// Returns false if the item could not be found, if the item is not a script or if a script instance for the | ||
161 | /// item was not found in any of the script engines. In this case, running status is irrelevant. | ||
162 | /// </returns> | ||
163 | /// <param name='itemId'></param> | ||
164 | /// <param name='running'></param> | ||
165 | bool TryGetScriptInstanceRunning(UUID itemId, out bool running); | ||
166 | |||
167 | /// <summary> | ||
155 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative | 168 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative |
156 | /// name is chosen. | 169 | /// name is chosen. |
157 | /// </summary> | 170 | /// </summary> |
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; |