diff options
author | UbitUmarov | 2014-10-21 11:57:47 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-21 11:57:47 +0100 |
commit | 59413adceecd7f6c9132f03b436b7a0b5cabb443 (patch) | |
tree | 5ff0b203e40f2a693ac9e6130a89cff550cd82a9 /OpenSim/Region | |
parent | Assume childreen don't need to know caps seeds (diff) | |
download | opensim-SC-59413adceecd7f6c9132f03b436b7a0b5cabb443.zip opensim-SC-59413adceecd7f6c9132f03b436b7a0b5cabb443.tar.gz opensim-SC-59413adceecd7f6c9132f03b436b7a0b5cabb443.tar.bz2 opensim-SC-59413adceecd7f6c9132f03b436b7a0b5cabb443.tar.xz |
do agent crossing async, including QUERYACCESS ( need to check vehicles for
this also ), so it doesn't stop heartbeat
Diffstat (limited to 'OpenSim/Region')
3 files changed, 56 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 19f748a..c898946 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1511,6 +1511,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1511 | 1511 | ||
1512 | public bool Cross(ScenePresence agent, bool isFlying) | 1512 | public bool Cross(ScenePresence agent, bool isFlying) |
1513 | { | 1513 | { |
1514 | agent.IsInTransit = true; | ||
1515 | CrossAsyncDelegate d = CrossAsync; | ||
1516 | d.BeginInvoke(agent, isFlying, CrossCompleted, d); | ||
1517 | return true; | ||
1518 | } | ||
1519 | |||
1520 | private void CrossCompleted(IAsyncResult iar) | ||
1521 | { | ||
1522 | CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState; | ||
1523 | ScenePresence agent = icon.EndInvoke(iar); | ||
1524 | |||
1525 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
1526 | |||
1527 | if(!agent.IsChildAgent) | ||
1528 | { | ||
1529 | // crossing failed | ||
1530 | agent.CrossToNewRegionFail(); | ||
1531 | } | ||
1532 | agent.IsInTransit = false; | ||
1533 | } | ||
1534 | |||
1535 | |||
1536 | public ScenePresence CrossAsync(ScenePresence agent, bool isFlying) | ||
1537 | { | ||
1514 | uint x; | 1538 | uint x; |
1515 | uint y; | 1539 | uint y; |
1516 | Vector3 newpos; | 1540 | Vector3 newpos; |
@@ -1525,16 +1549,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1525 | if (reason == String.Empty) | 1549 | if (reason == String.Empty) |
1526 | agent.ControllingClient.SendAlertMessage("Cannot cross to region"); | 1550 | agent.ControllingClient.SendAlertMessage("Cannot cross to region"); |
1527 | else | 1551 | else |
1528 | agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason); | 1552 | agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason); |
1529 | return false; | 1553 | return agent; |
1530 | } | 1554 | } |
1531 | 1555 | ||
1532 | agent.IsInTransit = true; | 1556 | // agent.IsInTransit = true; |
1533 | |||
1534 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | ||
1535 | d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); | ||
1536 | 1557 | ||
1537 | return true; | 1558 | CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); |
1559 | agent.IsInTransit = false; | ||
1560 | return agent; | ||
1538 | } | 1561 | } |
1539 | 1562 | ||
1540 | 1563 | ||
@@ -1787,8 +1810,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1787 | 1810 | ||
1788 | agent.CloseChildAgents(neighbourx, neighboury); | 1811 | agent.CloseChildAgents(neighbourx, neighboury); |
1789 | 1812 | ||
1790 | |||
1791 | |||
1792 | // the user may change their profile information in other region, | 1813 | // the user may change their profile information in other region, |
1793 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1814 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
1794 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 1815 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 214b07a..0c34c90 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Region.Framework.Scenes; | |||
36 | namespace OpenSim.Region.Framework.Interfaces | 36 | namespace OpenSim.Region.Framework.Interfaces |
37 | { | 37 | { |
38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); | 38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); |
39 | public delegate ScenePresence CrossAsyncDelegate(ScenePresence agent, bool isFlying); | ||
39 | 40 | ||
40 | public interface IEntityTransferModule | 41 | public interface IEntityTransferModule |
41 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 754dd96..b746e3a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3980,6 +3980,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3980 | 3980 | ||
3981 | } | 3981 | } |
3982 | 3982 | ||
3983 | public void CrossToNewRegionFail() | ||
3984 | { | ||
3985 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
3986 | { | ||
3987 | bool isFlying = Flying; | ||
3988 | RemoveFromPhysicalScene(); | ||
3989 | |||
3990 | Vector3 pos = AbsolutePosition; | ||
3991 | if (AbsolutePosition.X < 0) | ||
3992 | pos.X += Velocity.X * 2; | ||
3993 | else if (AbsolutePosition.X > Constants.RegionSize) | ||
3994 | pos.X -= Velocity.X * 2; | ||
3995 | if (AbsolutePosition.Y < 0) | ||
3996 | pos.Y += Velocity.Y * 2; | ||
3997 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
3998 | pos.Y -= Velocity.Y * 2; | ||
3999 | Velocity = Vector3.Zero; | ||
4000 | AbsolutePosition = pos; | ||
4001 | |||
4002 | AddToPhysicalScene(isFlying); | ||
4003 | } | ||
4004 | |||
4005 | } | ||
4006 | |||
3983 | /// <summary> | 4007 | /// <summary> |
3984 | /// Moves the agent outside the region bounds | 4008 | /// Moves the agent outside the region bounds |
3985 | /// Tells neighbor region that we're crossing to it | 4009 | /// Tells neighbor region that we're crossing to it |
@@ -3996,7 +4020,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3996 | } | 4020 | } |
3997 | catch | 4021 | catch |
3998 | { | 4022 | { |
3999 | result = m_scene.CrossAgentToNewRegion(this, false); | 4023 | // result = m_scene.CrossAgentToNewRegion(this, false); |
4000 | } | 4024 | } |
4001 | // if(!result) | 4025 | // if(!result) |
4002 | // parcelRegionCross(true); | 4026 | // parcelRegionCross(true); |