aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs59
1 files changed, 56 insertions, 3 deletions
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>