diff options
author | Robert Adams | 2013-02-14 09:48:11 -0800 |
---|---|---|
committer | Robert Adams | 2013-02-14 09:48:11 -0800 |
commit | 5920abbf8d1b1770c03bc6232f1afe0551b4a331 (patch) | |
tree | 199015d36f52cb5e1c562a3f332d36aa9f3c0aae /OpenSim/Region/Framework/Scenes/EventManager.cs | |
parent | Add an event and some logic to allow customizing Simulator Features by avatar (diff) | |
download | opensim-SC_OLD-5920abbf8d1b1770c03bc6232f1afe0551b4a331.zip opensim-SC_OLD-5920abbf8d1b1770c03bc6232f1afe0551b4a331.tar.gz opensim-SC_OLD-5920abbf8d1b1770c03bc6232f1afe0551b4a331.tar.bz2 opensim-SC_OLD-5920abbf8d1b1770c03bc6232f1afe0551b4a331.tar.xz |
Add EventManager events triggered when a SOP is added or removed
from the physical scene. Invocations added in SceneObjectPart.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 9ee1520..59d0148 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -791,6 +791,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
791 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 791 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
792 | 792 | ||
793 | /// <summary> | 793 | /// <summary> |
794 | /// Triggered when an object is placed into the physical scene (PhysicsActor created). | ||
795 | /// </summary> | ||
796 | public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene; | ||
797 | /// <summary> | ||
798 | /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed). | ||
799 | /// </summary> | ||
800 | /// <remarks> | ||
801 | /// Note: this is triggered just before the PhysicsActor is removed from the | ||
802 | /// physics engine so the receiver can do any necessary cleanup before its destruction. | ||
803 | /// </remarks> | ||
804 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | ||
805 | |||
806 | /// <summary> | ||
794 | /// Triggered when an object is removed from the scene. | 807 | /// Triggered when an object is removed from the scene. |
795 | /// </summary> | 808 | /// </summary> |
796 | /// <remarks> | 809 | /// <remarks> |
@@ -1516,6 +1529,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1516 | } | 1529 | } |
1517 | } | 1530 | } |
1518 | 1531 | ||
1532 | public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) | ||
1533 | { | ||
1534 | Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene; | ||
1535 | if (handler != null) | ||
1536 | { | ||
1537 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1538 | { | ||
1539 | try | ||
1540 | { | ||
1541 | d(obj); | ||
1542 | } | ||
1543 | catch (Exception e) | ||
1544 | { | ||
1545 | m_log.ErrorFormat( | ||
1546 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", | ||
1547 | e.Message, e.StackTrace); | ||
1548 | } | ||
1549 | } | ||
1550 | } | ||
1551 | } | ||
1552 | |||
1553 | public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) | ||
1554 | { | ||
1555 | Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene; | ||
1556 | if (handler != null) | ||
1557 | { | ||
1558 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1559 | { | ||
1560 | try | ||
1561 | { | ||
1562 | d(obj); | ||
1563 | } | ||
1564 | catch (Exception e) | ||
1565 | { | ||
1566 | m_log.ErrorFormat( | ||
1567 | "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", | ||
1568 | e.Message, e.StackTrace); | ||
1569 | } | ||
1570 | } | ||
1571 | } | ||
1572 | } | ||
1573 | |||
1519 | public void TriggerShutdown() | 1574 | public void TriggerShutdown() |
1520 | { | 1575 | { |
1521 | Action handlerShutdown = OnShutdown; | 1576 | Action handlerShutdown = OnShutdown; |