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/Framework/Scenes/SceneObjectPartInventory.cs | |
parent | Fix a couple of security issues (diff) | |
download | opensim-SC-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.zip opensim-SC-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.gz opensim-SC-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.bz2 opensim-SC-c271bbcc8af1549666f6a5299a4b9ab9cf1c86d9.tar.xz |
Preserve the script running flag when copying an object.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 34 |
1 files changed, 34 insertions, 0 deletions
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 | } |