aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-31 00:31:18 +0000
committerJustin Clark-Casey (justincc)2012-10-31 00:31:18 +0000
commit6235d16c3148bb6f9f881b0dc286deccfdf9148a (patch)
tree1d8d9e0b5bdf5872dbf6ff19f87c99593d3e2505 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-6235d16c3148bb6f9f881b0dc286deccfdf9148a.zip
opensim-SC_OLD-6235d16c3148bb6f9f881b0dc286deccfdf9148a.tar.gz
opensim-SC_OLD-6235d16c3148bb6f9f881b0dc286deccfdf9148a.tar.bz2
opensim-SC_OLD-6235d16c3148bb6f9f881b0dc286deccfdf9148a.tar.xz
Make "show object part" command correctly display script status.
Uses new IEntityInventory.TryGetScriptInstanceRunning() Makes it clearer that TaskInventoryItem.ScriptRunning cannot be used as it is temporary and not updated.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs52
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;