diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 97 |
1 files changed, 94 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 9db2e41..0ae3146 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -330,10 +330,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
330 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | 330 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then |
331 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | 331 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). |
332 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 332 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
333 | public event Attach OnAttach; | 333 | public event Attach OnAttach; |
334 | |||
335 | /// <summary> | ||
336 | /// Called immediately after an object is loaded from storage. | ||
337 | /// </summary> | ||
338 | public event SceneObjectDelegate OnSceneObjectLoaded; | ||
339 | public delegate void SceneObjectDelegate(SceneObjectGroup so); | ||
340 | |||
341 | /// <summary> | ||
342 | /// Called immediately before an object is saved to storage. | ||
343 | /// </summary> | ||
344 | /// <param name="persistingSo"> | ||
345 | /// The scene object being persisted. | ||
346 | /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. | ||
347 | /// </param> | ||
348 | /// <param name="originalSo"> | ||
349 | /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save. | ||
350 | /// </param> | ||
351 | public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; | ||
352 | public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); | ||
353 | |||
354 | /// <summary> | ||
355 | /// Called when a scene object part is cloned within the region. | ||
356 | /// </summary> | ||
357 | /// <param name="copy"></param> | ||
358 | /// <param name="original"></param> | ||
359 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | ||
360 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; | ||
361 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | ||
334 | 362 | ||
335 | public delegate void RegionUp(GridRegion region); | 363 | public delegate void RegionUp(GridRegion region); |
336 | public event RegionUp OnRegionUp; | 364 | public event RegionUp OnRegionUp; |
337 | 365 | ||
338 | public class MoneyTransferArgs : EventArgs | 366 | public class MoneyTransferArgs : EventArgs |
339 | { | 367 | { |
@@ -2013,5 +2041,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
2013 | } | 2041 | } |
2014 | } | 2042 | } |
2015 | } | 2043 | } |
2044 | |||
2045 | public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) | ||
2046 | { | ||
2047 | SceneObjectDelegate handler = OnSceneObjectLoaded; | ||
2048 | if (handler != null) | ||
2049 | { | ||
2050 | foreach (SceneObjectDelegate d in handler.GetInvocationList()) | ||
2051 | { | ||
2052 | try | ||
2053 | { | ||
2054 | d(so); | ||
2055 | } | ||
2056 | catch (Exception e) | ||
2057 | { | ||
2058 | m_log.ErrorFormat( | ||
2059 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", | ||
2060 | e.Message, e.StackTrace); | ||
2061 | } | ||
2062 | } | ||
2063 | } | ||
2064 | } | ||
2065 | |||
2066 | public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) | ||
2067 | { | ||
2068 | SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave; | ||
2069 | if (handler != null) | ||
2070 | { | ||
2071 | foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList()) | ||
2072 | { | ||
2073 | try | ||
2074 | { | ||
2075 | d(persistingSo, originalSo); | ||
2076 | } | ||
2077 | catch (Exception e) | ||
2078 | { | ||
2079 | m_log.ErrorFormat( | ||
2080 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}", | ||
2081 | e.Message, e.StackTrace); | ||
2082 | } | ||
2083 | } | ||
2084 | } | ||
2085 | } | ||
2086 | |||
2087 | public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) | ||
2088 | { | ||
2089 | SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy; | ||
2090 | if (handler != null) | ||
2091 | { | ||
2092 | foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList()) | ||
2093 | { | ||
2094 | try | ||
2095 | { | ||
2096 | d(copy, original, userExposed); | ||
2097 | } | ||
2098 | catch (Exception e) | ||
2099 | { | ||
2100 | m_log.ErrorFormat( | ||
2101 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", | ||
2102 | e.Message, e.StackTrace); | ||
2103 | } | ||
2104 | } | ||
2105 | } | ||
2106 | } | ||
2016 | } | 2107 | } |
2017 | } | 2108 | } \ No newline at end of file |