Trigger event when scene presences are updated

0.7.4.1
Dan Lake 2012-05-08 16:05:34 -07:00
parent ef279c5a62
commit 20952c75c5
2 changed files with 34 additions and 0 deletions

View File

@ -480,6 +480,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void SceneObjectPartUpdated(SceneObjectPart sop); public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
public event SceneObjectPartUpdated OnSceneObjectPartUpdated; public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
public delegate void ScenePresenceUpdated(ScenePresence sp);
public event ScenePresenceUpdated OnScenePresenceUpdated;
public delegate void RegionUp(GridRegion region); public delegate void RegionUp(GridRegion region);
public event RegionUp OnRegionUp; 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, public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
int local_id, IClientAPI remote_client) int local_id, IClientAPI remote_client)
{ {

View File

@ -76,6 +76,11 @@ namespace OpenSim.Region.Framework.Scenes
// { // {
// m_log.Debug("[SCENE PRESENCE] Destructor called"); // 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); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -489,6 +494,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat( //m_log.DebugFormat(
// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
// Scene.RegionInfo.RegionName, Name, m_pos); // Scene.RegionInfo.RegionName, Name, m_pos);
TriggerScenePresenceUpdated();
} }
} }
@ -508,6 +514,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
m_pos = value; m_pos = value;
TriggerScenePresenceUpdated();
} }
} }
@ -1523,6 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_scene.EventManager.TriggerOnClientMovement(this); m_scene.EventManager.TriggerOnClientMovement(this);
TriggerScenePresenceUpdated();
} }
/// <summary> /// <summary>
@ -2419,6 +2427,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.ForEachClient(SendTerseUpdateToClient); m_scene.ForEachClient(SendTerseUpdateToClient);
} }
TriggerScenePresenceUpdated();
} }
public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@ -3195,6 +3204,7 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = force; Velocity = force;
m_forceToApply = null; m_forceToApply = null;
TriggerScenePresenceUpdated();
} }
} }