try to be more friendly to HG

avinationmerge
UbitUmarov 2015-09-12 14:37:07 +01:00
parent 0eba5d25c3
commit dfc142a50f
2 changed files with 30 additions and 21 deletions

View File

@ -1093,16 +1093,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Well, this is it. The agent is over there. // Well, this is it. The agent is over there.
// KillEntity(sp.Scene, sp.LocalId); // KillEntity(sp.Scene, sp.LocalId);
sp.HasMovedAway(!OutSideViewRange); sp.HasMovedAway(!(OutSideViewRange || logout));
// call HG hook
AgentHasMovedAway(sp, logout);
sp.CloseChildAgents(destinationHandle,finalDestination.RegionSizeX,finalDestination.RegionSizeY); sp.CloseChildAgents(logout, destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
// Now let's make it officially a child agent // Now let's make it officially a child agent
sp.MakeChildAgent(destinationHandle); sp.MakeChildAgent(destinationHandle);
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (OutSideViewRange) if (NeedsClosing(reg, OutSideViewRange))
{ {
if (!sp.Scene.IncomingPreCloseClient(sp)) if (!sp.Scene.IncomingPreCloseClient(sp))
return; return;
@ -1227,7 +1230,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
sp.HasMovedAway(!OutSideViewRange); sp.HasMovedAway(!(OutSideViewRange || logout));
// Need to signal neighbours whether child agents may need closing irrespective of whether this // Need to signal neighbours whether child agents may need closing irrespective of whether this
// one needed closing. We also need to close child agents as quickly as possible to avoid complicated // one needed closing. We also need to close child agents as quickly as possible to avoid complicated
@ -1235,7 +1238,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex
// distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are
// abandoned without proper close by viewer but then re-used by an incoming connection. // abandoned without proper close by viewer but then re-used by an incoming connection.
sp.CloseChildAgents(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); sp.CloseChildAgents(logout, destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
// AgentHasMovedAway(sp, true); // AgentHasMovedAway(sp, true);
// Well, this is it. The agent is over there. // Well, this is it. The agent is over there.
@ -1244,8 +1247,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Now let's make it officially a child agent // Now let's make it officially a child agent
sp.MakeChildAgent(destinationHandle); sp.MakeChildAgent(destinationHandle);
//HG hook
AgentHasMovedAway(sp, logout);
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (OutSideViewRange) // go by HG hook
if (NeedsClosing(reg, OutSideViewRange))
{ {
if (!sp.Scene.IncomingPreCloseClient(sp)) if (!sp.Scene.IncomingPreCloseClient(sp))
return; return;
@ -1353,10 +1360,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// </summary> /// </summary>
/// <param name='sp'></param> /// <param name='sp'></param>
/// <param name='logout'></param> /// <param name='logout'></param>
///
/// now just a HG hook
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
{ {
if (sp.Scene.AttachmentsModule != null) // if (sp.Scene.AttachmentsModule != null)
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout); // sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout);
} }
protected void KillEntity(Scene scene, uint localID) protected void KillEntity(Scene scene, uint localID)
@ -1364,6 +1373,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
scene.SendKillObject(new List<uint> { localID }); scene.SendKillObject(new List<uint> { localID });
} }
// HG hook
protected virtual GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message) protected virtual GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
{ {
message = null; message = null;
@ -1391,15 +1401,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
oldsizeX, oldsizeY, newsizeX, newsizeY); oldsizeX, oldsizeY, newsizeX, newsizeY);
} }
/*
protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg)
{
return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, // HG Hook
oldsizeX, oldsizeY, newsizeX, newsizeY); protected virtual bool NeedsClosing(GridRegion reg, bool OutViewRange)
{
return OutViewRange;
} }
*/
#endregion #endregion
#region Landmark Teleport #region Landmark Teleport
@ -1877,7 +1886,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// but not sure yet what the side effects would be. // but not sure yet what the side effects would be.
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
// the user may change their profile information in other region, // the user may change their profile information in other region,

View File

@ -238,19 +238,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return region; return region;
} }
/* NEEDFIX
protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) protected override bool NeedsClosing(GridRegion reg, bool OutViewRange)
{ {
if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (OutViewRange)
return true; return true;
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
return true; return true;
return false; return false;
} }
*/
protected override void AgentHasMovedAway(ScenePresence sp, bool logout) protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
{ {
base.AgentHasMovedAway(sp, logout); base.AgentHasMovedAway(sp, logout);