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/Framework/Constants.cs | 3 ++
.../EntityTransfer/EntityTransferModule.cs | 7 +--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 54 ++++++++++++++++------
OpenSim/Services/LLLoginService/LLLoginService.cs | 28 +++++------
4 files changed, 61 insertions(+), 31 deletions(-)
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index 15da7e6..ac99a92 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Framework
EstateManagers = 10
}
+ // Identical to the one in OpenMetaverse, except I'm extending it now, and OpenSim decided to copy it here, making life hard.
[Flags]public enum TeleportFlags : uint
{
/// No flags set, or teleport failed
@@ -98,6 +99,8 @@ namespace OpenSim.Framework
ForceRedirect = 1 << 15,
/// Via script.
ViaScript = 1 << 16,
+ /// Via map, though this is a guess.
+ ViaMap = 1 << 17,
/// Teleport Finished via a Lure
FinishedViaLure = 1 << 26,
/// Finished, Sim Changed
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 9ce6201..59e71c6 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -679,9 +679,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
- m_log.DebugFormat(
- "[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
- sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
+//// m_log.DebugFormat(
+ m_log.InfoFormat(
+ "[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2}/{3} to {4} ({5}) {6}/{7}",
+ sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, sp.AbsolutePosition,
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
RegionInfo sourceRegion = sp.Scene.RegionInfo;
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)
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 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 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