diff options
Merge branch 'master' into careminster-presence-refactor
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 e060c05..52e6e92 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -334,10 +334,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
334 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | 334 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then |
335 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | 335 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). |
336 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 336 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
337 | public event Attach OnAttach; | 337 | public event Attach OnAttach; |
338 | |||
339 | /// <summary> | ||
340 | /// Called immediately after an object is loaded from storage. | ||
341 | /// </summary> | ||
342 | public event SceneObjectDelegate OnSceneObjectLoaded; | ||
343 | public delegate void SceneObjectDelegate(SceneObjectGroup so); | ||
344 | |||
345 | /// <summary> | ||
346 | /// Called immediately before an object is saved to storage. | ||
347 | /// </summary> | ||
348 | /// <param name="persistingSo"> | ||
349 | /// The scene object being persisted. | ||
350 | /// 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. | ||
351 | /// </param> | ||
352 | /// <param name="originalSo"> | ||
353 | /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save. | ||
354 | /// </param> | ||
355 | public event SceneObjectPreSaveDelegate OnSceneObjectPreSave; | ||
356 | public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo); | ||
357 | |||
358 | /// <summary> | ||
359 | /// Called when a scene object part is cloned within the region. | ||
360 | /// </summary> | ||
361 | /// <param name="copy"></param> | ||
362 | /// <param name="original"></param> | ||
363 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | ||
364 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; | ||
365 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | ||
338 | 366 | ||
339 | public delegate void RegionUp(GridRegion region); | 367 | public delegate void RegionUp(GridRegion region); |
340 | public event RegionUp OnRegionUp; | 368 | public event RegionUp OnRegionUp; |
341 | 369 | ||
342 | public class MoneyTransferArgs : EventArgs | 370 | public class MoneyTransferArgs : EventArgs |
343 | { | 371 | { |
@@ -2037,5 +2065,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | } | 2065 | } |
2038 | } | 2066 | } |
2039 | } | 2067 | } |
2068 | |||
2069 | public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) | ||
2070 | { | ||
2071 | SceneObjectDelegate handler = OnSceneObjectLoaded; | ||
2072 | if (handler != null) | ||
2073 | { | ||
2074 | foreach (SceneObjectDelegate d in handler.GetInvocationList()) | ||
2075 | { | ||
2076 | try | ||
2077 | { | ||
2078 | d(so); | ||
2079 | } | ||
2080 | catch (Exception e) | ||
2081 | { | ||
2082 | m_log.ErrorFormat( | ||
2083 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", | ||
2084 | e.Message, e.StackTrace); | ||
2085 | } | ||
2086 | } | ||
2087 | } | ||
2088 | } | ||
2089 | |||
2090 | public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) | ||
2091 | { | ||
2092 | SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave; | ||
2093 | if (handler != null) | ||
2094 | { | ||
2095 | foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList()) | ||
2096 | { | ||
2097 | try | ||
2098 | { | ||
2099 | d(persistingSo, originalSo); | ||
2100 | } | ||
2101 | catch (Exception e) | ||
2102 | { | ||
2103 | m_log.ErrorFormat( | ||
2104 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}", | ||
2105 | e.Message, e.StackTrace); | ||
2106 | } | ||
2107 | } | ||
2108 | } | ||
2109 | } | ||
2110 | |||
2111 | public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) | ||
2112 | { | ||
2113 | SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy; | ||
2114 | if (handler != null) | ||
2115 | { | ||
2116 | foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList()) | ||
2117 | { | ||
2118 | try | ||
2119 | { | ||
2120 | d(copy, original, userExposed); | ||
2121 | } | ||
2122 | catch (Exception e) | ||
2123 | { | ||
2124 | m_log.ErrorFormat( | ||
2125 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", | ||
2126 | e.Message, e.StackTrace); | ||
2127 | } | ||
2128 | } | ||
2129 | } | ||
2130 | } | ||
2040 | } | 2131 | } |
2041 | } | 2132 | } \ No newline at end of file |