* Check in the second part of http://opensimulator.org/mantis/view.php?id=2334 since enough time has passed such that servers following head have probably updated

* This patch aims to store look at data when an avatar logs off in grid mode
* However, in my short test it doesn't appear to be working yet - numbers are being stored but they don't look correct
* But this doesn't appear to cause any login problems
* Thanks tyre
0.6.0-stable
Justin Clarke Casey 2008-10-04 18:46:34 +00:00
parent 63d7a92fb4
commit 0b594a072c
2 changed files with 41 additions and 42 deletions

View File

@ -713,15 +713,20 @@ namespace OpenSim.Grid.UserServer
UUID userUUID = new UUID((string)requestData["avatar_uuid"]); UUID userUUID = new UUID((string)requestData["avatar_uuid"]);
UUID RegionID = new UUID((string)requestData["region_uuid"]); UUID RegionID = new UUID((string)requestData["region_uuid"]);
ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]); Vector3 position = new Vector3(
float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]); (float)Convert.ToDecimal((string)requestData["region_pos_x"]),
float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]); (float)Convert.ToDecimal((string)requestData["region_pos_y"]),
(float)Convert.ToDecimal((string)requestData["region_pos_z"]));
Vector3 lookat = new Vector3(
(float)Convert.ToDecimal((string)requestData["lookat_x"]),
(float)Convert.ToDecimal((string)requestData["lookat_y"]),
(float)Convert.ToDecimal((string)requestData["lookat_z"]));
handlerLogOffUser = OnLogOffUser; handlerLogOffUser = OnLogOffUser;
if (handlerLogOffUser != null) if (handlerLogOffUser != null)
handlerLogOffUser(userUUID); handlerLogOffUser(userUUID);
LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz); LogOffUser(userUUID, RegionID, regionhandle, position, lookat);
} }
catch (FormatException) catch (FormatException)
{ {

View File

@ -48,6 +48,7 @@ using OpenSim.Region.Physics.Manager;
using Nini.Config; using Nini.Config;
using Caps = OpenSim.Framework.Communications.Capabilities.Caps; using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
using Image = System.Drawing.Image; using Image = System.Drawing.Image;
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
@ -2270,37 +2271,32 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); m_log.DebugFormat("gesture : {0} ", gestureId.ToString());
} }
/// <summary>
/// Teleport an avatar to their home region
/// </summary>
/// <param name="agentId"></param>
/// <param name="client"></param>
public virtual void TeleportClientHome(UUID agentId, IClientAPI client) public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
{ {
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
if (UserProfile != null) if (UserProfile != null)
{ {
UUID homeRegionID = UserProfile.HomeRegionID; RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegionID);
ulong homeRegionHandle = UserProfile.HomeRegion; if (regionInfo == null)
if (homeRegionID == UUID.Zero)
{ {
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
if (info == null) UserProfile.HomeRegionID = regionInfo.RegionID;
{
// 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.UpdateUserProfile(UserProfile); CommsManager.UserService.UpdateUserProfile(UserProfile);
} }
else if (regionInfo == null)
{ {
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(homeRegionID); // can't find the Home region: Tell viewer and abort
if (info == null)
{
// can't find the region: Tell viewer and abort
client.SendTeleportFailed("Your home-region could not be found."); client.SendTeleportFailed("Your home-region could not be found.");
return; return;
} }
homeRegionHandle = info.RegionHandle; RequestTeleportLocation(
} client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt,
RequestTeleportLocation(client, homeRegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, (uint)0); (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
} }
} }
@ -2461,9 +2457,7 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
m_innerScene.removeUserCount(true); m_innerScene.removeUserCount(true);
m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y,
avatar.AbsolutePosition.Z);
List<ulong> childknownRegions = new List<ulong>(); List<ulong> childknownRegions = new List<ulong>();
List<ulong> ckn = avatar.GetKnownRegionList(); List<ulong> ckn = avatar.GetKnownRegionList();
for (int i = 0; i < ckn.Count; i++) for (int i = 0; i < ckn.Count; i++)
@ -2922,9 +2916,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionName"></param> /// <param name="regionName"></param>
/// <param name="position"></param> /// <param name="position"></param>
/// <param name="lookAt"></param> /// <param name="lookAt"></param>
/// <param name="flags"></param> /// <param name="teleportFlags"></param>
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
Vector3 lookat, uint flags) Vector3 lookat, uint teleportFlags)
{ {
RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName); RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName);
if (regionInfo == null) if (regionInfo == null)
@ -2933,7 +2927,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return; return;
} }
RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, flags); RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags);
} }
/// <summary> /// <summary>
@ -2943,16 +2937,16 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="position"></param> /// <param name="position"></param>
/// <param name="lookAt"></param> /// <param name="lookAt"></param>
/// <param name="flags"></param> /// <param name="teleportFlags"></param>
public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
Vector3 lookAt, uint flags) Vector3 lookAt, uint teleportFlags)
{ {
lock (m_scenePresences) lock (m_scenePresences)
{ {
if (m_scenePresences.ContainsKey(remoteClient.AgentId)) if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{ {
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
position, lookAt, flags); position, lookAt, teleportFlags);
} }
} }
} }
@ -2979,7 +2973,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_scenePresences.ContainsKey(remoteClient.AgentId)) if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{ {
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle, m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle,
position, Vector3.Zero, 0); position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark));
} }
} }
} }