diff options
author | onefang | 2020-09-09 22:59:24 +1000 |
---|---|---|
committer | onefang | 2020-09-09 22:59:24 +1000 |
commit | aaef497afbedef9382c9afdcb9f8d0d5b0a0e0bc (patch) | |
tree | 0cca9608b28ec503f045a26b0f664a176a061d1f /OpenSim/Region/Framework/Scenes | |
parent | Use F1 instead of ? as the in command help key. (diff) | |
download | opensim-SC-aaef497afbedef9382c9afdcb9f8d0d5b0a0e0bc.zip opensim-SC-aaef497afbedef9382c9afdcb9f8d0d5b0a0e0bc.tar.gz opensim-SC-aaef497afbedef9382c9afdcb9f8d0d5b0a0e0bc.tar.bz2 opensim-SC-aaef497afbedef9382c9afdcb9f8d0d5b0a0e0bc.tar.xz |
Various teleport fixes.
TPs from scripts avoid all that silly raycasting nonsense, just go where
we ask.
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.
Teleport home from off grid shouldn't land on roofs either.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0d8f286..e84018e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1406,15 +1406,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | if (groundHeight > pos.Z) | 1406 | if (groundHeight > pos.Z) |
1407 | pos.Z = groundHeight; | 1407 | pos.Z = groundHeight; |
1408 | 1408 | ||
1409 | if (((m_teleportFlags & TeleportFlags.ViaMap) == 0) && (Math.Truncate(pos.Z) == pos.Z)) | ||
1410 | m_teleportFlags |= TeleportFlags.ViaMap; | ||
1409 | bool checkPhysics = !positionChanged && | 1411 | bool checkPhysics = !positionChanged && |
1410 | m_scene.SupportsRayCastFiltered() && | 1412 | m_scene.SupportsRayCastFiltered() && |
1411 | pos.Z < physTestHeight && | 1413 | pos.Z < physTestHeight && |
1412 | ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | 1414 | ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == |
1413 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) | 1415 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) |
1414 | || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 | 1416 | //// || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 |
1417 | || (m_teleportFlags & TeleportFlags.ViaMap) != 0 | ||
1415 | || (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0); | 1418 | || (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0); |
1416 | 1419 | ||
1417 | if(checkPhysics) | 1420 | if(checkPhysics && ((m_teleportFlags & TeleportFlags.ViaScript) == 0) && ((m_teleportFlags & TeleportFlags.ViaHome) == 0)) |
1418 | { | 1421 | { |
1419 | // land check was done above | 1422 | // land check was done above |
1420 | RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; | 1423 | RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; |
@@ -1443,29 +1446,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
1443 | return a.Depth.CompareTo(b.Depth); | 1446 | return a.Depth.CompareTo(b.Depth); |
1444 | }); | 1447 | }); |
1445 | 1448 | ||
1446 | int sel = 0; | 1449 | int sel = -1; |
1447 | int count = physresults.Count; | 1450 | int count = physresults.Count; |
1448 | float curd = physresults[0].Depth; | 1451 | float curd = physresults[0].Depth; |
1449 | float nextd = curd + PhysMinSkipGap; | 1452 | float nextd = curd + PhysMinSkipGap; |
1450 | float maxDepth = dist - pos.Z; | 1453 | float maxDepth = dist - pos.Z; |
1451 | for(int i = 1; i < count; i++) | 1454 | // Try to find a designated floor. |
1455 | for(int i = 0; i < count; i++) | ||
1452 | { | 1456 | { |
1453 | curd = physresults[i].Depth; | 1457 | SceneObjectPart part = m_scene.GetSceneObjectPart(physresults[i].ConsumerID); |
1454 | if(curd >= nextd) | 1458 | if ((null != part) && (string.Empty != part.Description) && ('^' == part.Description[0])) |
1455 | { | 1459 | { |
1456 | sel = i; | 1460 | sel = i; |
1457 | if(curd >= maxDepth || curd >= nextd + PhysSkipGapDelta) | 1461 | dest = physresults[sel].Pos.Z; |
1458 | break; | 1462 | break; |
1459 | } | 1463 | } |
1460 | nextd = curd + PhysMinSkipGap; | 1464 | } |
1465 | |||
1466 | if (-1 == sel) | ||
1467 | { | ||
1468 | sel = 0; | ||
1469 | for (int i = 1; i < count; i++) | ||
1470 | { | ||
1471 | curd = physresults[i].Depth; | ||
1472 | if(curd >= nextd) | ||
1473 | { | ||
1474 | sel = i; | ||
1475 | if(curd >= maxDepth || curd >= nextd + PhysSkipGapDelta) | ||
1476 | break; | ||
1477 | } | ||
1478 | nextd = curd + PhysMinSkipGap; | ||
1479 | } | ||
1480 | dest = physresults[sel].Pos.Z; | ||
1461 | } | 1481 | } |
1462 | dest = physresults[sel].Pos.Z; | ||
1463 | } | 1482 | } |
1464 | 1483 | ||
1465 | dest += localAVHalfHeight; | 1484 | dest += localAVHalfHeight; |
1466 | if(dest > pos.Z) | 1485 | if ((m_teleportFlags & TeleportFlags.ViaMap) != 0) |
1467 | pos.Z = dest; | 1486 | m_log.InfoFormat("[SCENE PRESENCE]: Teleport from above, for {0} @ {1}, landing height {2}", Name, pos, dest); |
1468 | break; | 1487 | else |
1488 | m_log.ErrorFormat("[SCENE PRESENCE]: Teleport from above NOMAP, for {0} @ {1}, landing height {2}", Name, pos, dest); | ||
1489 | if(dest > pos.Z) | ||
1490 | pos.Z = dest; | ||
1491 | break; | ||
1469 | } | 1492 | } |
1470 | } | 1493 | } |
1471 | 1494 | ||