mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
NeighbourHandler child agents distances control
This commit is contained in:
@@ -1938,10 +1938,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="region"></param>
|
||||
public void EnableChildAgent(ScenePresence sp, GridRegion region)
|
||||
{
|
||||
{
|
||||
int viewrange =(int) sp.RegionViewDistance;
|
||||
Vector3 pos = sp.AbsolutePosition;
|
||||
RegionInfo curregion = sp.Scene.RegionInfo;
|
||||
|
||||
int rtmp = region.RegionLocX - (int)Util.RegionToWorldLoc(curregion.RegionLocX) - (int)pos.X;
|
||||
if (rtmp < -(viewrange + region.RegionSizeX) || rtmp > viewrange + curregion.RegionSizeX)
|
||||
return;
|
||||
rtmp = region.RegionLocY - (int)Util.RegionToWorldLoc(curregion.RegionLocY) - (int)pos.Y;
|
||||
if (rtmp < -(viewrange + region.RegionSizeY) || rtmp > viewrange + curregion.RegionSizeY)
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
|
||||
|
||||
ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
|
||||
ulong currentRegionHandler = curregion.RegionHandle;
|
||||
ulong regionhandler = region.RegionHandle;
|
||||
|
||||
Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
|
||||
|
||||
@@ -1377,22 +1377,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// Let the grid service module know, so this can be cached
|
||||
m_eventManager.TriggerOnRegionUp(otherRegion);
|
||||
|
||||
try
|
||||
if (EntityTransferModule != null)
|
||||
{
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
try
|
||||
{
|
||||
List<ulong> old = new List<ulong>() {otherRegion.RegionHandle};
|
||||
agent.DropOldNeighbours(old);
|
||||
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
|
||||
List<ulong> old = new List<ulong>() { otherRegion.RegionHandle };
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
{
|
||||
if(agent.IsNPC)
|
||||
return;
|
||||
|
||||
agent.DropOldNeighbours(old);
|
||||
|
||||
if(agent.RegionViewDistance == 0)
|
||||
return;
|
||||
|
||||
EntityTransferModule.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");
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.Error("[SCENE]: Couldn't inform clients of regionup");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1408,12 +1415,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX;
|
||||
|
||||
if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX)
|
||||
if (tmp < -otherRegion.RegionSizeX || tmp > RegionInfo.RegionSizeX)
|
||||
return false;
|
||||
|
||||
tmp = otherRegion.RegionLocY - (int)RegionInfo.WorldLocY;
|
||||
|
||||
if (tmp < -otherRegion.RegionSizeY && tmp > RegionInfo.RegionSizeY)
|
||||
if (tmp < -otherRegion.RegionSizeY || tmp > RegionInfo.RegionSizeY)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1484,21 +1491,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_restartWaitTimer.Stop();
|
||||
lock (m_regionRestartNotifyList)
|
||||
{
|
||||
foreach (RegionInfo region in m_regionRestartNotifyList)
|
||||
if(EntityTransferModule != null)
|
||||
{
|
||||
GridRegion r = new GridRegion(region);
|
||||
try
|
||||
foreach (RegionInfo region in m_regionRestartNotifyList)
|
||||
{
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
GridRegion r = new GridRegion(region);
|
||||
try
|
||||
{
|
||||
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
|
||||
EntityTransferModule.EnableChildAgent(agent, r);
|
||||
});
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
// This means that we're not booted up completely yet.
|
||||
// This shouldn't happen too often anymore.
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
{
|
||||
if (!agent.IsNPC)
|
||||
EntityTransferModule.EnableChildAgent(agent, r);
|
||||
});
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
// This means that we're not booted up completely yet.
|
||||
// This shouldn't happen too often anymore.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@ namespace OpenSim.Server.Handlers.Base
|
||||
/// <summary>
|
||||
/// Extract the param from an uri.
|
||||
/// </summary>
|
||||
/// <param name="uri">Something like this: /xxxx/uuid/ or /uuid/handle/release</param>
|
||||
/// <param name="uri">uuid on uuid field</param>
|
||||
/// <param name="uri">Something like this: /xxxx/uuid/ or /xxxx/uuid/handle/release</param>
|
||||
/// <param name="uuid">uuid on uuid field</param>
|
||||
/// <param name="regionHandle">optional regionHandle</param>
|
||||
/// <param name="action">optional action</param>
|
||||
public static bool GetParams(string path, out UUID uuid, out ulong regionHandle, out string action)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user