aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/EventManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs39
1 files changed, 36 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 0b1f593..3b8d727 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -330,14 +330,26 @@ 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 public delegate void SceneObjectDelegate(SceneObjectGroup so);
336 334
337 /// <summary> 335 /// <summary>
338 /// Called immediately after an object is loaded from storage. 336 /// Called immediately after an object is loaded from storage.
339 /// </summary> 337 /// </summary>
340 public event SceneObjectDelegate OnSceneObjectLoaded; 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);
341 353
342 public delegate void RegionUp(GridRegion region); 354 public delegate void RegionUp(GridRegion region);
343 public event RegionUp OnRegionUp; 355 public event RegionUp OnRegionUp;
@@ -2040,6 +2052,27 @@ namespace OpenSim.Region.Framework.Scenes
2040 } 2052 }
2041 } 2053 }
2042 } 2054 }
2055 }
2056
2057 public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
2058 {
2059 SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
2060 if (handler != null)
2061 {
2062 foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
2063 {
2064 try
2065 {
2066 d(persistingSo, originalSo);
2067 }
2068 catch (Exception e)
2069 {
2070 m_log.ErrorFormat(
2071 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
2072 e.Message, e.StackTrace);
2073 }
2074 }
2075 }
2043 } 2076 }
2044 } 2077 }
2045} \ No newline at end of file 2078} \ No newline at end of file