diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index fd78fd6349..bf2244e14c 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -481,19 +481,17 @@ namespace OpenSim.Region.Scenes { try { - - // MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); - Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); this.Entities.Add(prim.uuid, prim); this._primCount++; + + // Trigger event for listeners + eventManager.TriggerOnNewPrimitive(prim); } catch (Exception e) { - - // MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); - + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); } } @@ -583,6 +581,8 @@ namespace OpenSim.Region.Scenes /// public override void RemoveClient(LLUUID agentID) { + eventManager.TriggerOnRemovePresence(agentID); + return; } #endregion diff --git a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs b/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs index 86ec9df4ba..2898578fa7 100644 --- a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs +++ b/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs @@ -7,17 +7,20 @@ namespace OpenSim.Region.Scenes /// /// A class for triggering remote scene events. /// - class EventManager + public class EventManager { public delegate void OnFrameDelegate(); public event OnFrameDelegate OnFrame; - public delegate void OnNewViewerDelegate(); - public event OnNewViewerDelegate OnNewViewer; + public delegate void OnNewPresenceDelegate(ScenePresence presence); + public event OnNewPresenceDelegate OnNewPresence; - public delegate void OnNewPrimitiveDelegate(); + public delegate void OnNewPrimitiveDelegate(Primitive prim); public event OnNewPrimitiveDelegate OnNewPrimitive; + public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); + public event OnRemovePresenceDelegate OnRemovePresence; + public void TriggerOnFrame() { if (OnFrame != null) @@ -25,5 +28,25 @@ namespace OpenSim.Region.Scenes OnFrame(); } } + + public void TriggerOnNewPrimitive(Primitive prim) + { + if (OnNewPrimitive != null) + OnNewPrimitive(prim); + } + + public void TriggerOnNewPresence(ScenePresence presence) + { + if (OnNewPresence != null) + OnNewPresence(presence); + } + + public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) + { + if (OnRemovePresence != null) + { + OnRemovePresence(uuid); + } + } } }