Thank you, HomerHorwitz, for a patch that corrects and improves TP
to landmark and home position handling.
This commit is contained in:
Melanie Thielker
2008-08-14 00:04:37 +00:00
parent fb4eb05ae1
commit e3157e61aa
12 changed files with 105 additions and 16 deletions

View File

@@ -5241,7 +5241,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
if (handlerTeleportLandmarkRequest != null)
{
handlerTeleportLandmarkRequest(this, lm.RegionHandle, lm.Position);
handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
}
else
{

View File

@@ -172,6 +172,16 @@ namespace OpenSim.Region.Communications.Local
return null;
}
public RegionInfo RequestNeighbourInfo(LLUUID regionID)
{
// TODO add a dictionary for faster lookup
foreach(RegionInfo info in m_regions.Values)
{
if(info.RegionID == regionID) return info;
}
return null;
}
public RegionInfo RequestClosestRegion(string regionName)
{
foreach (RegionInfo regInfo in m_regions.Values)

View File

@@ -75,6 +75,8 @@ namespace OpenSim.Region.Communications.OGS1
userData.Image = new LLUUID((string) data["profile_image"]);
userData.LastLogin = Convert.ToInt32((string) data["profile_lastlogin"]);
userData.HomeRegion = Convert.ToUInt64((string) data["home_region"]);
if(data.Contains("home_region_id")) userData.HomeRegionID = new LLUUID((string)data["home_region_id"]);
else userData.HomeRegionID = LLUUID.Zero;
userData.HomeLocation =
new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]),
(float) Convert.ToDecimal((string) data["home_coordinates_y"]),
@@ -83,7 +85,6 @@ namespace OpenSim.Region.Communications.OGS1
new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
(float) Convert.ToDecimal((string) data["home_look_y"]),
(float) Convert.ToDecimal((string) data["home_look_z"]));
return userData;
}
@@ -453,6 +454,7 @@ namespace OpenSim.Region.Communications.OGS1
//param["ProfileURL"] = UserProfile.ProfileURL.ToString();
param["home_region"] = UserProfile.HomeRegion.ToString();
param["home_region_id"] = UserProfile.HomeRegionID.ToString();
param["home_pos_x"] = UserProfile.HomeLocationX.ToString();
param["home_pos_y"] = UserProfile.HomeLocationY.ToString();

View File

@@ -2104,10 +2104,34 @@ namespace OpenSim.Region.Environment.Scenes
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId);
if (UserProfile != null)
{
ulong homeRegion = UserProfile.HomeRegion;
LLUUID homeRegionID = UserProfile.HomeRegionID;
LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ);
LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt);
RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0);
ulong homeRegionHandle = UserProfile.HomeRegion;
if(homeRegionID == LLUUID.Zero)
{
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
if(info == null)
{
// can't find the region: Tell viewer and abort
client.SendTeleportFailed("Your home-region could not be found.");
return;
}
UserProfile.HomeRegionID = info.RegionID;
CommsManager.UserService.UpdateUserProfileProperties(UserProfile);
}
else
{
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(homeRegionID);
if(info == null)
{
// can't find the region: Tell viewer and abort
client.SendTeleportFailed("Your home-region could not be found.");
return;
}
homeRegionHandle = info.RegionHandle;
}
RequestTeleportLocation(client, homeRegionHandle, homePostion,homeLookat,(uint)0);
}
}
@@ -2189,6 +2213,9 @@ namespace OpenSim.Region.Environment.Scenes
{
// I know I'm ignoring the regionHandle provided by the teleport location request.
// reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
UserProfile.HomeRegionID = RegionInfo.RegionID;
// TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
// TODO: The HomeRegion property can be removed then, too
UserProfile.HomeRegion = RegionInfo.RegionHandle;
// We cast these to an int so as not to cause a breaking change with old regions
@@ -2718,13 +2745,20 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
public void RequestTeleportLandmark(IClientAPI remoteClient, ulong regionHandle, LLVector3 position)
public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position)
{
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID);
if(info == null)
{
// can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The teleport destination could not be found.");
return;
}
lock (m_scenePresences)
{
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle,
position, LLVector3.Zero, 0);
}
}

View File

@@ -531,6 +531,17 @@ namespace OpenSim.Region.Environment.Scenes
return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
}
/// <summary>
/// Helper function to request neighbors from grid-comms
/// </summary>
/// <param name="regionID"></param>
/// <returns></returns>
public virtual RegionInfo RequestNeighbouringRegionInfo(LLUUID regionID)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionID);
return m_commsProvider.GridService.RequestNeighbourInfo(regionID);
}
/// <summary>
/// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
/// </summary>
@@ -597,8 +608,8 @@ namespace OpenSim.Region.Environment.Scenes
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
@@ -610,17 +621,17 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath);
avatar.MakeChildAgent();
Thread.Sleep(5000);
avatar.CrossAttachmentsIntoNewRegion(regionHandle);
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle);
if (KillObject != null)
{
KillObject(avatar.LocalId);
}
uint newRegionX = (uint)(regionHandle >> 40);
uint newRegionY = (((uint)(regionHandle)) >> 8);
uint newRegionX = (uint)(reg.RegionHandle >> 40);
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)