diff options
author | UbitUmarov | 2017-04-15 10:46:18 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-15 10:46:18 +0100 |
commit | 0f7ffc56cee22aa95af58d19d3ea2193cea07340 (patch) | |
tree | 52ce76df16017d5adb3e1c8d1fa788ab90d26c65 /OpenSim/Region/CoreModules | |
parent | still issues with volume detectors and sleeping bodies (diff) | |
download | opensim-SC_OLD-0f7ffc56cee22aa95af58d19d3ea2193cea07340.zip opensim-SC_OLD-0f7ffc56cee22aa95af58d19d3ea2193cea07340.tar.gz opensim-SC_OLD-0f7ffc56cee22aa95af58d19d3ea2193cea07340.tar.bz2 opensim-SC_OLD-0f7ffc56cee22aa95af58d19d3ea2193cea07340.tar.xz |
several changes for osTeleportObject
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 92 |
1 files changed, 86 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 92485a1..87b76dc 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1703,11 +1703,81 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1703 | return agent; | 1703 | return agent; |
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx) | ||
1707 | { | ||
1708 | ulong regionhandler = neighbourRegion.RegionHandle; | ||
1709 | |||
1710 | if(agent.knowsNeighbourRegion(regionhandler)) | ||
1711 | return true; | ||
1712 | |||
1713 | string reason; | ||
1714 | ulong currentRegionHandler = agent.Scene.RegionInfo.RegionHandle; | ||
1715 | GridRegion source = new GridRegion(agent.Scene.RegionInfo); | ||
1716 | |||
1717 | AgentCircuitData currentAgentCircuit = | ||
1718 | agent.Scene.AuthenticateHandler.GetAgentCircuitData(agent.ControllingClient.CircuitCode); | ||
1719 | AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo(); | ||
1720 | agentCircuit.startpos = pos; | ||
1721 | agentCircuit.child = true; | ||
1722 | |||
1723 | agentCircuit.Appearance = new AvatarAppearance(); | ||
1724 | agentCircuit.Appearance.AvatarHeight = agent.Appearance.AvatarHeight; | ||
1725 | |||
1726 | if (currentAgentCircuit != null) | ||
1727 | { | ||
1728 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
1729 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
1730 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
1731 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
1732 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
1733 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
1734 | } | ||
1735 | |||
1736 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
1737 | agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath); | ||
1738 | |||
1739 | IPEndPoint endPoint = neighbourRegion.ExternalEndPoint; | ||
1740 | if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) | ||
1741 | { | ||
1742 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
1743 | int newSizeX = neighbourRegion.RegionSizeX; | ||
1744 | int newSizeY = neighbourRegion.RegionSizeY; | ||
1745 | |||
1746 | if (m_eqModule != null) | ||
1747 | { | ||
1748 | #region IP Translation for NAT | ||
1749 | IClientIPEndpoint ipepClient; | ||
1750 | if (agent.ClientView.TryGet(out ipepClient)) | ||
1751 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
1752 | |||
1753 | m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + | ||
1754 | "and EstablishAgentCommunication with seed cap {8}", LogHeader, | ||
1755 | source.RegionName, agent.Name, | ||
1756 | neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath); | ||
1757 | |||
1758 | m_eqModule.EnableSimulator(regionhandler, | ||
1759 | endPoint, agent.UUID, newSizeX, newSizeY); | ||
1760 | m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath, | ||
1761 | regionhandler, newSizeX, newSizeY); | ||
1762 | } | ||
1763 | else | ||
1764 | { | ||
1765 | agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint); | ||
1766 | } | ||
1767 | return true; | ||
1768 | } | ||
1769 | agent.RemoveNeighbourRegion(regionhandler); | ||
1770 | return false; | ||
1771 | } | ||
1772 | |||
1706 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) | 1773 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) |
1707 | { | 1774 | { |
1708 | int ts = Util.EnvironmentTickCount(); | 1775 | int ts = Util.EnvironmentTickCount(); |
1776 | bool sucess = true; | ||
1777 | string reason = String.Empty; | ||
1709 | try | 1778 | try |
1710 | { | 1779 | { |
1780 | |||
1711 | AgentData cAgent = new AgentData(); | 1781 | AgentData cAgent = new AgentData(); |
1712 | agent.CopyTo(cAgent,true); | 1782 | agent.CopyTo(cAgent,true); |
1713 | 1783 | ||
@@ -1725,18 +1795,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1725 | // Beyond this point, extra cleanup is needed beyond removing transit state | 1795 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1726 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | 1796 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); |
1727 | 1797 | ||
1728 | if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)) | 1798 | if (sucess && !agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)) |
1799 | { | ||
1800 | sucess = false; | ||
1801 | reason = "agent update failed"; | ||
1802 | } | ||
1803 | |||
1804 | if(!sucess) | ||
1729 | { | 1805 | { |
1730 | // region doesn't take it | 1806 | // region doesn't take it |
1731 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1807 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1732 | 1808 | ||
1733 | m_log.WarnFormat( | 1809 | m_log.WarnFormat( |
1734 | "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.", | 1810 | "[ENTITY TRANSFER MODULE]: agent {0} crossing to {1} failed: {2}", |
1735 | neighbourRegion.RegionName, agent.Name); | 1811 | agent.Name, neighbourRegion.RegionName, reason); |
1736 | 1812 | ||
1737 | ReInstantiateScripts(agent); | 1813 | ReInstantiateScripts(agent); |
1738 | if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero) | 1814 | if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero) |
1815 | { | ||
1739 | agent.AddToPhysicalScene(isFlying); | 1816 | agent.AddToPhysicalScene(isFlying); |
1817 | } | ||
1740 | 1818 | ||
1741 | return false; | 1819 | return false; |
1742 | } | 1820 | } |
@@ -1777,7 +1855,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1777 | 1855 | ||
1778 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1856 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1779 | 1857 | ||
1780 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | 1858 | Vector3 vel2 = Vector3.Zero; |
1859 | if((agent.crossingFlags & 2) != 0) | ||
1860 | vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | ||
1781 | 1861 | ||
1782 | if (m_eqModule != null) | 1862 | if (m_eqModule != null) |
1783 | { | 1863 | { |
@@ -1804,7 +1884,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1804 | 1884 | ||
1805 | // this may need the attachments | 1885 | // this may need the attachments |
1806 | 1886 | ||
1807 | agent.HasMovedAway(true); | 1887 | agent.HasMovedAway((agent.crossingFlags & 8) == 0); |
1808 | 1888 | ||
1809 | agent.MakeChildAgent(neighbourRegion.RegionHandle); | 1889 | agent.MakeChildAgent(neighbourRegion.RegionHandle); |
1810 | 1890 | ||
@@ -2135,7 +2215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2135 | sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, | 2215 | sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, |
2136 | 0f); | 2216 | 0f); |
2137 | } | 2217 | } |
2138 | 2218 | #endregion | |
2139 | 2219 | ||
2140 | #region NotFoundLocationCache class | 2220 | #region NotFoundLocationCache class |
2141 | // A collection of not found locations to make future lookups 'not found' lookups quick. | 2221 | // A collection of not found locations to make future lookups 'not found' lookups quick. |