diff options
author | Melanie Thielker | 2008-08-14 00:04:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-14 00:04:37 +0000 |
commit | e3157e61aa50d057b4345cb9d49c973afeb26b15 (patch) | |
tree | 8452565ff0d7e6c3d07541743e0e5f665bc7d03c /OpenSim/Region | |
parent | * minor: make it clear on the console when a client is being logged out becau... (diff) | |
download | opensim-SC-e3157e61aa50d057b4345cb9d49c973afeb26b15.zip opensim-SC-e3157e61aa50d057b4345cb9d49c973afeb26b15.tar.gz opensim-SC-e3157e61aa50d057b4345cb9d49c973afeb26b15.tar.bz2 opensim-SC-e3157e61aa50d057b4345cb9d49c973afeb26b15.tar.xz |
Mantis #1946
Thank you, HomerHorwitz, for a patch that corrects and improves TP
to landmark and home position handling.
Diffstat (limited to '')
5 files changed, 69 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 12e5452..245f533 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -5241,7 +5241,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5241 | handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; | 5241 | handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; |
5242 | if (handlerTeleportLandmarkRequest != null) | 5242 | if (handlerTeleportLandmarkRequest != null) |
5243 | { | 5243 | { |
5244 | handlerTeleportLandmarkRequest(this, lm.RegionHandle, lm.Position); | 5244 | handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); |
5245 | } | 5245 | } |
5246 | else | 5246 | else |
5247 | { | 5247 | { |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 8d6bbcc..a608da0 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -172,6 +172,16 @@ namespace OpenSim.Region.Communications.Local | |||
172 | return null; | 172 | return null; |
173 | } | 173 | } |
174 | 174 | ||
175 | public RegionInfo RequestNeighbourInfo(LLUUID regionID) | ||
176 | { | ||
177 | // TODO add a dictionary for faster lookup | ||
178 | foreach(RegionInfo info in m_regions.Values) | ||
179 | { | ||
180 | if(info.RegionID == regionID) return info; | ||
181 | } | ||
182 | return null; | ||
183 | } | ||
184 | |||
175 | public RegionInfo RequestClosestRegion(string regionName) | 185 | public RegionInfo RequestClosestRegion(string regionName) |
176 | { | 186 | { |
177 | foreach (RegionInfo regInfo in m_regions.Values) | 187 | foreach (RegionInfo regInfo in m_regions.Values) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index c6f905f..2d37e2f 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -75,6 +75,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
75 | userData.Image = new LLUUID((string) data["profile_image"]); | 75 | userData.Image = new LLUUID((string) data["profile_image"]); |
76 | userData.LastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); | 76 | userData.LastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); |
77 | userData.HomeRegion = Convert.ToUInt64((string) data["home_region"]); | 77 | userData.HomeRegion = Convert.ToUInt64((string) data["home_region"]); |
78 | if(data.Contains("home_region_id")) userData.HomeRegionID = new LLUUID((string)data["home_region_id"]); | ||
79 | else userData.HomeRegionID = LLUUID.Zero; | ||
78 | userData.HomeLocation = | 80 | userData.HomeLocation = |
79 | new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), | 81 | new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), |
80 | (float) Convert.ToDecimal((string) data["home_coordinates_y"]), | 82 | (float) Convert.ToDecimal((string) data["home_coordinates_y"]), |
@@ -83,7 +85,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
83 | new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), | 85 | new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), |
84 | (float) Convert.ToDecimal((string) data["home_look_y"]), | 86 | (float) Convert.ToDecimal((string) data["home_look_y"]), |
85 | (float) Convert.ToDecimal((string) data["home_look_z"])); | 87 | (float) Convert.ToDecimal((string) data["home_look_z"])); |
86 | |||
87 | return userData; | 88 | return userData; |
88 | } | 89 | } |
89 | 90 | ||
@@ -453,6 +454,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
453 | //param["ProfileURL"] = UserProfile.ProfileURL.ToString(); | 454 | //param["ProfileURL"] = UserProfile.ProfileURL.ToString(); |
454 | 455 | ||
455 | param["home_region"] = UserProfile.HomeRegion.ToString(); | 456 | param["home_region"] = UserProfile.HomeRegion.ToString(); |
457 | param["home_region_id"] = UserProfile.HomeRegionID.ToString(); | ||
456 | 458 | ||
457 | param["home_pos_x"] = UserProfile.HomeLocationX.ToString(); | 459 | param["home_pos_x"] = UserProfile.HomeLocationX.ToString(); |
458 | param["home_pos_y"] = UserProfile.HomeLocationY.ToString(); | 460 | param["home_pos_y"] = UserProfile.HomeLocationY.ToString(); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 3b961a5..b4bb2f6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2104,10 +2104,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
2104 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId); | 2104 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId); |
2105 | if (UserProfile != null) | 2105 | if (UserProfile != null) |
2106 | { | 2106 | { |
2107 | ulong homeRegion = UserProfile.HomeRegion; | 2107 | LLUUID homeRegionID = UserProfile.HomeRegionID; |
2108 | LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ); | 2108 | LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ); |
2109 | LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt); | 2109 | LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt); |
2110 | RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0); | 2110 | ulong homeRegionHandle = UserProfile.HomeRegion; |
2111 | if(homeRegionID == LLUUID.Zero) | ||
2112 | { | ||
2113 | RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); | ||
2114 | if(info == null) | ||
2115 | { | ||
2116 | // can't find the region: Tell viewer and abort | ||
2117 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2118 | return; | ||
2119 | } | ||
2120 | UserProfile.HomeRegionID = info.RegionID; | ||
2121 | CommsManager.UserService.UpdateUserProfileProperties(UserProfile); | ||
2122 | } | ||
2123 | else | ||
2124 | { | ||
2125 | RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(homeRegionID); | ||
2126 | if(info == null) | ||
2127 | { | ||
2128 | // can't find the region: Tell viewer and abort | ||
2129 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2130 | return; | ||
2131 | } | ||
2132 | homeRegionHandle = info.RegionHandle; | ||
2133 | } | ||
2134 | RequestTeleportLocation(client, homeRegionHandle, homePostion,homeLookat,(uint)0); | ||
2111 | } | 2135 | } |
2112 | } | 2136 | } |
2113 | 2137 | ||
@@ -2189,6 +2213,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2189 | { | 2213 | { |
2190 | // I know I'm ignoring the regionHandle provided by the teleport location request. | 2214 | // I know I'm ignoring the regionHandle provided by the teleport location request. |
2191 | // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid | 2215 | // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid |
2216 | UserProfile.HomeRegionID = RegionInfo.RegionID; | ||
2217 | // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. | ||
2218 | // TODO: The HomeRegion property can be removed then, too | ||
2192 | UserProfile.HomeRegion = RegionInfo.RegionHandle; | 2219 | UserProfile.HomeRegion = RegionInfo.RegionHandle; |
2193 | 2220 | ||
2194 | // We cast these to an int so as not to cause a breaking change with old regions | 2221 | // 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 | |||
2718 | /// <param name="remoteClient"></param> | 2745 | /// <param name="remoteClient"></param> |
2719 | /// <param name="regionHandle"></param> | 2746 | /// <param name="regionHandle"></param> |
2720 | /// <param name="position"></param> | 2747 | /// <param name="position"></param> |
2721 | public void RequestTeleportLandmark(IClientAPI remoteClient, ulong regionHandle, LLVector3 position) | 2748 | public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position) |
2722 | { | 2749 | { |
2750 | RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); | ||
2751 | if(info == null) | ||
2752 | { | ||
2753 | // can't find the region: Tell viewer and abort | ||
2754 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); | ||
2755 | return; | ||
2756 | } | ||
2723 | lock (m_scenePresences) | 2757 | lock (m_scenePresences) |
2724 | { | 2758 | { |
2725 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) | 2759 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) |
2726 | { | 2760 | { |
2727 | m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, | 2761 | m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle, |
2728 | position, LLVector3.Zero, 0); | 2762 | position, LLVector3.Zero, 0); |
2729 | } | 2763 | } |
2730 | } | 2764 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 348b643..008d67a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -532,6 +532,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
532 | } | 532 | } |
533 | 533 | ||
534 | /// <summary> | 534 | /// <summary> |
535 | /// Helper function to request neighbors from grid-comms | ||
536 | /// </summary> | ||
537 | /// <param name="regionID"></param> | ||
538 | /// <returns></returns> | ||
539 | public virtual RegionInfo RequestNeighbouringRegionInfo(LLUUID regionID) | ||
540 | { | ||
541 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionID); | ||
542 | return m_commsProvider.GridService.RequestNeighbourInfo(regionID); | ||
543 | } | ||
544 | |||
545 | /// <summary> | ||
535 | /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates | 546 | /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates |
536 | /// </summary> | 547 | /// </summary> |
537 | /// <param name="minX"></param> | 548 | /// <param name="minX"></param> |
@@ -597,8 +608,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
597 | // once we reach here... | 608 | // once we reach here... |
598 | avatar.Scene.RemoveCapsHandler(avatar.UUID); | 609 | avatar.Scene.RemoveCapsHandler(avatar.UUID); |
599 | 610 | ||
600 | m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 611 | m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); |
601 | m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, | 612 | m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, |
602 | position, false); | 613 | position, false); |
603 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); | 614 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); |
604 | 615 | ||
@@ -610,17 +621,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
610 | m_log.DebugFormat( | 621 | m_log.DebugFormat( |
611 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); | 622 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); |
612 | 623 | ||
613 | avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), | 624 | avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), |
614 | capsPath); | 625 | capsPath); |
615 | avatar.MakeChildAgent(); | 626 | avatar.MakeChildAgent(); |
616 | Thread.Sleep(5000); | 627 | Thread.Sleep(5000); |
617 | avatar.CrossAttachmentsIntoNewRegion(regionHandle); | 628 | avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle); |
618 | if (KillObject != null) | 629 | if (KillObject != null) |
619 | { | 630 | { |
620 | KillObject(avatar.LocalId); | 631 | KillObject(avatar.LocalId); |
621 | } | 632 | } |
622 | uint newRegionX = (uint)(regionHandle >> 40); | 633 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
623 | uint newRegionY = (((uint)(regionHandle)) >> 8); | 634 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
624 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | 635 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); |
625 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 636 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); |
626 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | 637 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) |