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