From 586ae0f6a07358f8367c4f916bff9fd688a43aa3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Jul 2010 20:13:26 +0100 Subject: Add EventManager.OnSceneObjectLoaded() for future use. This is fired immediately after a scene object is loaded from storage. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 32 +++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 9db2e41..0b1f593 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -331,9 +331,16 @@ namespace OpenSim.Region.Framework.Scenes /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; + + public delegate void SceneObjectDelegate(SceneObjectGroup so); + + /// + /// Called immediately after an object is loaded from storage. + /// + public event SceneObjectDelegate OnSceneObjectLoaded; public delegate void RegionUp(GridRegion region); - public event RegionUp OnRegionUp; + public event RegionUp OnRegionUp; public class MoneyTransferArgs : EventArgs { @@ -2013,5 +2020,26 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) + { + SceneObjectDelegate handler = OnSceneObjectLoaded; + if (handler != null) + { + foreach (SceneObjectDelegate d in handler.GetInvocationList()) + { + try + { + d(so); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } } -} +} \ No newline at end of file -- cgit v1.1