From 269a6410a04e1c8b7140bbbcfe4308d639e78773 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 19 Feb 2014 17:52:38 -0800 Subject: add EventManager event OnCrossAgentToNewRegion --- OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 2 files changed, 25 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 37b5776..1981a25 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -430,6 +430,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void IncomingInstantMessage(GridInstantMessage message); public event IncomingInstantMessage OnIncomingInstantMessage; + public delegate void CrossAgentToNewRegion(ScenePresence sp, bool isFlying); + public event CrossAgentToNewRegion OnCrossAgentToNewRegion; + public event IncomingInstantMessage OnUnhandledInstantMessage; public delegate void ClientClosed(UUID clientID, Scene scene); @@ -1960,6 +1963,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying) + { + CrossAgentToNewRegion handlerCrossAgentToNewRegion = OnCrossAgentToNewRegion; + if (handlerCrossAgentToNewRegion != null) + { + foreach (CrossAgentToNewRegion d in handlerCrossAgentToNewRegion.GetInvocationList()) + { + try + { + d(agent, isFlying); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerIncomingInstantMessage(GridInstantMessage message) { IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 676c000..06ddcbd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4358,6 +4358,7 @@ namespace OpenSim.Region.Framework.Scenes { if (EntityTransferModule != null) { + EventManager.TriggerCrossAgentToNewRegion(agent, isFlying); return EntityTransferModule.Cross(agent, isFlying); } else -- cgit v1.1