From d8fe7777bf5497b5eab949a0baa279c919ee1ac6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 8 Jul 2009 08:38:23 +0000 Subject: Prevent teleports from ending underground --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 01facd1..b85a138 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1020,6 +1020,17 @@ namespace OpenSim.Region.Framework.Scenes look = new Vector3(0.99f, 0.042f, 0); } + // Prevent teleporting to an underground location + // (may crash client otherwise) + // + Vector3 pos = AbsolutePosition; + float ground = m_scene.GetGroundHeight(pos.X, pos.Y); + if (pos.Z < ground + 1.5f) + { + pos.Z = ground + 1.5f; + AbsolutePosition = pos; + } + if (m_isChildAgent) { m_isChildAgent = false; -- cgit v1.1