aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs59
3 files changed, 83 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ec911a5..25223b9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2183,13 +2183,30 @@ namespace OpenSim.Region.Framework.Scenes
2183 /// <summary> 2183 /// <summary>
2184 /// Synchronously delete the given object from the scene. 2184 /// Synchronously delete the given object from the scene.
2185 /// </summary> 2185 /// </summary>
2186 /// <remarks>
2187 /// Scripts are also removed.
2188 /// </remarks>
2186 /// <param name="group">Object Id</param> 2189 /// <param name="group">Object Id</param>
2187 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 2190 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
2188 public void DeleteSceneObject(SceneObjectGroup group, bool silent) 2191 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
2192 {
2193 DeleteSceneObject(group, silent, true);
2194 }
2195
2196 /// <summary>
2197 /// Synchronously delete the given object from the scene.
2198 /// </summary>
2199 /// <param name="group">Object Id</param>
2200 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
2201 /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para>
2202 public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts)
2189 { 2203 {
2190// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); 2204// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
2191 2205
2192 group.RemoveScriptInstances(true); 2206 if (removeScripts)
2207 group.RemoveScriptInstances(true);
2208 else
2209 group.StopScriptInstances();
2193 2210
2194 SceneObjectPart[] partList = group.Parts; 2211 SceneObjectPart[] partList = group.Parts;
2195 2212
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 2866b54..ddf5da0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Stop the scripts contained in all the prims in this group 82 /// Stop and remove the scripts contained in all the prims in this group
83 /// </summary> 83 /// </summary>
84 /// <param name="sceneObjectBeingDeleted"> 84 /// <param name="sceneObjectBeingDeleted">
85 /// Should be true if these scripts are being removed because the scene 85 /// Should be true if these scripts are being removed because the scene
@@ -93,6 +93,14 @@ namespace OpenSim.Region.Framework.Scenes
93 } 93 }
94 94
95 /// <summary> 95 /// <summary>
96 /// Stop the scripts contained in all the prims in this group
97 /// </summary>
98 public void StopScriptInstances()
99 {
100 Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => p.Inventory.StopScriptInstances());
101 }
102
103 /// <summary>
96 /// Add an inventory item from a user's inventory to a prim in this scene object. 104 /// Add an inventory item from a user's inventory to a prim in this scene object.
97 /// </summary> 105 /// </summary>
98 /// <param name="agentID">The agent adding the item.</param> 106 /// <param name="agentID">The agent adding the item.</param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 866311a..cf2ed1a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -280,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
280 } 280 }
281 281
282 /// <summary> 282 /// <summary>
283 /// Stop all the scripts in this prim. 283 /// Stop and remove all the scripts in this prim.
284 /// </summary> 284 /// </summary>
285 /// <param name="sceneObjectBeingDeleted"> 285 /// <param name="sceneObjectBeingDeleted">
286 /// Should be true if these scripts are being removed because the scene 286 /// Should be true if these scripts are being removed because the scene
@@ -294,6 +294,14 @@ namespace OpenSim.Region.Framework.Scenes
294 } 294 }
295 295
296 /// <summary> 296 /// <summary>
297 /// Stop all the scripts in this prim.
298 /// </summary>
299 public void StopScriptInstances()
300 {
301 GetInventoryItems(InventoryType.LSL).ForEach(i => StopScriptInstance(i));
302 }
303
304 /// <summary>
297 /// Start a script which is in this prim's inventory. 305 /// Start a script which is in this prim's inventory.
298 /// </summary> 306 /// </summary>
299 /// <param name="item"></param> 307 /// <param name="item"></param>
@@ -443,7 +451,7 @@ namespace OpenSim.Region.Framework.Scenes
443 } 451 }
444 452
445 /// <summary> 453 /// <summary>
446 /// Stop a script which is in this prim's inventory. 454 /// Stop and remove a script which is in this prim's inventory.
447 /// </summary> 455 /// </summary>
448 /// <param name="itemId"></param> 456 /// <param name="itemId"></param>
449 /// <param name="sceneObjectBeingDeleted"> 457 /// <param name="sceneObjectBeingDeleted">
@@ -470,7 +478,36 @@ namespace OpenSim.Region.Framework.Scenes
470 } 478 }
471 else 479 else
472 { 480 {
473 m_log.ErrorFormat( 481 m_log.WarnFormat(
482 "[PRIM INVENTORY]: " +
483 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
484 itemId, m_part.Name, m_part.UUID,
485 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
486 }
487 }
488
489 /// <summary>
490 /// Stop a script which is in this prim's inventory.
491 /// </summary>
492 /// <param name="itemId"></param>
493 /// <param name="sceneObjectBeingDeleted">
494 /// Should be true if this script is being removed because the scene
495 /// object is being deleted. This will prevent spurious updates to the client.
496 /// </param>
497 public void StopScriptInstance(UUID itemId)
498 {
499 TaskInventoryItem scriptItem;
500
501 lock (m_items)
502 m_items.TryGetValue(itemId, out scriptItem);
503
504 if (scriptItem != null)
505 {
506 StopScriptInstance(scriptItem);
507 }
508 else
509 {
510 m_log.WarnFormat(
474 "[PRIM INVENTORY]: " + 511 "[PRIM INVENTORY]: " +
475 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", 512 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
476 itemId, m_part.Name, m_part.UUID, 513 itemId, m_part.Name, m_part.UUID,
@@ -479,6 +516,22 @@ namespace OpenSim.Region.Framework.Scenes
479 } 516 }
480 517
481 /// <summary> 518 /// <summary>
519 /// Stop a script which is in this prim's inventory.
520 /// </summary>
521 /// <param name="itemId"></param>
522 /// <param name="sceneObjectBeingDeleted">
523 /// Should be true if this script is being removed because the scene
524 /// object is being deleted. This will prevent spurious updates to the client.
525 /// </param>
526 public void StopScriptInstance(TaskInventoryItem item)
527 {
528 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID);
529
530 // At the moment, even stopped scripts are counted as active, which is probably wrong.
531// m_part.ParentGroup.AddActiveScriptCount(-1);
532 }
533
534 /// <summary>
482 /// Check if the inventory holds an item with a given name. 535 /// Check if the inventory holds an item with a given name.
483 /// </summary> 536 /// </summary>
484 /// <param name="name"></param> 537 /// <param name="name"></param>