From 8300bb651e3d1b3c41bc7923cefde3f3ea96923d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 16 Dec 2011 09:33:22 -0800 Subject: Sends the consistent child agent position upon creation of the child agent in other regions, as opposed to <128, 128, 70> --- .../Framework/EntityTransfer/EntityTransferModule.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2f947fd..87f292c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1213,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; - agent.startpos = new Vector3(128, 128, 70); + agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); agent.child = true; agent.Appearance = sp.Appearance; if (currentAgentCircuit != null) @@ -1305,6 +1305,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) + { + int rRegionX = (int)sp.Scene.RegionInfo.RegionLocX; + int rRegionY = (int)sp.Scene.RegionInfo.RegionLocY; + int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize; + int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize; + int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize; + int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; + return new Vector3(shiftx, shifty, 0f); + } + private void InformClientOfNeighbourCompleted(IAsyncResult iar) { InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; -- cgit v1.1