Added EventManager.OnPrimsLoaded, an event that modules can hook up onto so that they know when the scene's objects have been loaded from the DB.

bulletsim
Diva Canto 2011-06-08 15:18:14 -07:00
parent 90f657d77d
commit 9759b2a4bb
2 changed files with 25 additions and 0 deletions

View File

@ -392,6 +392,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void LoginsEnabled(string regionName);
public event LoginsEnabled OnLoginsEnabled;
public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded;
public class MoneyTransferArgs : EventArgs
{
public UUID sender;
@ -2242,5 +2245,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
public void TriggerPrimsLoaded(Scene s)
{
PrimsLoaded handler = OnPrimsLoaded;
if (handler != null)
{
foreach (PrimsLoaded d in handler.GetInvocationList())
{
try
{
d(s);
}
catch (Exception e)
{
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
}
}

View File

@ -1754,6 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
LoadingPrims = false;
EventManager.TriggerPrimsLoaded(this);
}