diff options
-rw-r--r-- | OpenSim/Framework/TaskInventoryItem.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IScriptModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 12 |
4 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 248502e..be2b8c8 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -124,6 +124,9 @@ namespace OpenSim.Framework | |||
124 | private UUID _oldID = UUID.Zero; | 124 | private UUID _oldID = UUID.Zero; |
125 | 125 | ||
126 | private bool _ownerChanged = false; | 126 | private bool _ownerChanged = false; |
127 | |||
128 | // This used ONLY during copy. It can't be relied on at other times! | ||
129 | private bool _scriptRunning = true; | ||
127 | 130 | ||
128 | public UUID AssetID { | 131 | public UUID AssetID { |
129 | get { | 132 | get { |
@@ -387,6 +390,15 @@ namespace OpenSim.Framework | |||
387 | } | 390 | } |
388 | } | 391 | } |
389 | 392 | ||
393 | public bool ScriptRunning { | ||
394 | get { | ||
395 | return _scriptRunning; | ||
396 | } | ||
397 | set { | ||
398 | _scriptRunning = value; | ||
399 | } | ||
400 | } | ||
401 | |||
390 | // See ICloneable | 402 | // See ICloneable |
391 | 403 | ||
392 | #region ICloneable Members | 404 | #region ICloneable Members |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index fecdd1b..4a3c634 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -50,5 +50,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
50 | void ResumeScript(UUID itemID); | 50 | void ResumeScript(UUID itemID); |
51 | 51 | ||
52 | ArrayList GetScriptErrors(UUID itemID); | 52 | ArrayList GetScriptErrors(UUID itemID); |
53 | |||
54 | bool HasScript(UUID itemID, out bool running); | ||
53 | } | 55 | } |
54 | } | 56 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5a39941..6c56dc3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -94,6 +94,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
94 | { | 94 | { |
95 | m_items = value; | 95 | m_items = value; |
96 | m_inventorySerial++; | 96 | m_inventorySerial++; |
97 | QueryScriptStates(); | ||
97 | } | 98 | } |
98 | } | 99 | } |
99 | 100 | ||
@@ -226,6 +227,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | m_items.LockItemsForWrite(false); | 227 | m_items.LockItemsForWrite(false); |
227 | } | 228 | } |
228 | 229 | ||
230 | private void QueryScriptStates() | ||
231 | { | ||
232 | if (m_part == null || m_part.ParentGroup == null) | ||
233 | return; | ||
234 | |||
235 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
236 | if (engines == null) // No engine at all | ||
237 | return; | ||
238 | |||
239 | Items.LockItemsForRead(true); | ||
240 | foreach (TaskInventoryItem item in Items.Values) | ||
241 | { | ||
242 | if (item.InvType == (int)InventoryType.LSL) | ||
243 | { | ||
244 | foreach (IScriptModule e in engines) | ||
245 | { | ||
246 | bool running; | ||
247 | |||
248 | if (e.HasScript(item.ItemID, out running)) | ||
249 | { | ||
250 | item.ScriptRunning = running; | ||
251 | break; | ||
252 | } | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 | Items.LockItemsForRead(false); | ||
258 | } | ||
259 | |||
229 | /// <summary> | 260 | /// <summary> |
230 | /// Start all the scripts contained in this prim's inventory | 261 | /// Start all the scripts contained in this prim's inventory |
231 | /// </summary> | 262 | /// </summary> |
@@ -349,6 +380,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
349 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 380 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
350 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | 381 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); |
351 | StoreScriptErrors(item.ItemID, null); | 382 | StoreScriptErrors(item.ItemID, null); |
383 | if (!item.ScriptRunning) | ||
384 | m_part.ParentGroup.Scene.EventManager.TriggerStopScript( | ||
385 | m_part.LocalId, item.ItemID); | ||
352 | m_part.ParentGroup.AddActiveScriptCount(1); | 386 | m_part.ParentGroup.AddActiveScriptCount(1); |
353 | m_part.ScheduleFullUpdate(); | 387 | m_part.ScheduleFullUpdate(); |
354 | } | 388 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 35cc65b..6bdd4c8 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1695,5 +1695,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1695 | 1695 | ||
1696 | instance.Resume(); | 1696 | instance.Resume(); |
1697 | } | 1697 | } |
1698 | |||
1699 | public bool HasScript(UUID itemID, out bool running) | ||
1700 | { | ||
1701 | running = true; | ||
1702 | |||
1703 | IScriptInstance instance = GetInstance(itemID); | ||
1704 | if (instance == null) | ||
1705 | return false; | ||
1706 | |||
1707 | running = instance.Running; | ||
1708 | return true; | ||
1709 | } | ||
1698 | } | 1710 | } |
1699 | } | 1711 | } |