Add a new global event : OnTerrainUpdate

avinationmerge
Tom Grimshaw 2010-06-26 18:51:19 -07:00
parent c97e9f8621
commit 592ff1288d
2 changed files with 26 additions and 0 deletions

View File

@ -544,6 +544,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
m_scene.SaveTerrain();
m_scene.EventManager.TriggerTerrainUpdate();
// Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
//m_scene.CreateTerrainTexture(true);
}

View File

@ -55,8 +55,12 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnTerrainTickDelegate();
public delegate void OnTerrainUpdateDelegate();
public event OnTerrainTickDelegate OnTerrainTick;
public event OnTerrainUpdateDelegate OnTerrainUpdate;
public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
public event OnBackupDelegate OnBackup;
@ -716,6 +720,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
public void TriggerTerrainUpdate()
{
OnTerrainUpdateDelegate handlerTerrainUpdate = OnTerrainUpdate;
if (handlerTerrainUpdate != null)
{
foreach (OnTerrainUpdateDelegate d in handlerTerrainUpdate.GetInvocationList())
{
try
{
d();
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerTerrainTick()
{