From 15b2a91ffc6d240277a852aa750a0259ae6a2a17 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 24 Jul 2019 05:49:26 +1000 Subject: For the "teleport from above" case, do the right thing. Which includes looking for designated floor prims, which have ^ as the first character of their description. Don't do "teleport from above" when we have proper coords. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 54 +++++++++++++++++------- 1 file changed, 39 insertions(+), 15 deletions(-) (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 c0543fd..ff8d2fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -166,6 +166,7 @@ namespace OpenSim.Region.Framework.Scenes public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) + private UUID m_previusParcelUUID = UUID.Zero; private UUID m_currentParcelUUID = UUID.Zero; private bool m_previusParcelHide = false; @@ -1362,15 +1363,18 @@ namespace OpenSim.Region.Framework.Scenes if (groundHeight > pos.Z) pos.Z = groundHeight; + if (((m_teleportFlags & TeleportFlags.ViaMap) == 0) && (Math.Truncate(pos.Z) == pos.Z)) + m_teleportFlags |= TeleportFlags.ViaMap; bool checkPhysics = !positionChanged && m_scene.SupportsRayCastFiltered() && pos.Z < physTestHeight && ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) - || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 +//// || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 + || (m_teleportFlags & TeleportFlags.ViaMap) != 0 || (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0); - if(checkPhysics && (m_teleportFlags & TeleportFlags.ViaScript) == 0) + if(checkPhysics && ((m_teleportFlags & TeleportFlags.ViaScript) == 0)) { // land check was done above RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; @@ -1397,26 +1401,46 @@ namespace OpenSim.Region.Framework.Scenes return a.Depth.CompareTo(b.Depth); }); - int sel = 0; + int sel = -1; int count = physresults.Count; float curd = physresults[0].Depth; float nextd = curd + PhysMinSkipGap; float maxDepth = dist - pos.Z; - for(int i = 1; i < count; i++) + // Try to find a designated floor. + for(int i = 0; i < count; i++) { - curd = physresults[i].Depth; - if(curd >= nextd) - { - sel = i; - if(curd >= maxDepth) - break; - } - nextd = curd + PhysMinSkipGap; + SceneObjectPart part = m_scene.GetSceneObjectPart(physresults[i].ConsumerID); + if ((null != part) && (string.Empty != part.Description) && ('^' == part.Description[0])) + { + sel = i; + dest = physresults[sel].Pos.Z; + break; + } + } + + if (-1 == sel) + { + sel = 0; + for (int i = 1; i < count; i++) + { + curd = physresults[i].Depth; + if(curd >= nextd) + { + sel = i; + if(curd >= maxDepth) + break; + } + nextd = curd + PhysMinSkipGap; + } + dest = physresults[sel].Pos.Z; } - dest = physresults[sel].Pos.Z; } dest += localAVHalfHeight; +if ((m_teleportFlags & TeleportFlags.ViaMap) != 0) + m_log.InfoFormat("[SCENE PRESENCE]: Teleport from above, for {0} @ {1}, landing height {2}", Name, pos, dest); +else + m_log.ErrorFormat("[SCENE PRESENCE]: Teleport from above NOMAP, for {0} @ {1}, landing height {2}", Name, pos, dest); if(dest > pos.Z) pos.Z = dest; } @@ -1681,7 +1705,7 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(isFlying); SendTerseUpdateToAllClients(); } - +/* Not called from anywhere. public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) { if(!CheckLocalTPLandingPoint(ref newpos)) @@ -1715,7 +1739,7 @@ namespace OpenSim.Region.Framework.Scenes } SendTerseUpdateToAllClients(); } - +*/ public void StopFlying() { if (IsInTransit) -- cgit v1.1