diff options
author | Melanie | 2011-01-08 16:44:28 +0100 |
---|---|---|
committer | Melanie | 2011-01-08 16:44:28 +0100 |
commit | c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9 (patch) | |
tree | 65793a755315f256a6242d6126fe851a6a2c2951 /OpenSim/Region | |
parent | Fix a couple of security issues (diff) | |
download | opensim-SC_OLD-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.zip opensim-SC_OLD-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.gz opensim-SC_OLD-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.bz2 opensim-SC_OLD-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.xz |
Preserve the script running flag when copying an object.
Diffstat (limited to 'OpenSim/Region')
-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 |
3 files changed, 48 insertions, 0 deletions
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 | } |