From 363989195a3845940d0b2750e546c4eec10ec45a Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Wed, 27 Aug 2008 02:49:47 +0000 Subject: Mantis#1518. Thank you kindly, Zaki for a patch that: Issue is caused by the terrain height not being queried before teleporting within the region. Teleporting between regions is correct. Adding the neccessary checking to intra-region TP code. --- .../Environment/Scenes/SceneCommunicationService.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 6aa6de8..24f814e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -586,6 +586,23 @@ namespace OpenSim.Region.Environment.Scenes if (regionHandle == m_regionInfo.RegionHandle) { // Teleport within the same region + if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0) + { + LLVector3 emergencyPos = new LLVector3(128, 128, 128); + + m_log.WarnFormat( + "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", + position, avatar.Name, avatar.UUID, emergencyPos); + position = emergencyPos; + } + // TODO: Get proper AVG Height + float localAVHeight = 1.56f; + float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); + float newPosZ = posZLimit + localAVHeight; + if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) + { + position.Z = newPosZ; + } avatar.ControllingClient.SendTeleportLocationStart(); avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); avatar.Teleport(position); -- cgit v1.1