From 2b98e2f106f8a017cbaefcb2c21cc1bc9addde81 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 20 Apr 2012 02:50:36 +0100 Subject: [PATCH] Stop teleports from dropping tall avatars through or embedding them in the floor when lured by short avatars. This involves giving the ceiling of the Z-component in a lure rather than the floor. Ideally we would give the exact float compensating for relative avatar height but it looks like that isn't possible with the parcel id format used in lures --- OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d295384279..2d4cffd224 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure Scene scene = (Scene)(client.Scene); ScenePresence presence = scene.GetScenePresence(client.AgentId); + // Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given + // a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on + // arrival. + // + // Ideally we would give the exact float position adjusting for the relative height of the two avatars + // but it looks like a float component isn't possible with a parcel ID. UUID dest = Util.BuildFakeParcelID( scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, - (uint)presence.AbsolutePosition.Z); + (uint)Math.Ceiling(presence.AbsolutePosition.Z)); m_log.DebugFormat("TP invite with message {0}", message);