diff options
author | UbitUmarov | 2015-08-30 19:17:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-30 19:17:35 +0100 |
commit | 0edffae7e42c0705303e015036fa85687508ecf0 (patch) | |
tree | ba27f1567c7c351e4befd032b948fb3423fa0ca4 /OpenSim/Region | |
parent | cache in memory water texture (diff) | |
download | opensim-SC-0edffae7e42c0705303e015036fa85687508ecf0.zip opensim-SC-0edffae7e42c0705303e015036fa85687508ecf0.tar.gz opensim-SC-0edffae7e42c0705303e015036fa85687508ecf0.tar.bz2 opensim-SC-0edffae7e42c0705303e015036fa85687508ecf0.tar.xz |
more on tps and crossings
Diffstat (limited to 'OpenSim/Region')
3 files changed, 193 insertions, 157 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 49d3b9b..efee080 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -724,10 +724,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | 726 | ||
727 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | ||
728 | Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); | ||
729 | Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY); | ||
730 | |||
731 | ulong destinationHandle = finalDestination.RegionHandle; | 727 | ulong destinationHandle = finalDestination.RegionHandle; |
732 | 728 | ||
733 | // Let's do DNS resolution only once in this process, please! | 729 | // Let's do DNS resolution only once in this process, please! |
@@ -815,7 +811,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
815 | } | 811 | } |
816 | 812 | ||
817 | IClientIPEndpoint ipepClient; | 813 | IClientIPEndpoint ipepClient; |
818 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 814 | |
815 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | ||
816 | Util.RegionHandleToRegionLoc(destinationHandle, out newRegionX, out newRegionY); | ||
817 | Util.RegionHandleToRegionLoc(sourceRegion.RegionHandle, out oldRegionX, out oldRegionY); | ||
818 | int oldSizeX = (int)sourceRegion.RegionSizeX; | ||
819 | int oldSizeY = (int)sourceRegion.RegionSizeY; | ||
820 | int newSizeX = finalDestination.RegionSizeX; | ||
821 | int newSizeY = finalDestination.RegionSizeY; | ||
822 | |||
823 | bool OutSideViewRange = NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, | ||
824 | oldSizeX, oldSizeY, newSizeX, newSizeY); | ||
825 | |||
826 | if (OutSideViewRange) | ||
819 | { | 827 | { |
820 | m_log.DebugFormat( | 828 | m_log.DebugFormat( |
821 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", | 829 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", |
@@ -846,13 +854,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
846 | float.TryParse(versionComponents[1], out versionNumber); | 854 | float.TryParse(versionComponents[1], out versionNumber); |
847 | 855 | ||
848 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) | 856 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) |
849 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 857 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); |
850 | else | 858 | else |
851 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 859 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); |
852 | } | 860 | } |
853 | 861 | ||
854 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 862 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
855 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) | 863 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) |
856 | { | 864 | { |
857 | ulong destinationHandle = finalDestination.RegionHandle; | 865 | ulong destinationHandle = finalDestination.RegionHandle; |
858 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 866 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -904,9 +912,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
904 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 912 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
905 | 913 | ||
906 | // OK, it got this agent. Let's close some child agents | 914 | // OK, it got this agent. Let's close some child agents |
907 | |||
908 | 915 | ||
909 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 916 | |
917 | if (OutSideViewRange) | ||
910 | { | 918 | { |
911 | if (m_eqModule != null) | 919 | if (m_eqModule != null) |
912 | { | 920 | { |
@@ -1065,17 +1073,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1065 | // Well, this is it. The agent is over there. | 1073 | // Well, this is it. The agent is over there. |
1066 | // KillEntity(sp.Scene, sp.LocalId); | 1074 | // KillEntity(sp.Scene, sp.LocalId); |
1067 | 1075 | ||
1068 | bool l_needsclosing = NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg); | 1076 | sp.HasMovedAway(!OutSideViewRange); |
1069 | sp.HasMovedAway(!l_needsclosing); | ||
1070 | 1077 | ||
1071 | sp.CloseChildAgents(newRegionX, newRegionY); | 1078 | sp.CloseChildAgents(destinationHandle,finalDestination.RegionSizeX,finalDestination.RegionSizeY); |
1072 | 1079 | ||
1073 | // Now let's make it officially a child agent | 1080 | // Now let's make it officially a child agent |
1074 | sp.MakeChildAgent(destinationHandle); | 1081 | sp.MakeChildAgent(destinationHandle); |
1075 | 1082 | ||
1076 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1083 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1077 | 1084 | ||
1078 | if (l_needsclosing) | 1085 | if (OutSideViewRange) |
1079 | { | 1086 | { |
1080 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1087 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1081 | return; | 1088 | return; |
@@ -1090,17 +1097,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1090 | 1097 | ||
1091 | sp.Scene.CloseAgent(sp.UUID, false); | 1098 | sp.Scene.CloseAgent(sp.UUID, false); |
1092 | } | 1099 | } |
1093 | /* | ||
1094 | else | ||
1095 | { | ||
1096 | // now we have a child agent in this region. | ||
1097 | sp.Reset(); | ||
1098 | } | ||
1099 | */ | ||
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 1102 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
1103 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) | 1103 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) |
1104 | { | 1104 | { |
1105 | ulong destinationHandle = finalDestination.RegionHandle; | 1105 | ulong destinationHandle = finalDestination.RegionHandle; |
1106 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1106 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1207,8 +1207,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1207 | 1207 | ||
1208 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1208 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1209 | 1209 | ||
1210 | bool l_needsclosing = NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg); | 1210 | sp.HasMovedAway(!OutSideViewRange); |
1211 | sp.HasMovedAway(!l_needsclosing); | ||
1212 | 1211 | ||
1213 | // Need to signal neighbours whether child agents may need closing irrespective of whether this | 1212 | // Need to signal neighbours whether child agents may need closing irrespective of whether this |
1214 | // one needed closing. We also need to close child agents as quickly as possible to avoid complicated | 1213 | // one needed closing. We also need to close child agents as quickly as possible to avoid complicated |
@@ -1216,7 +1215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1216 | // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex | 1215 | // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex |
1217 | // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are | 1216 | // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are |
1218 | // abandoned without proper close by viewer but then re-used by an incoming connection. | 1217 | // abandoned without proper close by viewer but then re-used by an incoming connection. |
1219 | sp.CloseChildAgents(newRegionX, newRegionY); | 1218 | sp.CloseChildAgents(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); |
1220 | 1219 | ||
1221 | // AgentHasMovedAway(sp, true); | 1220 | // AgentHasMovedAway(sp, true); |
1222 | // Well, this is it. The agent is over there. | 1221 | // Well, this is it. The agent is over there. |
@@ -1226,7 +1225,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1226 | sp.MakeChildAgent(destinationHandle); | 1225 | sp.MakeChildAgent(destinationHandle); |
1227 | 1226 | ||
1228 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1227 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1229 | if (l_needsclosing) | 1228 | if (OutSideViewRange) |
1230 | { | 1229 | { |
1231 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1230 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1232 | return; | 1231 | return; |
@@ -1350,7 +1349,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1350 | // This returns 'true' if the new region already has a child agent for our | 1349 | // This returns 'true' if the new region already has a child agent for our |
1351 | // incoming agent. The implication is that, if 'false', we have to create the | 1350 | // incoming agent. The implication is that, if 'false', we have to create the |
1352 | // child and then teleport into the region. | 1351 | // child and then teleport into the region. |
1353 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 1352 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, |
1353 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) | ||
1354 | { | 1354 | { |
1355 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 1355 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
1356 | { | 1356 | { |
@@ -1363,17 +1363,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1363 | 1363 | ||
1364 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); | 1364 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); |
1365 | } | 1365 | } |
1366 | else | ||
1367 | { | ||
1368 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1369 | } | ||
1370 | } | ||
1371 | 1366 | ||
1372 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 1367 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, |
1373 | { | 1368 | oldsizeX, oldsizeY, newsizeX, newsizeY); |
1374 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1375 | } | 1369 | } |
1370 | /* | ||
1371 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, | ||
1372 | uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) | ||
1373 | { | ||
1376 | 1374 | ||
1375 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, | ||
1376 | oldsizeX, oldsizeY, newsizeX, newsizeY); | ||
1377 | } | ||
1378 | */ | ||
1377 | #endregion | 1379 | #endregion |
1378 | 1380 | ||
1379 | #region Landmark Teleport | 1381 | #region Landmark Teleport |
@@ -1830,9 +1832,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1830 | // this may need the attachments | 1832 | // this may need the attachments |
1831 | 1833 | ||
1832 | agent.HasMovedAway(true); | 1834 | agent.HasMovedAway(true); |
1833 | // agent.parcelRegionCross(); | ||
1834 | |||
1835 | // AgentHasMovedAway(agent, true); | ||
1836 | 1835 | ||
1837 | agent.MakeChildAgent(neighbourRegion.RegionHandle); | 1836 | agent.MakeChildAgent(neighbourRegion.RegionHandle); |
1838 | 1837 | ||
@@ -1840,19 +1839,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1840 | // but not sure yet what the side effects would be. | 1839 | // but not sure yet what the side effects would be. |
1841 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1840 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1842 | 1841 | ||
1843 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1842 | agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); |
1844 | |||
1845 | // why do that? we either where a root having all that or we are leaving the area | ||
1846 | 1843 | ||
1847 | // agent.SendOtherAgentsAvatarDataToMe(); | ||
1848 | // agent.SendOtherAgentsAppearanceToMe(); | ||
1849 | |||
1850 | // Next, let's close the child agent connections that are too far away. | ||
1851 | uint neighbourx; | ||
1852 | uint neighboury; | ||
1853 | Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | ||
1854 | |||
1855 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1856 | 1844 | ||
1857 | // the user may change their profile information in other region, | 1845 | // the user may change their profile information in other region, |
1858 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1846 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
@@ -1908,12 +1896,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1908 | 1896 | ||
1909 | if (seeds.ContainsKey(regionhandler)) | 1897 | if (seeds.ContainsKey(regionhandler)) |
1910 | seeds.Remove(regionhandler); | 1898 | seeds.Remove(regionhandler); |
1911 | 1899 | /* | |
1912 | List<ulong> oldregions = new List<ulong>(seeds.Keys); | 1900 | List<ulong> oldregions = new List<ulong>(seeds.Keys); |
1913 | 1901 | ||
1914 | if (oldregions.Contains(currentRegionHandler)) | 1902 | if (oldregions.Contains(currentRegionHandler)) |
1915 | oldregions.Remove(currentRegionHandler); | 1903 | oldregions.Remove(currentRegionHandler); |
1916 | 1904 | */ | |
1917 | if (!seeds.ContainsKey(currentRegionHandler)) | 1905 | if (!seeds.ContainsKey(currentRegionHandler)) |
1918 | seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath); | 1906 | seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath); |
1919 | 1907 | ||
@@ -1927,6 +1915,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1927 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; | 1915 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1928 | 1916 | ||
1929 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1917 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
1918 | |||
1930 | seeds.Add(regionhandler, agent.CapsPath); | 1919 | seeds.Add(regionhandler, agent.CapsPath); |
1931 | 1920 | ||
1932 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 1921 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
@@ -1936,7 +1925,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1936 | { | 1925 | { |
1937 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); | 1926 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); |
1938 | } | 1927 | } |
1928 | |||
1939 | sp.KnownRegions = seeds; | 1929 | sp.KnownRegions = seeds; |
1930 | sp.AddNeighbourRegionSizeInfo(region); | ||
1940 | 1931 | ||
1941 | if (currentAgentCircuit != null) | 1932 | if (currentAgentCircuit != null) |
1942 | { | 1933 | { |
@@ -2012,7 +2003,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2012 | 2003 | ||
2013 | if (m_regionInfo != null) | 2004 | if (m_regionInfo != null) |
2014 | { | 2005 | { |
2015 | neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 2006 | neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
2016 | } | 2007 | } |
2017 | else | 2008 | else |
2018 | { | 2009 | { |
@@ -2024,7 +2015,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2024 | LinkedList<ulong> previousRegionNeighbourHandles; | 2015 | LinkedList<ulong> previousRegionNeighbourHandles; |
2025 | Dictionary<ulong, string> seeds; | 2016 | Dictionary<ulong, string> seeds; |
2026 | ICapabilitiesModule capsModule = spScene.CapsModule; | 2017 | ICapabilitiesModule capsModule = spScene.CapsModule; |
2027 | 2018 | ||
2028 | if (capsModule != null) | 2019 | if (capsModule != null) |
2029 | { | 2020 | { |
2030 | seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID)); | 2021 | seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID)); |
@@ -2046,7 +2037,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2046 | 2037 | ||
2047 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 2038 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
2048 | List<ulong> newneighbours = new List<ulong>(); | 2039 | List<ulong> newneighbours = new List<ulong>(); |
2049 | 2040 | ||
2050 | foreach (GridRegion neighbour in neighbours) | 2041 | foreach (GridRegion neighbour in neighbours) |
2051 | { | 2042 | { |
2052 | ulong handler = neighbour.RegionHandle; | 2043 | ulong handler = neighbour.RegionHandle; |
@@ -2096,13 +2087,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2096 | seeds.Remove(handler); | 2087 | seeds.Remove(handler); |
2097 | 2088 | ||
2098 | /// Update all child agent with everyone's seeds | 2089 | /// Update all child agent with everyone's seeds |
2099 | // foreach (AgentCircuitData a in cagents) | 2090 | // foreach (AgentCircuitData a in cagents) |
2100 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 2091 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
2101 | 2092 | ||
2102 | if (capsModule != null) | 2093 | if (capsModule != null) |
2103 | capsModule.SetChildrenSeed(sp.UUID, seeds); | 2094 | capsModule.SetChildrenSeed(sp.UUID, seeds); |
2104 | 2095 | ||
2105 | sp.KnownRegions = seeds; | 2096 | sp.KnownRegions = seeds; |
2097 | sp.SetNeighbourRegionSizeInfo(neighbours); | ||
2106 | 2098 | ||
2107 | AgentPosition agentpos = new AgentPosition(); | 2099 | AgentPosition agentpos = new AgentPosition(); |
2108 | agentpos.AgentID = new UUID(sp.UUID.Guid); | 2100 | agentpos.AgentID = new UUID(sp.UUID.Guid); |
@@ -2114,59 +2106,56 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2114 | agentpos.Velocity = sp.Velocity; | 2106 | agentpos.Velocity = sp.Velocity; |
2115 | agentpos.RegionHandle = currentRegionHandler; | 2107 | agentpos.RegionHandle = currentRegionHandler; |
2116 | agentpos.Throttles = spClient.GetThrottlesPacked(1); | 2108 | agentpos.Throttles = spClient.GetThrottlesPacked(1); |
2117 | // agentpos.ChildrenCapSeeds = seeds; | 2109 | // agentpos.ChildrenCapSeeds = seeds; |
2118 | 2110 | ||
2119 | if (neighbours.Count - previousRegionNeighbourHandles.Count > 0) | 2111 | Util.FireAndForget(delegate |
2120 | { | 2112 | { |
2121 | Util.FireAndForget(delegate | 2113 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start |
2122 | { | 2114 | int count = 0; |
2123 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | ||
2124 | int count = 0; | ||
2125 | 2115 | ||
2126 | foreach (GridRegion neighbour in neighbours) | 2116 | foreach (GridRegion neighbour in neighbours) |
2117 | { | ||
2118 | ulong handler = neighbour.RegionHandle; | ||
2119 | try | ||
2127 | { | 2120 | { |
2128 | ulong handler = neighbour.RegionHandle; | 2121 | if (newneighbours.Contains(handler)) |
2129 | try | ||
2130 | { | ||
2131 | if (newneighbours.Contains(handler)) | ||
2132 | { | ||
2133 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, | ||
2134 | neighbour.ExternalEndPoint, true); | ||
2135 | count++; | ||
2136 | } | ||
2137 | else if(!previousRegionNeighbourHandles.Contains(handler)) | ||
2138 | { | ||
2139 | spScene.SimulationService.UpdateAgent(neighbour, agentpos); | ||
2140 | } | ||
2141 | } | ||
2142 | catch (ArgumentOutOfRangeException) | ||
2143 | { | 2122 | { |
2144 | m_log.ErrorFormat( | 2123 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, |
2145 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | 2124 | neighbour.ExternalEndPoint, true); |
2146 | neighbour.ExternalHostName, | 2125 | count++; |
2147 | neighbour.RegionHandle, | ||
2148 | neighbour.RegionLocX, | ||
2149 | neighbour.RegionLocY); | ||
2150 | } | 2126 | } |
2151 | catch (Exception e) | 2127 | else if (!previousRegionNeighbourHandles.Contains(handler)) |
2152 | { | 2128 | { |
2153 | m_log.ErrorFormat( | 2129 | spScene.SimulationService.UpdateAgent(neighbour, agentpos); |
2154 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2155 | neighbour.ExternalHostName, | ||
2156 | neighbour.RegionHandle, | ||
2157 | neighbour.RegionLocX, | ||
2158 | neighbour.RegionLocY, | ||
2159 | e); | ||
2160 | |||
2161 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2162 | // since I don't know what will happen if we just let the client continue | ||
2163 | |||
2164 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2165 | // throw e; | ||
2166 | } | 2130 | } |
2167 | } | 2131 | } |
2168 | }); | 2132 | catch (ArgumentOutOfRangeException) |
2169 | } | 2133 | { |
2134 | m_log.ErrorFormat( | ||
2135 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | ||
2136 | neighbour.ExternalHostName, | ||
2137 | neighbour.RegionHandle, | ||
2138 | neighbour.RegionLocX, | ||
2139 | neighbour.RegionLocY); | ||
2140 | } | ||
2141 | catch (Exception e) | ||
2142 | { | ||
2143 | m_log.ErrorFormat( | ||
2144 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2145 | neighbour.ExternalHostName, | ||
2146 | neighbour.RegionHandle, | ||
2147 | neighbour.RegionLocX, | ||
2148 | neighbour.RegionLocY, | ||
2149 | e); | ||
2150 | |||
2151 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2152 | // since I don't know what will happen if we just let the client continue | ||
2153 | |||
2154 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2155 | // throw e; | ||
2156 | } | ||
2157 | } | ||
2158 | }); | ||
2170 | } | 2159 | } |
2171 | 2160 | ||
2172 | // Computes the difference between two region bases. | 2161 | // Computes the difference between two region bases. |
@@ -2179,12 +2168,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2179 | 0f); | 2168 | 0f); |
2180 | } | 2169 | } |
2181 | 2170 | ||
2182 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | ||
2183 | { | ||
2184 | // Since we don't know how big the regions could be, we have to search a very large area | ||
2185 | // to find possible regions. | ||
2186 | return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); | ||
2187 | } | ||
2188 | 2171 | ||
2189 | #region NotFoundLocationCache class | 2172 | #region NotFoundLocationCache class |
2190 | // A collection of not found locations to make future lookups 'not found' lookups quick. | 2173 | // A collection of not found locations to make future lookups 'not found' lookups quick. |
@@ -2269,6 +2252,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2269 | #endregion // NotFoundLocationCache class | 2252 | #endregion // NotFoundLocationCache class |
2270 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); | 2253 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); |
2271 | 2254 | ||
2255 | // needed for current OSG or old grid code | ||
2256 | |||
2257 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | ||
2258 | { | ||
2259 | // Since we don't know how big the regions could be, we have to search a very large area | ||
2260 | // to find possible regions. | ||
2261 | return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); | ||
2262 | } | ||
2263 | |||
2272 | // Given a world position, get the GridRegion info for | 2264 | // Given a world position, get the GridRegion info for |
2273 | // the region containing that point. | 2265 | // the region containing that point. |
2274 | // Someday this should be a method on GridService. | 2266 | // Someday this should be a method on GridService. |
@@ -2457,7 +2449,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2457 | /// <param name="pRegionLocX"></param> | 2449 | /// <param name="pRegionLocX"></param> |
2458 | /// <param name="pRegionLocY"></param> | 2450 | /// <param name="pRegionLocY"></param> |
2459 | /// <returns></returns> | 2451 | /// <returns></returns> |
2460 | protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) | 2452 | protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
2461 | { | 2453 | { |
2462 | Scene pScene = avatar.Scene; | 2454 | Scene pScene = avatar.Scene; |
2463 | RegionInfo m_regionInfo = pScene.RegionInfo; | 2455 | RegionInfo m_regionInfo = pScene.RegionInfo; |
@@ -2468,23 +2460,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2468 | // view to include everything in the megaregion | 2460 | // view to include everything in the megaregion |
2469 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 2461 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
2470 | { | 2462 | { |
2471 | // The area to check is as big as the current region. | 2463 | uint dd = (uint)avatar.DrawDistance; |
2472 | // We presume all adjacent regions are the same size as this region. | 2464 | |
2473 | // this needs to be reduced a lot | 2465 | // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors |
2474 | // and updated in avatar CheckForSignificantMovement (larger than current 64m?) | 2466 | uint ddX = Math.Max(dd, Constants.RegionSize); |
2475 | // and draw distance changes | 2467 | uint ddY = Math.Max(dd, Constants.RegionSize); |
2476 | // sending client the necessary information | 2468 | |
2477 | uint dd = Math.Max((uint)avatar.DrawDistance, Constants.RegionSize); | 2469 | ddX--; |
2478 | 2470 | ddY--; | |
2479 | dd--; | 2471 | |
2480 | uint ddX = Math.Max(dd, Scene.RegionInfo.RegionSizeX); | 2472 | // reference to region edges. Should be avatar position |
2481 | uint ddY = Math.Max(dd, Scene.RegionInfo.RegionSizeY); | 2473 | uint startX = Util.RegionToWorldLoc(pRegionLocX); |
2482 | 2474 | uint endX = startX + m_regionInfo.RegionSizeX; | |
2483 | // region center. Should be avatar position | 2475 | uint startY = Util.RegionToWorldLoc(pRegionLocY); |
2484 | uint startX = Util.RegionToWorldLoc(pRegionLocX) + m_regionInfo.RegionSizeX / 2; | 2476 | uint endY = startY + m_regionInfo.RegionSizeY; |
2485 | uint endX = startX; | ||
2486 | uint startY = Util.RegionToWorldLoc(pRegionLocY) + m_regionInfo.RegionSizeY / 2; | ||
2487 | uint endY = startY; | ||
2488 | 2477 | ||
2489 | startX -= ddX; | 2478 | startX -= ddX; |
2490 | startY -= ddY; | 2479 | startY -= ddY; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7abdc21..4ef2fa9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -243,19 +243,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
243 | 243 | ||
244 | return region; | 244 | return region; |
245 | } | 245 | } |
246 | 246 | /* NEEDFIX | |
247 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 247 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
248 | { | 248 | { |
249 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 249 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
250 | return true; | 250 | return true; |
251 | 251 | ||
252 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); | 252 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); |
253 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) | 253 | if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) |
254 | return true; | 254 | return true; |
255 | 255 | ||
256 | return false; | 256 | return false; |
257 | } | 257 | } |
258 | 258 | */ | |
259 | protected override void AgentHasMovedAway(ScenePresence sp, bool logout) | 259 | protected override void AgentHasMovedAway(ScenePresence sp, bool logout) |
260 | { | 260 | { |
261 | base.AgentHasMovedAway(sp, logout); | 261 | base.AgentHasMovedAway(sp, logout); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3e278a9..045a450 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -838,22 +838,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
838 | else | 838 | else |
839 | seeds = new Dictionary<ulong, string>(); | 839 | seeds = new Dictionary<ulong, string>(); |
840 | 840 | ||
841 | /* we can't do this anymore | ||
841 | List<ulong> old = new List<ulong>(); | 842 | List<ulong> old = new List<ulong>(); |
842 | foreach (ulong handle in seeds.Keys) | 843 | foreach (ulong handle in seeds.Keys) |
843 | { | 844 | { |
844 | uint x, y; | 845 | uint x, y; |
845 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 846 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
846 | 847 | no information to check this | |
847 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | 848 | // if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,)) |
848 | { | 849 | { |
849 | old.Add(handle); | 850 | old.Add(handle); |
850 | } | 851 | } |
851 | } | 852 | } |
853 | |||
852 | DropOldNeighbours(old); | 854 | DropOldNeighbours(old); |
853 | 855 | ||
854 | if (Scene.CapsModule != null) | 856 | if (Scene.CapsModule != null) |
855 | Scene.CapsModule.SetChildrenSeed(UUID, seeds); | 857 | Scene.CapsModule.SetChildrenSeed(UUID, seeds); |
856 | 858 | */ | |
857 | KnownRegions = seeds; | 859 | KnownRegions = seeds; |
858 | //m_log.Debug(" ++++++++++AFTER+++++++++++++ "); | 860 | //m_log.Debug(" ++++++++++AFTER+++++++++++++ "); |
859 | //DumpKnownRegions(); | 861 | //DumpKnownRegions(); |
@@ -1517,15 +1519,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
1517 | // holds the seed cap for the child agent in that region | 1519 | // holds the seed cap for the child agent in that region |
1518 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | 1520 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); |
1519 | 1521 | ||
1520 | public void AddNeighbourRegion(ulong regionHandle, string cap) | 1522 | struct spRegionSizeInfo |
1523 | { | ||
1524 | public int sizeX; | ||
1525 | public int sizeY; | ||
1526 | } | ||
1527 | |||
1528 | private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>(); | ||
1529 | |||
1530 | |||
1531 | public void AddNeighbourRegionSizeInfo(GridRegion region) | ||
1521 | { | 1532 | { |
1522 | lock (m_knownChildRegions) | 1533 | lock (m_knownChildRegions) |
1523 | { | 1534 | { |
1524 | if (!m_knownChildRegions.ContainsKey(regionHandle)) | 1535 | spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); |
1536 | sizeInfo.sizeX = region.RegionSizeX; | ||
1537 | sizeInfo.sizeY = region.RegionSizeY; | ||
1538 | ulong regionHandle = region.RegionHandle; | ||
1539 | |||
1540 | if (!m_knownChildRegionsSizeInfo.ContainsKey(regionHandle)) | ||
1525 | { | 1541 | { |
1526 | uint x, y; | 1542 | m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo); |
1527 | Utils.LongToUInts(regionHandle, out x, out y); | 1543 | |
1528 | m_knownChildRegions.Add(regionHandle, cap); | 1544 | } |
1545 | else | ||
1546 | m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo; | ||
1547 | } | ||
1548 | } | ||
1549 | |||
1550 | public void SetNeighbourRegionSizeInfo(List<GridRegion> regionsList) | ||
1551 | { | ||
1552 | lock (m_knownChildRegions) | ||
1553 | { | ||
1554 | m_knownChildRegionsSizeInfo.Clear(); | ||
1555 | foreach (GridRegion region in regionsList) | ||
1556 | { | ||
1557 | spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); | ||
1558 | sizeInfo.sizeX = region.RegionSizeX; | ||
1559 | sizeInfo.sizeY = region.RegionSizeY; | ||
1560 | ulong regionHandle = region.RegionHandle; | ||
1561 | m_knownChildRegionsSizeInfo.Add(regionHandle, sizeInfo); | ||
1529 | } | 1562 | } |
1530 | } | 1563 | } |
1531 | } | 1564 | } |
@@ -1539,6 +1572,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1539 | //if (m_knownChildRegions.ContainsKey(regionHandle)) | 1572 | //if (m_knownChildRegions.ContainsKey(regionHandle)) |
1540 | // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); | 1573 | // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); |
1541 | m_knownChildRegions.Remove(regionHandle); | 1574 | m_knownChildRegions.Remove(regionHandle); |
1575 | m_knownChildRegionsSizeInfo.Remove(regionHandle); | ||
1542 | } | 1576 | } |
1543 | } | 1577 | } |
1544 | 1578 | ||
@@ -1558,7 +1592,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1558 | Scene.CapsModule.DropChildSeed(UUID, handle); | 1592 | Scene.CapsModule.DropChildSeed(UUID, handle); |
1559 | } | 1593 | } |
1560 | 1594 | ||
1561 | |||
1562 | public Dictionary<ulong, string> KnownRegions | 1595 | public Dictionary<ulong, string> KnownRegions |
1563 | { | 1596 | { |
1564 | get | 1597 | get |
@@ -1804,7 +1837,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1804 | 1837 | ||
1805 | bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); | 1838 | bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); |
1806 | 1839 | ||
1807 | if(haveAnims) | 1840 | if (haveAnims) |
1808 | SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); | 1841 | SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); |
1809 | 1842 | ||
1810 | // we should be able to receive updates, etc | 1843 | // we should be able to receive updates, etc |
@@ -1831,19 +1864,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1831 | } // greys if | 1864 | } // greys if |
1832 | 1865 | ||
1833 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1866 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1834 | 1867 | ||
1835 | // attachments | 1868 | // attachments |
1836 | 1869 | ||
1837 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) | 1870 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) |
1838 | { | 1871 | { |
1839 | if (Scene.AttachmentsModule != null) | 1872 | if (Scene.AttachmentsModule != null) |
1840 | // Util.FireAndForget( | 1873 | // Util.FireAndForget( |
1841 | // o => | 1874 | // o => |
1842 | // { | 1875 | // { |
1843 | if (!isNPC) | 1876 | if (!isNPC) |
1844 | Scene.AttachmentsModule.RezAttachments(this); | 1877 | Scene.AttachmentsModule.RezAttachments(this); |
1845 | else | 1878 | else |
1846 | Util.FireAndForget(x => { | 1879 | Util.FireAndForget(x => |
1880 | { | ||
1847 | Scene.AttachmentsModule.RezAttachments(this); | 1881 | Scene.AttachmentsModule.RezAttachments(this); |
1848 | }); | 1882 | }); |
1849 | // }); | 1883 | // }); |
@@ -1855,7 +1889,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1855 | m_log.DebugFormat( | 1889 | m_log.DebugFormat( |
1856 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | 1890 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); |
1857 | 1891 | ||
1858 | foreach(SceneObjectGroup sog in m_attachments) | 1892 | foreach (SceneObjectGroup sog in m_attachments) |
1859 | { | 1893 | { |
1860 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 1894 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); |
1861 | sog.ResumeScripts(); | 1895 | sog.ResumeScripts(); |
@@ -1880,10 +1914,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1880 | } | 1914 | } |
1881 | 1915 | ||
1882 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1916 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1883 | |||
1884 | // Create child agents in neighbouring regions | ||
1885 | if (openChildAgents) | 1917 | if (openChildAgents) |
1886 | { | 1918 | { |
1919 | // Create child agents in neighbouring regions | ||
1887 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 1920 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
1888 | if (m_agentTransfer != null) | 1921 | if (m_agentTransfer != null) |
1889 | { | 1922 | { |
@@ -3955,8 +3988,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3955 | /// <param name="newRegionX">The new region's x on the map</param> | 3988 | /// <param name="newRegionX">The new region's x on the map</param> |
3956 | /// <param name="newRegionY">The new region's y on the map</param> | 3989 | /// <param name="newRegionY">The new region's y on the map</param> |
3957 | /// <returns></returns> | 3990 | /// <returns></returns> |
3958 | public void CloseChildAgents(uint newRegionX, uint newRegionY) | 3991 | public void CloseChildAgents(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) |
3959 | { | 3992 | { |
3993 | uint newRegionX, newRegionY; | ||
3960 | List<ulong> byebyeRegions = new List<ulong>(); | 3994 | List<ulong> byebyeRegions = new List<ulong>(); |
3961 | List<ulong> knownRegions = KnownRegionHandles; | 3995 | List<ulong> knownRegions = KnownRegionHandles; |
3962 | m_log.DebugFormat( | 3996 | m_log.DebugFormat( |
@@ -3964,19 +3998,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
3964 | knownRegions.Count, Scene.RegionInfo.RegionName); | 3998 | knownRegions.Count, Scene.RegionInfo.RegionName); |
3965 | //DumpKnownRegions(); | 3999 | //DumpKnownRegions(); |
3966 | 4000 | ||
4001 | Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); | ||
4002 | |||
4003 | uint x, y; | ||
4004 | spRegionSizeInfo regInfo; | ||
4005 | |||
3967 | foreach (ulong handle in knownRegions) | 4006 | foreach (ulong handle in knownRegions) |
3968 | { | 4007 | { |
3969 | // Don't close the agent on this region yet | 4008 | // Don't close the agent on this region yet |
3970 | if (handle != Scene.RegionInfo.RegionHandle) | 4009 | if (handle != Scene.RegionInfo.RegionHandle) |
3971 | { | 4010 | { |
3972 | uint x, y; | ||
3973 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 4011 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
4012 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) | ||
4013 | { | ||
3974 | 4014 | ||
3975 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 4015 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3976 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 4016 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
3977 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) | 4017 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, |
4018 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | ||
4019 | { | ||
4020 | byebyeRegions.Add(handle); | ||
4021 | } | ||
4022 | } | ||
4023 | else | ||
3978 | { | 4024 | { |
3979 | byebyeRegions.Add(handle); | 4025 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, |
4026 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | ||
4027 | { | ||
4028 | byebyeRegions.Add(handle); | ||
4029 | } | ||
3980 | } | 4030 | } |
3981 | } | 4031 | } |
3982 | } | 4032 | } |
@@ -5382,11 +5432,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5382 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | 5432 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); |
5383 | if (spawnPoints.Length == 0) | 5433 | if (spawnPoints.Length == 0) |
5384 | { | 5434 | { |
5385 | if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) | 5435 | pos.X = 128.0f; |
5386 | { | 5436 | pos.Y = 128.0f; |
5387 | pos.X = 128.0f; | ||
5388 | pos.Y = 128.0f; | ||
5389 | } | ||
5390 | return; | 5437 | return; |
5391 | } | 5438 | } |
5392 | 5439 | ||