public override void OtherRegionUp(GridRegion otherRegion)
{
uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{
// If these are cast to INT because long + negative values + abs returns invalid data
int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
if (resultX <= 1 && resultY <= 1)
{
// Let the grid service module know, so this can be cached
m_eventManager.TriggerOnRegionUp(otherRegion);
try
{
ForEachScenePresence(delegate(ScenePresence agent)
{
// If agent is a root agent.
if (!agent.IsChildAgent)
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
List<ulong> old = new List<ulong>();
old.Add(otherRegion.RegionHandle);
agent.DropOldNeighbours(old);
if (m_teleportModule != null)
m_teleportModule.EnableChildAgent(agent, otherRegion);
}
}
);
}
catch (NullReferenceException)
{
// This means that we're not booted up completely yet.
// This shouldn't happen too often anymore.
m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
}
}
else
{
m_log.Info("[INTERGRID]: Got notice about far away Region: " + otherRegion.RegionName.ToString() +
" at (" + otherRegion.RegionLocX.ToString() + ", " +
otherRegion.RegionLocY.ToString() + ")");
}
}
}