Add an event for an orderly region shutdown that fires once per region before
the SceneGraph is torn down.bulletsim
parent
24c00acedc
commit
178d541dca
|
@ -111,6 +111,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
public delegate void SceneShuttingDownDelegate(Scene scene);
|
||||
|
||||
public event SceneShuttingDownDelegate OnSceneShuttingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when an object is touched/grabbed.
|
||||
/// </summary>
|
||||
|
@ -2193,5 +2197,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerSceneShuttingDown(Scene s)
|
||||
{
|
||||
SceneShuttingDownDelegate handler = OnSceneShuttingDown;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(s);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1064,6 +1064,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
shuttingdown = true;
|
||||
|
||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||
EventManager.TriggerSceneShuttingDown(this);
|
||||
|
||||
EntityBase[] entities = GetEntities();
|
||||
foreach (EntityBase entity in entities)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue