Sends the consistent child agent position upon creation of the child agent in other regions, as opposed to <128, 128, 70>

iar_mods
Diva Canto 2011-12-16 09:33:22 -08:00
parent 3bf699ad36
commit 8300bb651e
1 changed files with 12 additions and 1 deletions

View File

@ -1213,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
agent.startpos = new Vector3(128, 128, 70); agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
agent.child = true; agent.child = true;
agent.Appearance = sp.Appearance; agent.Appearance = sp.Appearance;
if (currentAgentCircuit != null) 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) private void InformClientOfNeighbourCompleted(IAsyncResult iar)
{ {
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState;