diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index b3debb0296..ace83135d8 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -480,6 +480,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void SceneObjectPartUpdated(SceneObjectPart sop); public event SceneObjectPartUpdated OnSceneObjectPartUpdated; + public delegate void ScenePresenceUpdated(ScenePresence sp); + public event ScenePresenceUpdated OnScenePresenceUpdated; + public delegate void RegionUp(GridRegion region); public event RegionUp OnRegionUp; @@ -2343,6 +2346,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerScenePresenceUpdated(ScenePresence sp) + { + ScenePresenceUpdated handler = OnScenePresenceUpdated; + if (handler != null) + { + foreach (ScenePresenceUpdated d in handler.GetInvocationList()) + { + try + { + d(sp); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7e49a5e2cc..c552447836 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -76,6 +76,11 @@ namespace OpenSim.Region.Framework.Scenes // { // m_log.Debug("[SCENE PRESENCE] Destructor called"); // } + private void TriggerScenePresenceUpdated() + { + if (m_scene != null) + m_scene.EventManager.TriggerScenePresenceUpdated(this); + } private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -489,6 +494,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat( // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", // Scene.RegionInfo.RegionName, Name, m_pos); + TriggerScenePresenceUpdated(); } } @@ -508,6 +514,7 @@ namespace OpenSim.Region.Framework.Scenes return; m_pos = value; + TriggerScenePresenceUpdated(); } } @@ -1523,6 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes } m_scene.EventManager.TriggerOnClientMovement(this); + TriggerScenePresenceUpdated(); } /// @@ -2419,6 +2427,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene.ForEachClient(SendTerseUpdateToClient); } + TriggerScenePresenceUpdated(); } public void SendCoarseLocations(List coarseLocations, List avatarUUIDs) @@ -3195,6 +3204,7 @@ namespace OpenSim.Region.Framework.Scenes Velocity = force; m_forceToApply = null; + TriggerScenePresenceUpdated(); } }