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/Services/LLLoginService/LLLoginService.cs | 28 ++++++++++++-----------
 1 file changed, 15 insertions(+), 13 deletions(-)

(limited to 'OpenSim/Services/LLLoginService')

diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 3ccdc9c..53a3c2f 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -489,7 +489,7 @@ namespace OpenSim.Services.LLLoginService
                 Vector3 position = Vector3.Zero;
                 Vector3 lookAt = Vector3.Zero;
                 GridRegion gatekeeper = null;
-                TeleportFlags flags;
+                Constants.TeleportFlags flags;
                 GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt, out flags);
                 if (destination == null)
                 {
@@ -508,7 +508,7 @@ namespace OpenSim.Services.LLLoginService
                 }
 
                 if (account.UserLevel >= 200)
-                    flags |= TeleportFlags.Godlike;
+                    flags |= Constants.TeleportFlags.Godlike;
                 //
                 // Get the avatar
                 //
@@ -582,9 +582,9 @@ namespace OpenSim.Services.LLLoginService
         protected GridRegion FindDestination(
             UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation,
             GridRegion home, out GridRegion gatekeeper,
-            out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
+            out string where, out Vector3 position, out Vector3 lookAt, out Constants.TeleportFlags flags)
         {
-            flags = TeleportFlags.ViaLogin;
+            flags = Constants.TeleportFlags.ViaLogin;
 
             m_log.DebugFormat(
                 "[LLOGIN SERVICE]: Finding destination matching start location {0} for {1}",
@@ -618,7 +618,7 @@ namespace OpenSim.Services.LLLoginService
 
                     position = pinfo.HomePosition;
                     lookAt = pinfo.HomeLookAt;
-                    flags |= TeleportFlags.ViaHome;
+                    flags |= Constants.TeleportFlags.ViaHome;
                 }
 
                 if (tryDefaults)
@@ -626,7 +626,7 @@ namespace OpenSim.Services.LLLoginService
                     List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
                     if (defaults != null && defaults.Count > 0)
                     {
-                        flags |= TeleportFlags.ViaRegionID;
+                        flags |= Constants.TeleportFlags.ViaRegionID;
                         region = defaults[0];
                         where = "safe";
                     }
@@ -637,7 +637,7 @@ namespace OpenSim.Services.LLLoginService
                         region = FindAlternativeRegion(scopeID);
                         if (region != null)
                         {
-                            flags |= TeleportFlags.ViaRegionID;
+                            flags |= Constants.TeleportFlags.ViaRegionID;
                             where = "safe";
                         }
                     }
@@ -660,7 +660,7 @@ namespace OpenSim.Services.LLLoginService
                     List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
                     if (defaults != null && defaults.Count > 0)
                     {
-                        flags |= TeleportFlags.ViaRegionID;
+                        flags |= Constants.TeleportFlags.ViaRegionID;
                         region = defaults[0];
                         where = "safe";
                     }
@@ -670,7 +670,7 @@ namespace OpenSim.Services.LLLoginService
                         region = FindAlternativeRegion(scopeID);
                         if (region != null)
                         {
-                            flags |= TeleportFlags.ViaRegionID;
+                            flags |= Constants.TeleportFlags.ViaRegionID;
                             where = "safe";
                         }
                     }
@@ -686,7 +686,7 @@ namespace OpenSim.Services.LLLoginService
             }
             else
             {
-                flags |= TeleportFlags.ViaRegionID;
+                flags |= Constants.TeleportFlags.ViaRegionID;
 
                 // free uri form
                 // e.g. New Moon&135&46  New Moon@osgrid.org:8002&153&34
@@ -704,6 +704,8 @@ namespace OpenSim.Services.LLLoginService
                     position = new Vector3(float.Parse(uriMatch.Groups["x"].Value, Culture.NumberFormatInfo),
                                            float.Parse(uriMatch.Groups["y"].Value, Culture.NumberFormatInfo),
                                            float.Parse(uriMatch.Groups["z"].Value, Culture.NumberFormatInfo));
+                    if (0 == position.Z)
+			flags |= Constants.TeleportFlags.ViaMap;
 
                     string regionName = uriMatch.Groups["region"].ToString();
                     if (regionName != null)
@@ -858,7 +860,7 @@ namespace OpenSim.Services.LLLoginService
 
         protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar,
             UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0,
-            IPEndPoint clientIP, TeleportFlags flags, out string where, out string reason, out GridRegion dest)
+            IPEndPoint clientIP, Constants.TeleportFlags flags, out string where, out string reason, out GridRegion dest)
         {
             where = currentWhere;
             ISimulationService simConnector = null;
@@ -895,7 +897,7 @@ namespace OpenSim.Services.LLLoginService
                     {
                         foreach (GridRegion r in fallbacks)
                         {
-                            success = LaunchAgentDirectly(simConnector, r, aCircuit, flags | TeleportFlags.ViaRegionID, out reason);
+                            success = LaunchAgentDirectly(simConnector, r, aCircuit, flags | Constants.TeleportFlags.ViaRegionID | Constants.TeleportFlags.ViaMap, out reason);
                             if (success)
                             {
                                 where = "safe";
@@ -1041,7 +1043,7 @@ namespace OpenSim.Services.LLLoginService
 
         }
 
-        private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
+        private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, Constants.TeleportFlags flags, out string reason)
         {
             EntityTransferContext ctx = new EntityTransferContext();
 
-- 
cgit v1.1