diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 448 |
1 files changed, 8 insertions, 440 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7937383..9a57599 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -154,16 +154,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
154 | // Add this agent in this region as a banned person | 154 | // Add this agent in this region as a banned person |
155 | public void Add(ulong pRegionHandle, UUID pAgentID) | 155 | public void Add(ulong pRegionHandle, UUID pAgentID) |
156 | { | 156 | { |
157 | <<<<<<< HEAD | ||
158 | if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) | ||
159 | { | ||
160 | m_idCache = new ExpiringCache<ulong, DateTime>(); | ||
161 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(45)); | ||
162 | } | ||
163 | m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); | ||
164 | ======= | ||
165 | this.Add(pRegionHandle, pAgentID, 45, 15); | 157 | this.Add(pRegionHandle, pAgentID, 45, 15); |
166 | } | 158 | } |
159 | |||
167 | public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime) | 160 | public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime) |
168 | { | 161 | { |
169 | if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) | 162 | if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) |
@@ -172,8 +165,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
172 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); | 165 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); |
173 | } | 166 | } |
174 | m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); | 167 | m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); |
175 | >>>>>>> avn/ubitvar | ||
176 | } | 168 | } |
169 | |||
177 | // Remove the agent from the region's banned list | 170 | // Remove the agent from the region's banned list |
178 | public void Remove(ulong pRegionHandle, UUID pAgentID) | 171 | public void Remove(ulong pRegionHandle, UUID pAgentID) |
179 | { | 172 | { |
@@ -183,6 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
183 | } | 176 | } |
184 | } | 177 | } |
185 | } | 178 | } |
179 | |||
186 | private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); | 180 | private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); |
187 | 181 | ||
188 | private IEventQueue m_eqModule; | 182 | private IEventQueue m_eqModule; |
@@ -222,7 +216,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
222 | { | 216 | { |
223 | string transferVersionName = "SIMULATION"; | 217 | string transferVersionName = "SIMULATION"; |
224 | float maxTransferVersion = 0.3f; | 218 | float maxTransferVersion = 0.3f; |
225 | <<<<<<< HEAD | ||
226 | 219 | ||
227 | IConfig hypergridConfig = source.Configs["Hypergrid"]; | 220 | IConfig hypergridConfig = source.Configs["Hypergrid"]; |
228 | if (hypergridConfig != null) | 221 | if (hypergridConfig != null) |
@@ -235,8 +228,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
235 | if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/")) | 228 | if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/")) |
236 | m_GatekeeperURI += '/'; | 229 | m_GatekeeperURI += '/'; |
237 | } | 230 | } |
238 | ======= | ||
239 | >>>>>>> avn/ubitvar | ||
240 | 231 | ||
241 | IConfig transferConfig = source.Configs["EntityTransfer"]; | 232 | IConfig transferConfig = source.Configs["EntityTransfer"]; |
242 | if (transferConfig != null) | 233 | if (transferConfig != null) |
@@ -515,11 +506,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
515 | 506 | ||
516 | // TODO: Check other Scene HeightField | 507 | // TODO: Check other Scene HeightField |
517 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; | 508 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; |
518 | <<<<<<< HEAD | ||
519 | ======= | ||
520 | 509 | ||
521 | posZLimit += localHalfAVHeight + 0.1f; | 510 | posZLimit += localHalfAVHeight + 0.1f; |
522 | >>>>>>> avn/ubitvar | ||
523 | 511 | ||
524 | if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) | 512 | if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) |
525 | { | 513 | { |
@@ -622,15 +610,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
622 | Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); | 610 | Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); |
623 | 611 | ||
624 | MapBlockData block = new MapBlockData(); | 612 | MapBlockData block = new MapBlockData(); |
625 | <<<<<<< HEAD | ||
626 | block.X = (ushort)regX; | ||
627 | block.Y = (ushort)regY; | ||
628 | block.Access = (byte)SimAccess.Down; | ||
629 | ======= | ||
630 | block.X = (ushort)(regX); | 613 | block.X = (ushort)(regX); |
631 | block.Y = (ushort)(regY); | 614 | block.Y = (ushort)(regY); |
632 | block.Access = (byte)SimAccess.Down; // == not there | 615 | block.Access = (byte)SimAccess.Down; // == not there |
633 | >>>>>>> avn/ubitvar | ||
634 | 616 | ||
635 | List<MapBlockData> blocks = new List<MapBlockData>(); | 617 | List<MapBlockData> blocks = new List<MapBlockData>(); |
636 | blocks.Add(block); | 618 | blocks.Add(block); |
@@ -765,13 +747,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
765 | return; | 747 | return; |
766 | } | 748 | } |
767 | 749 | ||
768 | <<<<<<< HEAD | ||
769 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | ||
770 | Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); | ||
771 | Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY); | ||
772 | |||
773 | ======= | ||
774 | >>>>>>> avn/ubitvar | ||
775 | ulong destinationHandle = finalDestination.RegionHandle; | 750 | ulong destinationHandle = finalDestination.RegionHandle; |
776 | 751 | ||
777 | // Let's do DNS resolution only once in this process, please! | 752 | // Let's do DNS resolution only once in this process, please! |
@@ -794,11 +769,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
794 | string version; | 769 | string version; |
795 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); | 770 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); |
796 | if (!Scene.SimulationService.QueryAccess( | 771 | if (!Scene.SimulationService.QueryAccess( |
797 | <<<<<<< HEAD | ||
798 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) | 772 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) |
799 | ======= | ||
800 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason)) | ||
801 | >>>>>>> avn/ubitvar | ||
802 | { | 773 | { |
803 | sp.ControllingClient.SendTeleportFailed(reason); | 774 | sp.ControllingClient.SendTeleportFailed(reason); |
804 | 775 | ||
@@ -860,12 +831,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
860 | agentCircuit.Id0 = currentAgentCircuit.Id0; | 831 | agentCircuit.Id0 = currentAgentCircuit.Id0; |
861 | } | 832 | } |
862 | 833 | ||
863 | <<<<<<< HEAD | ||
864 | // if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
865 | float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, | ||
866 | (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); | ||
867 | if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
868 | ======= | ||
869 | IClientIPEndpoint ipepClient; | 834 | IClientIPEndpoint ipepClient; |
870 | 835 | ||
871 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | 836 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; |
@@ -880,7 +845,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
880 | oldSizeX, oldSizeY, newSizeX, newSizeY); | 845 | oldSizeX, oldSizeY, newSizeX, newSizeY); |
881 | 846 | ||
882 | if (OutSideViewRange) | 847 | if (OutSideViewRange) |
883 | >>>>>>> avn/ubitvar | ||
884 | { | 848 | { |
885 | m_log.DebugFormat( | 849 | m_log.DebugFormat( |
886 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", | 850 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", |
@@ -911,11 +875,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
911 | float.TryParse(versionComponents[1], out versionNumber); | 875 | float.TryParse(versionComponents[1], out versionNumber); |
912 | 876 | ||
913 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) | 877 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) |
914 | <<<<<<< HEAD | ||
915 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | ||
916 | ======= | ||
917 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); | 878 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); |
918 | >>>>>>> avn/ubitvar | ||
919 | else | 879 | else |
920 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); | 880 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); |
921 | } | 881 | } |
@@ -973,21 +933,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
973 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 933 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
974 | 934 | ||
975 | // OK, it got this agent. Let's close some child agents | 935 | // OK, it got this agent. Let's close some child agents |
976 | <<<<<<< HEAD | ||
977 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
978 | |||
979 | IClientIPEndpoint ipepClient; | ||
980 | string capsPath = String.Empty; | ||
981 | float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, | ||
982 | (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); | ||
983 | if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
984 | { | ||
985 | m_log.DebugFormat( | ||
986 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}", | ||
987 | finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); | ||
988 | ======= | ||
989 | >>>>>>> avn/ubitvar | ||
990 | |||
991 | 936 | ||
992 | if (OutSideViewRange) | 937 | if (OutSideViewRange) |
993 | { | 938 | { |
@@ -1157,11 +1102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1157 | 1102 | ||
1158 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1103 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1159 | 1104 | ||
1160 | <<<<<<< HEAD | ||
1161 | if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | ||
1162 | ======= | ||
1163 | if (OutSideViewRange) | 1105 | if (OutSideViewRange) |
1164 | >>>>>>> avn/ubitvar | ||
1165 | { | 1106 | { |
1166 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1107 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1167 | return; | 1108 | return; |
@@ -1226,35 +1167,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1226 | // Past this point we have to attempt clean up if the teleport fails, so update transfer state. | 1167 | // Past this point we have to attempt clean up if the teleport fails, so update transfer state. |
1227 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 1168 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
1228 | 1169 | ||
1229 | <<<<<<< HEAD | ||
1230 | IClientIPEndpoint ipepClient; | ||
1231 | string capsPath = String.Empty; | ||
1232 | float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, | ||
1233 | (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); | ||
1234 | if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
1235 | { | ||
1236 | m_log.DebugFormat( | ||
1237 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", | ||
1238 | finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); | ||
1239 | |||
1240 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | ||
1241 | #region IP Translation for NAT | ||
1242 | // Uses ipepClient above | ||
1243 | if (sp.ClientView.TryGet(out ipepClient)) | ||
1244 | { | ||
1245 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
1246 | } | ||
1247 | #endregion | ||
1248 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
1249 | } | ||
1250 | else | ||
1251 | { | ||
1252 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
1253 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
1254 | } | ||
1255 | |||
1256 | ======= | ||
1257 | >>>>>>> avn/ubitvar | ||
1258 | // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, | 1170 | // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, |
1259 | // where that neighbour simulator could otherwise request a child agent create on the source which then | 1171 | // where that neighbour simulator could otherwise request a child agent create on the source which then |
1260 | // closes our existing agent which is still signalled as root. | 1172 | // closes our existing agent which is still signalled as root. |
@@ -1333,11 +1245,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1333 | sp.MakeChildAgent(destinationHandle); | 1245 | sp.MakeChildAgent(destinationHandle); |
1334 | 1246 | ||
1335 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1247 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1336 | <<<<<<< HEAD | ||
1337 | if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | ||
1338 | ======= | ||
1339 | if (OutSideViewRange) | 1248 | if (OutSideViewRange) |
1340 | >>>>>>> avn/ubitvar | ||
1341 | { | 1249 | { |
1342 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1250 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1343 | return; | 1251 | return; |
@@ -1465,12 +1373,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1465 | // This returns 'true' if the new region already has a child agent for our | 1373 | // This returns 'true' if the new region already has a child agent for our |
1466 | // incoming agent. The implication is that, if 'false', we have to create the | 1374 | // incoming agent. The implication is that, if 'false', we have to create the |
1467 | // child and then teleport into the region. | 1375 | // child and then teleport into the region. |
1468 | <<<<<<< HEAD | ||
1469 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | ||
1470 | ======= | ||
1471 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, | 1376 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, |
1472 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) | 1377 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) |
1473 | >>>>>>> avn/ubitvar | ||
1474 | { | 1378 | { |
1475 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 1379 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
1476 | { | 1380 | { |
@@ -1487,9 +1391,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1487 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, | 1391 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, |
1488 | oldsizeX, oldsizeY, newsizeX, newsizeY); | 1392 | oldsizeX, oldsizeY, newsizeX, newsizeY); |
1489 | } | 1393 | } |
1490 | <<<<<<< HEAD | ||
1491 | |||
1492 | ======= | ||
1493 | /* | 1394 | /* |
1494 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, | 1395 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, |
1495 | uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) | 1396 | uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) |
@@ -1499,7 +1400,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1499 | oldsizeX, oldsizeY, newsizeX, newsizeY); | 1400 | oldsizeX, oldsizeY, newsizeX, newsizeY); |
1500 | } | 1401 | } |
1501 | */ | 1402 | */ |
1502 | >>>>>>> avn/ubitvar | ||
1503 | #endregion | 1403 | #endregion |
1504 | 1404 | ||
1505 | #region Landmark Teleport | 1405 | #region Landmark Teleport |
@@ -1580,82 +1480,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1580 | 1480 | ||
1581 | #region Agent Crossings | 1481 | #region Agent Crossings |
1582 | 1482 | ||
1583 | <<<<<<< HEAD | ||
1584 | // Given a position relative to the current region (which has previously been tested to | ||
1585 | // see that it is actually outside the current region), find the new region that the | ||
1586 | // point is actually in. | ||
1587 | // Returns the coordinates and information of the new region or 'null' of it doesn't exist. | ||
1588 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, | ||
1589 | out string version, out Vector3 newpos, out string failureReason) | ||
1590 | ======= | ||
1591 | public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason) | 1483 | public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason) |
1592 | >>>>>>> avn/ubitvar | ||
1593 | { | 1484 | { |
1594 | reason = String.Empty; | 1485 | reason = String.Empty; |
1595 | version = String.Empty; | 1486 | version = String.Empty; |
1596 | <<<<<<< HEAD | ||
1597 | newpos = pos; | ||
1598 | failureReason = string.Empty; | ||
1599 | string homeURI = scene.GetAgentHomeURI(agentID); | ||
1600 | |||
1601 | // m_log.DebugFormat( | ||
1602 | // "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); | ||
1603 | |||
1604 | // Compute world location of the object's position | ||
1605 | double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X; | ||
1606 | double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y; | ||
1607 | |||
1608 | // Call the grid service to lookup the region containing the new position. | ||
1609 | GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, | ||
1610 | presenceWorldX, presenceWorldY, | ||
1611 | Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); | ||
1612 | |||
1613 | if (neighbourRegion != null) | ||
1614 | { | ||
1615 | // Compute the entity's position relative to the new region | ||
1616 | newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX), | ||
1617 | (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), | ||
1618 | pos.Z); | ||
1619 | |||
1620 | if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) | ||
1621 | { | ||
1622 | failureReason = "Cannot region cross into banned parcel"; | ||
1623 | neighbourRegion = null; | ||
1624 | } | ||
1625 | else | ||
1626 | { | ||
1627 | // If not banned, make sure this agent is not in the list. | ||
1628 | m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID); | ||
1629 | } | ||
1630 | |||
1631 | // Check to see if we have access to the target region. | ||
1632 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); | ||
1633 | if (neighbourRegion != null | ||
1634 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason)) | ||
1635 | { | ||
1636 | // remember banned | ||
1637 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | ||
1638 | neighbourRegion = null; | ||
1639 | } | ||
1640 | } | ||
1641 | else | ||
1642 | { | ||
1643 | // The destination region just doesn't exist | ||
1644 | failureReason = "Cannot cross into non-existent region"; | ||
1645 | } | ||
1646 | |||
1647 | if (neighbourRegion == null) | ||
1648 | m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", | ||
1649 | LogHeader, scene.RegionInfo.RegionName, | ||
1650 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, | ||
1651 | scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, | ||
1652 | pos); | ||
1653 | else | ||
1654 | m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>", | ||
1655 | LogHeader, neighbourRegion.RegionName, | ||
1656 | neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY, | ||
1657 | newpos.X, newpos.Y); | ||
1658 | ======= | ||
1659 | 1487 | ||
1660 | UUID agentID = agent.UUID; | 1488 | UUID agentID = agent.UUID; |
1661 | ulong destinyHandle = destiny.RegionHandle; | 1489 | ulong destinyHandle = destiny.RegionHandle; |
@@ -1672,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1672 | 1500 | ||
1673 | 1501 | ||
1674 | if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position, | 1502 | if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position, |
1675 | myversion, out version, out reason)) | 1503 | myversion, agent.Scene.GetFormatsOffered(), out version, out reason)) |
1676 | { | 1504 | { |
1677 | m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); | 1505 | m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); |
1678 | return false; | 1506 | return false; |
@@ -1735,7 +1563,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1735 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); | 1563 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); |
1736 | string homeURI = scene.GetAgentHomeURI(agentID); | 1564 | string homeURI = scene.GetAgentHomeURI(agentID); |
1737 | if (neighbourRegion != null | 1565 | if (neighbourRegion != null |
1738 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason)) | 1566 | && !scene.SimulationService.QueryAccess( |
1567 | neighbourRegion, agentID, homeURI, false, newpos, myversion, | ||
1568 | new List<UUID>(), out version, out failureReason)) | ||
1739 | { | 1569 | { |
1740 | // remember banned | 1570 | // remember banned |
1741 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1571 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
@@ -1747,7 +1577,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1747 | // The destination region just doesn't exist | 1577 | // The destination region just doesn't exist |
1748 | failureReason = "Cannot cross into non-existent region"; | 1578 | failureReason = "Cannot cross into non-existent region"; |
1749 | } | 1579 | } |
1750 | >>>>>>> avn/ubitvar | ||
1751 | 1580 | ||
1752 | if (neighbourRegion == null) | 1581 | if (neighbourRegion == null) |
1753 | m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", | 1582 | m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", |
@@ -1766,8 +1595,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1766 | 1595 | ||
1767 | public bool Cross(ScenePresence agent, bool isFlying) | 1596 | public bool Cross(ScenePresence agent, bool isFlying) |
1768 | { | 1597 | { |
1769 | <<<<<<< HEAD | ||
1770 | ======= | ||
1771 | agent.IsInTransit = true; | 1598 | agent.IsInTransit = true; |
1772 | CrossAsyncDelegate d = CrossAsync; | 1599 | CrossAsyncDelegate d = CrossAsync; |
1773 | d.BeginInvoke(agent, isFlying, CrossCompleted, d); | 1600 | d.BeginInvoke(agent, isFlying, CrossCompleted, d); |
@@ -1793,19 +1620,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1793 | { | 1620 | { |
1794 | uint x; | 1621 | uint x; |
1795 | uint y; | 1622 | uint y; |
1796 | >>>>>>> avn/ubitvar | ||
1797 | Vector3 newpos; | 1623 | Vector3 newpos; |
1798 | string version; | 1624 | string version; |
1799 | string failureReason; | 1625 | string failureReason; |
1800 | 1626 | ||
1801 | <<<<<<< HEAD | ||
1802 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, | ||
1803 | out version, out newpos, out failureReason); | ||
1804 | if (neighbourRegion == null) | ||
1805 | { | ||
1806 | agent.ControllingClient.SendAlertMessage(failureReason); | ||
1807 | return false; | ||
1808 | ======= | ||
1809 | Vector3 pos = agent.AbsolutePosition + agent.Velocity; | 1627 | Vector3 pos = agent.AbsolutePosition + agent.Velocity; |
1810 | 1628 | ||
1811 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, | 1629 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, |
@@ -1815,23 +1633,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1815 | if (failureReason != String.Empty) | 1633 | if (failureReason != String.Empty) |
1816 | agent.ControllingClient.SendAlertMessage(failureReason); | 1634 | agent.ControllingClient.SendAlertMessage(failureReason); |
1817 | return agent; | 1635 | return agent; |
1818 | >>>>>>> avn/ubitvar | ||
1819 | } | 1636 | } |
1820 | 1637 | ||
1821 | // agent.IsInTransit = true; | 1638 | // agent.IsInTransit = true; |
1822 | 1639 | ||
1823 | <<<<<<< HEAD | ||
1824 | Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion); | ||
1825 | |||
1826 | return true; | ||
1827 | ======= | ||
1828 | CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); | 1640 | CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); |
1829 | agent.IsInTransit = false; | 1641 | agent.IsInTransit = false; |
1830 | return agent; | 1642 | return agent; |
1831 | >>>>>>> avn/ubitvar | ||
1832 | } | 1643 | } |
1833 | 1644 | ||
1834 | |||
1835 | public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, | 1645 | public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, |
1836 | Vector3 position, | 1646 | Vector3 position, |
1837 | Scene initiatingScene); | 1647 | Scene initiatingScene); |
@@ -1958,10 +1768,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1958 | { | 1768 | { |
1959 | AgentData cAgent = new AgentData(); | 1769 | AgentData cAgent = new AgentData(); |
1960 | agent.CopyTo(cAgent); | 1770 | agent.CopyTo(cAgent); |
1961 | <<<<<<< HEAD | ||
1962 | cAgent.Position = pos; | ||
1963 | |||
1964 | ======= | ||
1965 | 1771 | ||
1966 | // agent.Appearance.WearableCacheItems = null; | 1772 | // agent.Appearance.WearableCacheItems = null; |
1967 | 1773 | ||
@@ -1969,7 +1775,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1969 | 1775 | ||
1970 | cAgent.ChildrenCapSeeds = agent.KnownRegions; | 1776 | cAgent.ChildrenCapSeeds = agent.KnownRegions; |
1971 | 1777 | ||
1972 | >>>>>>> avn/ubitvar | ||
1973 | if (isFlying) | 1778 | if (isFlying) |
1974 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 1779 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
1975 | 1780 | ||
@@ -2048,25 +1853,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2048 | capsPath); | 1853 | capsPath); |
2049 | } | 1854 | } |
2050 | 1855 | ||
2051 | <<<<<<< HEAD | ||
2052 | // SUCCESS! | ||
2053 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | ||
2054 | |||
2055 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | ||
2056 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | ||
2057 | |||
2058 | agent.MakeChildAgent(); | ||
2059 | |||
2060 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | ||
2061 | // but not sure yet what the side effects would be. | ||
2062 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | ||
2063 | |||
2064 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
2065 | agent.SendOtherAgentsAvatarDataToClient(); | ||
2066 | agent.SendOtherAgentsAppearanceToClient(); | ||
2067 | |||
2068 | ======= | ||
2069 | >>>>>>> avn/ubitvar | ||
2070 | // Backwards compatibility. Best effort | 1856 | // Backwards compatibility. Best effort |
2071 | if (version == "Unknown" || version == string.Empty) | 1857 | if (version == "Unknown" || version == string.Empty) |
2072 | { | 1858 | { |
@@ -2075,12 +1861,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2075 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | 1861 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); |
2076 | } | 1862 | } |
2077 | 1863 | ||
2078 | <<<<<<< HEAD | ||
2079 | // Next, let's close the child agent connections that are too far away. | ||
2080 | uint neighbourx; | ||
2081 | uint neighboury; | ||
2082 | Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | ||
2083 | ======= | ||
2084 | // SUCCESS! | 1864 | // SUCCESS! |
2085 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | 1865 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); |
2086 | 1866 | ||
@@ -2096,7 +1876,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2096 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | 1876 | // FIXME: Possibly this should occur lower down after other commands to close other agents, |
2097 | // but not sure yet what the side effects would be. | 1877 | // but not sure yet what the side effects would be. |
2098 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1878 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
2099 | >>>>>>> avn/ubitvar | ||
2100 | 1879 | ||
2101 | agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); | 1880 | agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); |
2102 | 1881 | ||
@@ -2177,24 +1956,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2177 | 1956 | ||
2178 | seeds.Add(regionhandler, agent.CapsPath); | 1957 | seeds.Add(regionhandler, agent.CapsPath); |
2179 | 1958 | ||
2180 | <<<<<<< HEAD | ||
2181 | sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); | ||
2182 | //foreach (ulong h in agent.ChildrenCapSeeds.Keys) | ||
2183 | // m_log.DebugFormat("[XXX] --> {0}", h); | ||
2184 | //m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); | ||
2185 | if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle)) | ||
2186 | { | ||
2187 | m_log.WarnFormat( | ||
2188 | "[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}", | ||
2189 | agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath, | ||
2190 | region.RegionName, region.RegionHandle, sp.Name, Scene.Name); | ||
2191 | } | ||
2192 | 1959 | ||
2193 | agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath; | ||
2194 | ======= | ||
2195 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 1960 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
2196 | agent.ChildrenCapSeeds = null; | 1961 | agent.ChildrenCapSeeds = null; |
2197 | >>>>>>> avn/ubitvar | ||
2198 | 1962 | ||
2199 | if (sp.Scene.CapsModule != null) | 1963 | if (sp.Scene.CapsModule != null) |
2200 | { | 1964 | { |
@@ -2278,11 +2042,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2278 | 2042 | ||
2279 | if (m_regionInfo != null) | 2043 | if (m_regionInfo != null) |
2280 | { | 2044 | { |
2281 | <<<<<<< HEAD | ||
2282 | neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | ||
2283 | ======= | ||
2284 | neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 2045 | neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
2285 | >>>>>>> avn/ubitvar | ||
2286 | } | 2046 | } |
2287 | else | 2047 | else |
2288 | { | 2048 | { |
@@ -2531,127 +2291,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2531 | #endregion // NotFoundLocationCache class | 2291 | #endregion // NotFoundLocationCache class |
2532 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); | 2292 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); |
2533 | 2293 | ||
2534 | <<<<<<< HEAD | ||
2535 | // Computes the difference between two region bases. | ||
2536 | // Returns a vector of world coordinates (meters) from base of first region to the second. | ||
2537 | // The first region is the home region of the passed scene presence. | ||
2538 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) | ||
2539 | { | ||
2540 | /* | ||
2541 | int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX; | ||
2542 | int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY; | ||
2543 | int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize; | ||
2544 | int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize; | ||
2545 | int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize; | ||
2546 | int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; | ||
2547 | return new Vector3(shiftx, shifty, 0f); | ||
2548 | */ | ||
2549 | return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX, | ||
2550 | sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, | ||
2551 | 0f); | ||
2552 | } | ||
2553 | |||
2554 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | ||
2555 | { | ||
2556 | // Since we don't know how big the regions could be, we have to search a very large area | ||
2557 | // to find possible regions. | ||
2558 | return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); | ||
2559 | } | ||
2560 | |||
2561 | #region NotFoundLocationCache class | ||
2562 | // A collection of not found locations to make future lookups 'not found' lookups quick. | ||
2563 | // A simple expiring cache that keeps not found locations for some number of seconds. | ||
2564 | // A 'not found' location is presumed to be anywhere in the minimum sized region that | ||
2565 | // contains that point. A conservitive estimate. | ||
2566 | private class NotFoundLocationCache | ||
2567 | { | ||
2568 | private struct NotFoundLocation | ||
2569 | { | ||
2570 | public double minX, maxX, minY, maxY; | ||
2571 | public DateTime expireTime; | ||
2572 | } | ||
2573 | private List<NotFoundLocation> m_notFoundLocations = new List<NotFoundLocation>(); | ||
2574 | public NotFoundLocationCache() | ||
2575 | { | ||
2576 | } | ||
2577 | // Add an area to the list of 'not found' places. The area is the snapped region | ||
2578 | // area around the added point. | ||
2579 | public void Add(double pX, double pY) | ||
2580 | { | ||
2581 | lock (m_notFoundLocations) | ||
2582 | { | ||
2583 | if (!LockedContains(pX, pY)) | ||
2584 | { | ||
2585 | NotFoundLocation nfl = new NotFoundLocation(); | ||
2586 | // A not found location is not found for at least a whole region sized area | ||
2587 | nfl.minX = pX - (pX % (double)Constants.RegionSize); | ||
2588 | nfl.minY = pY - (pY % (double)Constants.RegionSize); | ||
2589 | nfl.maxX = nfl.minX + (double)Constants.RegionSize; | ||
2590 | nfl.maxY = nfl.minY + (double)Constants.RegionSize; | ||
2591 | nfl.expireTime = DateTime.Now + TimeSpan.FromSeconds(30); | ||
2592 | m_notFoundLocations.Add(nfl); | ||
2593 | } | ||
2594 | } | ||
2595 | |||
2596 | } | ||
2597 | // Test to see of this point is in any of the 'not found' areas. | ||
2598 | // Return 'true' if the point is found inside the 'not found' areas. | ||
2599 | public bool Contains(double pX, double pY) | ||
2600 | { | ||
2601 | bool ret = false; | ||
2602 | lock (m_notFoundLocations) | ||
2603 | ret = LockedContains(pX, pY); | ||
2604 | return ret; | ||
2605 | } | ||
2606 | private bool LockedContains(double pX, double pY) | ||
2607 | { | ||
2608 | bool ret = false; | ||
2609 | this.DoExpiration(); | ||
2610 | foreach (NotFoundLocation nfl in m_notFoundLocations) | ||
2611 | { | ||
2612 | if (pX >= nfl.minX && pX < nfl.maxX && pY >= nfl.minY && pY < nfl.maxY) | ||
2613 | { | ||
2614 | ret = true; | ||
2615 | break; | ||
2616 | } | ||
2617 | } | ||
2618 | return ret; | ||
2619 | } | ||
2620 | private void DoExpiration() | ||
2621 | { | ||
2622 | List<NotFoundLocation> m_toRemove = null; | ||
2623 | DateTime now = DateTime.Now; | ||
2624 | foreach (NotFoundLocation nfl in m_notFoundLocations) | ||
2625 | { | ||
2626 | if (nfl.expireTime < now) | ||
2627 | { | ||
2628 | if (m_toRemove == null) | ||
2629 | m_toRemove = new List<NotFoundLocation>(); | ||
2630 | m_toRemove.Add(nfl); | ||
2631 | } | ||
2632 | } | ||
2633 | if (m_toRemove != null) | ||
2634 | { | ||
2635 | foreach (NotFoundLocation nfl in m_toRemove) | ||
2636 | m_notFoundLocations.Remove(nfl); | ||
2637 | m_toRemove.Clear(); | ||
2638 | } | ||
2639 | } | ||
2640 | } | ||
2641 | #endregion // NotFoundLocationCache class | ||
2642 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); | ||
2643 | |||
2644 | // Given a world position (fractional meter coordinate), get the GridRegion info for | ||
2645 | // the region containing that point. | ||
2646 | // Someday this should be a method on GridService. | ||
2647 | // 'pSizeHint' is the size of the source region but since the destination point can be anywhere | ||
2648 | // the size of the target region is unknown thus the search area might have to be very large. | ||
2649 | // Return 'null' if no such region exists. | ||
2650 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, | ||
2651 | double px, double py, uint pSizeHint) | ||
2652 | { | ||
2653 | m_log.DebugFormat("{0} GetRegionContainingWorldLocation: query, loc=<{1},{2}>", LogHeader, px, py); | ||
2654 | ======= | ||
2655 | // needed for current OSG or old grid code | 2294 | // needed for current OSG or old grid code |
2656 | 2295 | ||
2657 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | 2296 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) |
@@ -2671,7 +2310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2671 | double px, double py, uint pSizeHint) | 2310 | double px, double py, uint pSizeHint) |
2672 | { | 2311 | { |
2673 | m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); | 2312 | m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); |
2674 | >>>>>>> avn/ubitvar | ||
2675 | GridRegion ret = null; | 2313 | GridRegion ret = null; |
2676 | const double fudge = 2.0; | 2314 | const double fudge = 2.0; |
2677 | 2315 | ||
@@ -2765,13 +2403,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2765 | IPEndPoint endPoint, bool newAgent) | 2403 | IPEndPoint endPoint, bool newAgent) |
2766 | { | 2404 | { |
2767 | 2405 | ||
2768 | <<<<<<< HEAD | ||
2769 | Scene scene = sp.Scene; | ||
2770 | |||
2771 | m_log.DebugFormat( | ||
2772 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | ||
2773 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); | ||
2774 | ======= | ||
2775 | if (newAgent) | 2406 | if (newAgent) |
2776 | { | 2407 | { |
2777 | Scene scene = sp.Scene; | 2408 | Scene scene = sp.Scene; |
@@ -2779,17 +2410,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2779 | m_log.DebugFormat( | 2410 | m_log.DebugFormat( |
2780 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | 2411 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |
2781 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); | 2412 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); |
2782 | >>>>>>> avn/ubitvar | ||
2783 | 2413 | ||
2784 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); | 2414 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); |
2785 | 2415 | ||
2786 | string reason = String.Empty; | 2416 | string reason = String.Empty; |
2787 | 2417 | ||
2788 | <<<<<<< HEAD | 2418 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason); |
2789 | bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason); | ||
2790 | ======= | ||
2791 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); | ||
2792 | >>>>>>> avn/ubitvar | ||
2793 | 2419 | ||
2794 | if (regionAccepted) | 2420 | if (regionAccepted) |
2795 | { | 2421 | { |
@@ -2848,10 +2474,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2848 | extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); | 2474 | extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); |
2849 | } | 2475 | } |
2850 | 2476 | ||
2851 | <<<<<<< HEAD | ||
2852 | ======= | ||
2853 | |||
2854 | >>>>>>> avn/ubitvar | ||
2855 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; | 2477 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; |
2856 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; | 2478 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; |
2857 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; | 2479 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; |
@@ -2865,11 +2487,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2865 | /// <param name="pRegionLocX"></param> | 2487 | /// <param name="pRegionLocX"></param> |
2866 | /// <param name="pRegionLocY"></param> | 2488 | /// <param name="pRegionLocY"></param> |
2867 | /// <returns></returns> | 2489 | /// <returns></returns> |
2868 | <<<<<<< HEAD | ||
2869 | protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) | ||
2870 | ======= | ||
2871 | protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) | 2490 | protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
2872 | >>>>>>> avn/ubitvar | ||
2873 | { | 2491 | { |
2874 | Scene pScene = avatar.Scene; | 2492 | Scene pScene = avatar.Scene; |
2875 | RegionInfo m_regionInfo = pScene.RegionInfo; | 2493 | RegionInfo m_regionInfo = pScene.RegionInfo; |
@@ -2880,22 +2498,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2880 | // view to include everything in the megaregion | 2498 | // view to include everything in the megaregion |
2881 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 2499 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
2882 | { | 2500 | { |
2883 | <<<<<<< HEAD | ||
2884 | // The area to check is as big as the current region. | ||
2885 | // We presume all adjacent regions are the same size as this region. | ||
2886 | uint dd = Math.Max((uint)avatar.Scene.DefaultDrawDistance, | ||
2887 | Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); | ||
2888 | |||
2889 | uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2; | ||
2890 | uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2; | ||
2891 | |||
2892 | uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; | ||
2893 | uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; | ||
2894 | |||
2895 | neighbours | ||
2896 | = avatar.Scene.GridService.GetRegionRange( | ||
2897 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); | ||
2898 | ======= | ||
2899 | uint dd = (uint)avatar.DrawDistance; | 2501 | uint dd = (uint)avatar.DrawDistance; |
2900 | 2502 | ||
2901 | // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors | 2503 | // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors |
@@ -2919,8 +2521,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2919 | neighbours | 2521 | neighbours |
2920 | = avatar.Scene.GridService.GetRegionRange( | 2522 | = avatar.Scene.GridService.GetRegionRange( |
2921 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); | 2523 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); |
2922 | |||
2923 | >>>>>>> avn/ubitvar | ||
2924 | } | 2524 | } |
2925 | else | 2525 | else |
2926 | { | 2526 | { |
@@ -2934,24 +2534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2934 | (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); | 2534 | (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); |
2935 | } | 2535 | } |
2936 | 2536 | ||
2937 | <<<<<<< HEAD | ||
2938 | // neighbours.ForEach( | ||
2939 | // n => | ||
2940 | // m_log.DebugFormat( | ||
2941 | // "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}", | ||
2942 | // n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present")); | ||
2943 | |||
2944 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). | ||
2945 | neighbours.RemoveAll( | ||
2946 | r => | ||
2947 | r.RegionID == m_regionInfo.RegionID | ||
2948 | || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0)); | ||
2949 | |||
2950 | ======= | ||
2951 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). | 2537 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). |
2952 | neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); | 2538 | neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); |
2953 | 2539 | ||
2954 | >>>>>>> avn/ubitvar | ||
2955 | return neighbours; | 2540 | return neighbours; |
2956 | } | 2541 | } |
2957 | #endregion | 2542 | #endregion |
@@ -3036,23 +2621,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
3036 | if (scene == null) | 2621 | if (scene == null) |
3037 | return; | 2622 | return; |
3038 | 2623 | ||
3039 | <<<<<<< HEAD | ||
3040 | if (grp.RootPart.DIE_AT_EDGE) | ||
3041 | { | ||
3042 | // We remove the object here | ||
3043 | try | ||
3044 | { | ||
3045 | scene.DeleteSceneObject(grp, false); | ||
3046 | } | ||
3047 | catch (Exception) | ||
3048 | { | ||
3049 | m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); | ||
3050 | } | ||
3051 | return; | ||
3052 | } | ||
3053 | |||
3054 | ======= | ||
3055 | >>>>>>> avn/ubitvar | ||
3056 | // Remember the old group position in case the region lookup fails so position can be restored. | 2624 | // Remember the old group position in case the region lookup fails so position can be restored. |
3057 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | 2625 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; |
3058 | 2626 | ||