From 244bfcde5b86180981e99ac9e88eb394f20bcd09 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 17 Apr 2008 05:07:14 +0000 Subject: * Implements 'Set Home to Here' * Implements 'Teleport Home' * User Server has to be updated for it to save your home in grid mode * home position accuracy is in int because the grid comms ExpectUser method tries to convert to Uint and crashes if it gets a float. Added a convert to decimal in ExpectUser but to avoid a breaking change with old revisions, kept the save value in int for now. Eventually it needs to be a float, but lets release another incremental version before doing that. --- OpenSim/Region/Environment/Scenes/Scene.cs | 46 ++++++++++++++++++++++++ OpenSim/Region/Environment/Scenes/SceneEvents.cs | 4 +-- 2 files changed, 48 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 08cf3d8..20572a9 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1581,9 +1581,55 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable; + client.OnTeleportHomeRequest += TeleportClientHome; + + client.OnSetStartLocationRequest += SetHomeRezPoint; + EventManager.TriggerOnNewClient(client); } + public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client) + { + UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId); + if (UserProfile != null) + { + ulong homeRegion = UserProfile.HomeRegion; + LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ); + LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt); + RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0); + + } + + } + + public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) + { + UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); + if (UserProfile != null) + { + // I know I'm ignoring the regionHandle provided by the teleport location request. + // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid + UserProfile.HomeRegion = RegionInfo.RegionHandle; + + // We cast these to an int so as not to cause a breaking change with old regions + // Newer regions treat this as a float on the ExpectUser method.. so we need to wait a few + // releases before setting these to floats. (r4257) + UserProfile.HomeLocationX = (int)position.X; + UserProfile.HomeLocationY = (int)position.Y; + UserProfile.HomeLocationZ = (int)position.Z; + UserProfile.HomeLookAtX = (int)lookAt.X; + UserProfile.HomeLookAtY = (int)lookAt.Y; + UserProfile.HomeLookAtZ = (int)lookAt.Z; + CommsManager.UserService.UpdateUserProfileProperties(UserProfile); + + remoteClient.SendAgentAlertMessage("Set home to here if supported by login service",false); + } + else + { + remoteClient.SendAgentAlertMessage("Set Home request Failed",false); + } + + } protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) { ScenePresence avatar = null; diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 67edf6b..89c519e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes public class MoneyTransferArgs : System.EventArgs { public LLUUID sender; - public LLUUID reciever; + public LLUUID receiver; // Always false. The SL protocol sucks. public bool authenticated = false; @@ -169,7 +169,7 @@ namespace OpenSim.Region.Environment.Scenes public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) { sender = asender; - reciever = areciever; + receiver = areciever; amount = aamount; transactiontype = atransactiontype; description = adescription; -- cgit v1.1