aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs64
2 files changed, 41 insertions, 42 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index ecb806f..f7e4e3c 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -710,18 +710,23 @@ namespace OpenSim.Grid.UserServer
710 { 710 {
711 try 711 try
712 { 712 {
713 UUID userUUID = new UUID((string) requestData["avatar_uuid"]); 713 UUID userUUID = new UUID((string)requestData["avatar_uuid"]);
714 UUID RegionID = new UUID((string) requestData["region_uuid"]); 714 UUID RegionID = new UUID((string)requestData["region_uuid"]);
715 ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); 715 ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
716 float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]); 716 Vector3 position = new Vector3(
717 float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]); 717 (float)Convert.ToDecimal((string)requestData["region_pos_x"]),
718 float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]); 718 (float)Convert.ToDecimal((string)requestData["region_pos_y"]),
719 (float)Convert.ToDecimal((string)requestData["region_pos_z"]));
720 Vector3 lookat = new Vector3(
721 (float)Convert.ToDecimal((string)requestData["lookat_x"]),
722 (float)Convert.ToDecimal((string)requestData["lookat_y"]),
723 (float)Convert.ToDecimal((string)requestData["lookat_z"]));
719 724
720 handlerLogOffUser = OnLogOffUser; 725 handlerLogOffUser = OnLogOffUser;
721 if (handlerLogOffUser != null) 726 if (handlerLogOffUser != null)
722 handlerLogOffUser(userUUID); 727 handlerLogOffUser(userUUID);
723 728
724 LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz); 729 LogOffUser(userUUID, RegionID, regionhandle, position, lookat);
725 } 730 }
726 catch (FormatException) 731 catch (FormatException)
727 { 732 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f90c6fb..7b9183a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -46,9 +46,10 @@ using OpenSim.Region.Environment.Modules.World.Terrain;
46using OpenSim.Region.Environment.Scenes.Scripting; 46using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
48using Nini.Config; 48using Nini.Config;
49using Caps=OpenSim.Framework.Communications.Capabilities.Caps; 49using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
50using Image=System.Drawing.Image; 50using Image = System.Drawing.Image;
51using Timer=System.Timers.Timer; 51using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
52using Timer = System.Timers.Timer;
52 53
53namespace OpenSim.Region.Environment.Scenes 54namespace OpenSim.Region.Environment.Scenes
54{ 55{
@@ -2269,38 +2270,33 @@ namespace OpenSim.Region.Environment.Scenes
2269 2270
2270 m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); 2271 m_log.DebugFormat("gesture : {0} ", gestureId.ToString());
2271 } 2272 }
2272 2273
2274 /// <summary>
2275 /// Teleport an avatar to their home region
2276 /// </summary>
2277 /// <param name="agentId"></param>
2278 /// <param name="client"></param>
2273 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 2279 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2274 { 2280 {
2275 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2281 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
2276 if (UserProfile != null) 2282 if (UserProfile != null)
2277 { 2283 {
2278 UUID homeRegionID = UserProfile.HomeRegionID; 2284 RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegionID);
2279 ulong homeRegionHandle = UserProfile.HomeRegion; 2285 if (regionInfo == null)
2280 if (homeRegionID == UUID.Zero)
2281 { 2286 {
2282 RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); 2287 regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
2283 if (info == null) 2288 UserProfile.HomeRegionID = regionInfo.RegionID;
2284 {
2285 // can't find the region: Tell viewer and abort
2286 client.SendTeleportFailed("Your home-region could not be found.");
2287 return;
2288 }
2289 UserProfile.HomeRegionID = info.RegionID;
2290 CommsManager.UserService.UpdateUserProfile(UserProfile); 2289 CommsManager.UserService.UpdateUserProfile(UserProfile);
2291 } 2290 }
2292 else 2291 if (regionInfo == null)
2293 { 2292 {
2294 RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(homeRegionID); 2293 // can't find the Home region: Tell viewer and abort
2295 if (info == null) 2294 client.SendTeleportFailed("Your home-region could not be found.");
2296 { 2295 return;
2297 // can't find the region: Tell viewer and abort
2298 client.SendTeleportFailed("Your home-region could not be found.");
2299 return;
2300 }
2301 homeRegionHandle = info.RegionHandle;
2302 } 2296 }
2303 RequestTeleportLocation(client, homeRegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, (uint)0); 2297 RequestTeleportLocation(
2298 client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt,
2299 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
2304 } 2300 }
2305 } 2301 }
2306 2302
@@ -2461,9 +2457,7 @@ namespace OpenSim.Region.Environment.Scenes
2461 else 2457 else
2462 { 2458 {
2463 m_innerScene.removeUserCount(true); 2459 m_innerScene.removeUserCount(true);
2464 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, 2460 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
2465 avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y,
2466 avatar.AbsolutePosition.Z);
2467 List<ulong> childknownRegions = new List<ulong>(); 2461 List<ulong> childknownRegions = new List<ulong>();
2468 List<ulong> ckn = avatar.GetKnownRegionList(); 2462 List<ulong> ckn = avatar.GetKnownRegionList();
2469 for (int i = 0; i < ckn.Count; i++) 2463 for (int i = 0; i < ckn.Count; i++)
@@ -2922,9 +2916,9 @@ namespace OpenSim.Region.Environment.Scenes
2922 /// <param name="regionName"></param> 2916 /// <param name="regionName"></param>
2923 /// <param name="position"></param> 2917 /// <param name="position"></param>
2924 /// <param name="lookAt"></param> 2918 /// <param name="lookAt"></param>
2925 /// <param name="flags"></param> 2919 /// <param name="teleportFlags"></param>
2926 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, 2920 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
2927 Vector3 lookat, uint flags) 2921 Vector3 lookat, uint teleportFlags)
2928 { 2922 {
2929 RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName); 2923 RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName);
2930 if (regionInfo == null) 2924 if (regionInfo == null)
@@ -2933,7 +2927,7 @@ namespace OpenSim.Region.Environment.Scenes
2933 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); 2927 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
2934 return; 2928 return;
2935 } 2929 }
2936 RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, flags); 2930 RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags);
2937 } 2931 }
2938 2932
2939 /// <summary> 2933 /// <summary>
@@ -2943,16 +2937,16 @@ namespace OpenSim.Region.Environment.Scenes
2943 /// <param name="regionHandle"></param> 2937 /// <param name="regionHandle"></param>
2944 /// <param name="position"></param> 2938 /// <param name="position"></param>
2945 /// <param name="lookAt"></param> 2939 /// <param name="lookAt"></param>
2946 /// <param name="flags"></param> 2940 /// <param name="teleportFlags"></param>
2947 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, 2941 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
2948 Vector3 lookAt, uint flags) 2942 Vector3 lookAt, uint teleportFlags)
2949 { 2943 {
2950 lock (m_scenePresences) 2944 lock (m_scenePresences)
2951 { 2945 {
2952 if (m_scenePresences.ContainsKey(remoteClient.AgentId)) 2946 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
2953 { 2947 {
2954 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, 2948 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
2955 position, lookAt, flags); 2949 position, lookAt, teleportFlags);
2956 } 2950 }
2957 } 2951 }
2958 } 2952 }
@@ -2979,7 +2973,7 @@ namespace OpenSim.Region.Environment.Scenes
2979 if (m_scenePresences.ContainsKey(remoteClient.AgentId)) 2973 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
2980 { 2974 {
2981 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle, 2975 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle,
2982 position, Vector3.Zero, 0); 2976 position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark));
2983 } 2977 }
2984 } 2978 }
2985 } 2979 }