aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs57
1 files changed, 18 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d8874b2..e22dd2d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -296,6 +296,17 @@ namespace OpenSim.Region.Framework.Scenes
296 } 296 }
297 } 297 }
298 298
299 protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService;
300 public OpenSim.Services.Interfaces.IAvatarService AvatarService
301 {
302 get
303 {
304 if (m_AvatarService == null)
305 m_AvatarService = RequestModuleInterface<OpenSim.Services.Interfaces.IAvatarService>();
306 return m_AvatarService;
307 }
308 }
309
299 protected IXMLRPC m_xmlrpcModule; 310 protected IXMLRPC m_xmlrpcModule;
300 protected IWorldComm m_worldCommModule; 311 protected IWorldComm m_worldCommModule;
301 protected IAvatarFactory m_AvatarFactory; 312 protected IAvatarFactory m_AvatarFactory;
@@ -2975,21 +2986,11 @@ namespace OpenSim.Region.Framework.Scenes
2975 /// <param name="client">The IClientAPI for the client</param> 2986 /// <param name="client">The IClientAPI for the client</param>
2976 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 2987 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2977 { 2988 {
2978 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2989 OpenSim.Services.Interfaces.PresenceInfo pinfo = PresenceService.GetAgent(client.SessionId);
2979 if (UserProfile != null) 2990
2991 if (pinfo != null)
2980 { 2992 {
2981 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); 2993 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
2982 if (regionInfo == null)
2983 {
2984 uint x = 0, y = 0;
2985 Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
2986 regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2987 if (regionInfo != null) // home region can be away temporarily, too
2988 {
2989 UserProfile.HomeRegionID = regionInfo.RegionID;
2990 CommsManager.UserService.UpdateUserProfile(UserProfile);
2991 }
2992 }
2993 if (regionInfo == null) 2994 if (regionInfo == null)
2994 { 2995 {
2995 // can't find the Home region: Tell viewer and abort 2996 // can't find the Home region: Tell viewer and abort
@@ -2997,7 +2998,7 @@ namespace OpenSim.Region.Framework.Scenes
2997 return; 2998 return;
2998 } 2999 }
2999 RequestTeleportLocation( 3000 RequestTeleportLocation(
3000 client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, 3001 client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
3001 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); 3002 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
3002 } 3003 }
3003 } 3004 }
@@ -3089,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes
3089 } 3090 }
3090 3091
3091 /// <summary> 3092 /// <summary>
3092 /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in 3093 /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
3093 /// </summary> 3094 /// </summary>
3094 /// <param name="remoteClient"></param> 3095 /// <param name="remoteClient"></param>
3095 /// <param name="regionHandle"></param> 3096 /// <param name="regionHandle"></param>
@@ -3098,27 +3099,11 @@ namespace OpenSim.Region.Framework.Scenes
3098 /// <param name="flags"></param> 3099 /// <param name="flags"></param>
3099 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3100 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3100 { 3101 {
3101 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); 3102 if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3102 if (UserProfile != null)
3103 {
3104 // I know I'm ignoring the regionHandle provided by the teleport location request.
3105 // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
3106 UserProfile.HomeRegionID = RegionInfo.RegionID;
3107 // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
3108 // TODO: The HomeRegion property can be removed then, too
3109 UserProfile.HomeRegion = RegionInfo.RegionHandle;
3110
3111 UserProfile.HomeLocation = position;
3112 UserProfile.HomeLookAt = lookAt;
3113 CommsManager.UserService.UpdateUserProfile(UserProfile);
3114
3115 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3103 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3116 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3104 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
3117 }
3118 else 3105 else
3119 {
3120 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); 3106 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
3121 }
3122 } 3107 }
3123 3108
3124 /// <summary> 3109 /// <summary>
@@ -3254,12 +3239,6 @@ namespace OpenSim.Region.Framework.Scenes
3254 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3239 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3255 } 3240 }
3256 3241
3257 // Remove client agent from profile, so new logins will work
3258 if (!childagentYN)
3259 {
3260 m_sceneGridService.ClearUserAgent(agentID);
3261 }
3262
3263 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3242 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3264 3243
3265 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3244 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));