From 6baa13ab7aeb7d0ee08f2460f52961dbd79bada1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 17 Feb 2012 09:12:41 -0800 Subject: Add new and updated script events --- OpenSim/Region/Framework/Scenes/EventManager.cs | 58 +++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 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 d31d380..34d3da7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -184,10 +184,62 @@ namespace OpenSim.Region.Framework.Scenes public event ClientClosed OnClientClosed; + // Fired when a script is created + // The indication that a new script exists in this region. + public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); + public event NewScript OnNewScript; + public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) + { + NewScript handlerNewScript = OnNewScript; + if (handlerNewScript != null) + { + foreach (NewScript d in handlerNewScript.GetInvocationList()) + { + try + { + d(clientID, part, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + + //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset + // An indication that the script has changed. + public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); + public event UpdateScript OnUpdateScript; + public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) + { + UpdateScript handlerUpdateScript = OnUpdateScript; + if (handlerUpdateScript != null) + { + foreach (UpdateScript d in handlerUpdateScript.GetInvocationList()) + { + try + { + d(clientId, itemId, primId, isScriptRunning, newAssetID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + /// - /// This is fired when a scene object property that a script might be interested in (such as color, scale or - /// inventory) changes. Only enough information is sent for the LSL changed event - /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) + /// ScriptChangedEvent is fired when a scene object property that a script might be interested + /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. + /// This is not an indication that the script has changed (see OnUpdateScript for that). + /// This event is sent to a script to tell it that some property changed on + /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . /// public event ScriptChangedEvent OnScriptChangedEvent; public delegate void ScriptChangedEvent(uint localID, uint change); -- cgit v1.1 From 784263f5e334aeda15effee599efc8bf546aa010 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 17 Feb 2012 13:43:14 -0800 Subject: Added the TriggerAvatarAppearanceChanged to EventManager. It's triggered by AvatarFactoryModule after an avatar's appearance has been succesfully changed and persisted (if the persist option is set). --- OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (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 d31d380..6586437 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -173,6 +173,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; + public delegate void AvatarAppearanceChange(ScenePresence avatar); + public event AvatarAppearanceChange OnAvatarAppearanceChange; + public event Action OnSignificantClientMovement; public delegate void IncomingInstantMessage(GridInstantMessage message); @@ -1238,6 +1241,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerAvatarAppearanceChanged(ScenePresence avatar) + { + AvatarAppearanceChange handler = OnAvatarAppearanceChange; + if (handler != null) + { + foreach (AvatarAppearanceChange d in handler.GetInvocationList()) + { + try + { + d(avatar); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerIncomingInstantMessage(GridInstantMessage message) { IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; -- cgit v1.1