diff options
author | Robert Adams | 2013-12-24 11:51:50 -0800 |
---|---|---|
committer | Robert Adams | 2013-12-24 11:51:50 -0800 |
commit | 5c9fa15f30f4e245d2f200940e1f89782230fa3e (patch) | |
tree | c9fd1daf23ad2f5994a1e67dbb6626f87b6d9abd /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into varregion (diff) | |
download | opensim-SC-5c9fa15f30f4e245d2f200940e1f89782230fa3e.zip opensim-SC-5c9fa15f30f4e245d2f200940e1f89782230fa3e.tar.gz opensim-SC-5c9fa15f30f4e245d2f200940e1f89782230fa3e.tar.bz2 opensim-SC-5c9fa15f30f4e245d2f200940e1f89782230fa3e.tar.xz |
varregion: fix bug where destination region is not found and object is
not restored to its original location.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 108 |
1 files changed, 61 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4954cd9..893b3c6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1399,26 +1399,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1399 | // Compute the entity's position relative to the new region | 1399 | // Compute the entity's position relative to the new region |
1400 | newpos = new Vector3( (float)(presenceWorldX - (double)neighbourRegion.RegionLocX), | 1400 | newpos = new Vector3( (float)(presenceWorldX - (double)neighbourRegion.RegionLocX), |
1401 | (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), | 1401 | (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), |
1402 | pos.Z); | 1402 | pos.Z); |
1403 | 1403 | ||
1404 | // Check if banned from destination region. | 1404 | // Check if banned from destination region. |
1405 | ExpiringCache<ulong, DateTime> r; | 1405 | ExpiringCache<ulong, DateTime> r; |
1406 | DateTime banUntil; | 1406 | DateTime banUntil; |
1407 | if (m_bannedRegions.TryGetValue(agentID, out r)) | 1407 | if (m_bannedRegions.TryGetValue(agentID, out r)) |
1408 | { | 1408 | { |
1409 | if (r.TryGetValue(neighbourRegion.RegionHandle, out banUntil)) | 1409 | if (r.TryGetValue(neighbourRegion.RegionHandle, out banUntil)) |
1410 | { | 1410 | { |
1411 | if (DateTime.Now < banUntil) | 1411 | if (DateTime.Now < banUntil) |
1412 | { | 1412 | { |
1413 | // If we're banned from the destination, we just can't go there. | 1413 | // If we're banned from the destination, we just can't go there. |
1414 | neighbourRegion = null; | 1414 | neighbourRegion = null; |
1415 | } | 1415 | } |
1416 | r.Remove(neighbourRegion.RegionHandle); | 1416 | r.Remove(neighbourRegion.RegionHandle); |
1417 | } | 1417 | } |
1418 | } | 1418 | } |
1419 | else | 1419 | else |
1420 | { | 1420 | { |
1421 | r = null; | 1421 | r = null; |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | // Check to see if we have access to the target region. | 1424 | // Check to see if we have access to the target region. |
@@ -1434,13 +1434,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1434 | m_bannedRegions.Add(agentID, r, TimeSpan.FromSeconds(45)); | 1434 | m_bannedRegions.Add(agentID, r, TimeSpan.FromSeconds(45)); |
1435 | } | 1435 | } |
1436 | else | 1436 | else |
1437 | { | 1437 | { |
1438 | r.Add(neighbourRegion.RegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); | 1438 | r.Add(neighbourRegion.RegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); |
1439 | } | 1439 | } |
1440 | neighbourRegion = null; | 1440 | neighbourRegion = null; |
1441 | } | 1441 | } |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | if (neighbourRegion == null) | ||
1445 | m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", | ||
1446 | LogHeader, scene.RegionInfo.RegionName, | ||
1447 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, | ||
1448 | scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, | ||
1449 | pos); | ||
1450 | else | ||
1451 | m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>", | ||
1452 | LogHeader, neighbourRegion.RegionName, | ||
1453 | neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY, | ||
1454 | newpos.X, newpos.Y); | ||
1455 | |||
1444 | return neighbourRegion; | 1456 | return neighbourRegion; |
1445 | } | 1457 | } |
1446 | 1458 | ||
@@ -1560,17 +1572,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1560 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 1572 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1561 | /// </summary> | 1573 | /// </summary> |
1562 | public ScenePresence CrossAgentToNewRegionAsync( | 1574 | public ScenePresence CrossAgentToNewRegionAsync( |
1563 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1575 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1564 | bool isFlying, string version) | 1576 | bool isFlying, string version) |
1565 | { | 1577 | { |
1578 | m_log.DebugFormat("{0} CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}", | ||
1579 | LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos); | ||
1580 | |||
1566 | if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) | 1581 | if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) |
1567 | { | 1582 | { |
1583 | m_log.DebugFormat("{0} CrossAgentToNewRegionAsync: prep failed. Resetting transfer state", LogHeader); | ||
1568 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1584 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1569 | return agent; | 1585 | return agent; |
1570 | } | 1586 | } |
1571 | 1587 | ||
1572 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) | 1588 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) |
1573 | { | 1589 | { |
1590 | m_log.DebugFormat("{0} CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); | ||
1574 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1591 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1575 | return agent; | 1592 | return agent; |
1576 | } | 1593 | } |
@@ -2294,28 +2311,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2294 | attemptedPosition.Z); | 2311 | attemptedPosition.Z); |
2295 | } | 2312 | } |
2296 | 2313 | ||
2297 | if (destination != null) | 2314 | if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent)) |
2298 | { | 2315 | { |
2299 | if (!CrossPrimGroupIntoNewRegion(destination, pos, grp, silent)) | 2316 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}", grp.UUID); |
2300 | { | 2317 | |
2301 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}", grp.UUID); | 2318 | // We are going to move the object back to the old position so long as the old position |
2302 | 2319 | // is in the region | |
2303 | // We are going to move the object back to the old position so long as the old position | 2320 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 1.0f, (float)(scene.RegionInfo.RegionSizeX - 1)); |
2304 | // is in the region | 2321 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 1.0f, (float)(scene.RegionInfo.RegionSizeY - 1)); |
2305 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 1.0f, (float)(scene.RegionInfo.RegionSizeX - 1)); | 2322 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 1.0f, Constants.RegionHeight); |
2306 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 1.0f, (float)(scene.RegionInfo.RegionSizeY - 1)); | 2323 | |
2307 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 1.0f, Constants.RegionHeight); | 2324 | grp.AbsolutePosition = oldGroupPosition; |
2308 | 2325 | grp.Velocity = Vector3.Zero; | |
2309 | grp.AbsolutePosition = oldGroupPosition; | 2326 | if (grp.RootPart.PhysActor != null) |
2310 | grp.Velocity = Vector3.Zero; | 2327 | grp.RootPart.PhysActor.CrossingFailure(); |
2311 | if (grp.RootPart.PhysActor != null) | 2328 | |
2312 | grp.RootPart.PhysActor.CrossingFailure(); | 2329 | if (grp.RootPart.KeyframeMotion != null) |
2313 | 2330 | grp.RootPart.KeyframeMotion.CrossingFailure(); | |
2314 | if (grp.RootPart.KeyframeMotion != null) | 2331 | |
2315 | grp.RootPart.KeyframeMotion.CrossingFailure(); | 2332 | grp.ScheduleGroupForFullUpdate(); |
2316 | |||
2317 | grp.ScheduleGroupForFullUpdate(); | ||
2318 | } | ||
2319 | } | 2333 | } |
2320 | } | 2334 | } |
2321 | 2335 | ||