diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afd4813..b861c28 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -892,6 +892,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
892 | pos.Y = crossedBorder.BorderLine.Z - 1; | 892 | pos.Y = crossedBorder.BorderLine.Z - 1; |
893 | } | 893 | } |
894 | 894 | ||
895 | CheckAndAdjustLandingPoint(ref pos); | ||
896 | |||
895 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) | 897 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) |
896 | { | 898 | { |
897 | m_log.WarnFormat( | 899 | m_log.WarnFormat( |
@@ -1056,6 +1058,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1056 | bool isFlying = Flying; | 1058 | bool isFlying = Flying; |
1057 | RemoveFromPhysicalScene(); | 1059 | RemoveFromPhysicalScene(); |
1058 | Velocity = Vector3.Zero; | 1060 | Velocity = Vector3.Zero; |
1061 | CheckLandingPoint(ref pos); | ||
1059 | AbsolutePosition = pos; | 1062 | AbsolutePosition = pos; |
1060 | AddToPhysicalScene(isFlying); | 1063 | AddToPhysicalScene(isFlying); |
1061 | 1064 | ||
@@ -1066,6 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1066 | { | 1069 | { |
1067 | bool isFlying = Flying; | 1070 | bool isFlying = Flying; |
1068 | RemoveFromPhysicalScene(); | 1071 | RemoveFromPhysicalScene(); |
1072 | CheckLandingPoint(ref pos); | ||
1069 | AbsolutePosition = pos; | 1073 | AbsolutePosition = pos; |
1070 | AddToPhysicalScene(isFlying); | 1074 | AddToPhysicalScene(isFlying); |
1071 | 1075 | ||
@@ -1181,22 +1185,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1181 | 1185 | ||
1182 | Vector3 look = Velocity; | 1186 | Vector3 look = Velocity; |
1183 | 1187 | ||
1184 | // Place avatar according to parcel owner teleport routing... | ||
1185 | ILandObject land = Scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); | ||
1186 | |||
1187 | if (land != null) | ||
1188 | { | ||
1189 | // Land owner should be able to land anywhere, others honor settings | ||
1190 | if (land.LandData.OwnerID != client.AgentId) | ||
1191 | { | ||
1192 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | ||
1193 | { | ||
1194 | AbsolutePosition = land.LandData.UserLocation; | ||
1195 | look = land.LandData.UserLookAt; | ||
1196 | } | ||
1197 | } | ||
1198 | } | ||
1199 | |||
1200 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | 1188 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) |
1201 | { | 1189 | { |
1202 | look = new Vector3(0.99f, 0.042f, 0); | 1190 | look = new Vector3(0.99f, 0.042f, 0); |
@@ -3820,5 +3808,59 @@ namespace OpenSim.Region.Framework.Scenes | |||
3820 | m_reprioritization_called = false; | 3808 | m_reprioritization_called = false; |
3821 | } | 3809 | } |
3822 | } | 3810 | } |
3811 | |||
3812 | private void CheckLandingPoint(ref Vector3 pos) | ||
3813 | { | ||
3814 | // Never constrain lures | ||
3815 | if ((TeleportFlags & TeleportFlags.ViaLure) != 0) | ||
3816 | return; | ||
3817 | |||
3818 | if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | ||
3819 | return; | ||
3820 | |||
3821 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | ||
3822 | |||
3823 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && | ||
3824 | land.LandData.UserLocation != Vector3.Zero && | ||
3825 | land.LandData.OwnerID != m_uuid && | ||
3826 | (!m_scene.Permissions.IsGod(m_uuid)) && | ||
3827 | (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) | ||
3828 | { | ||
3829 | float curr = Vector3.Distance(AbsolutePosition, pos); | ||
3830 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) | ||
3831 | pos = land.LandData.UserLocation; | ||
3832 | else | ||
3833 | ControllingClient.SendAlertMessage("Can't teleport closer to destination"); | ||
3834 | } | ||
3835 | } | ||
3836 | |||
3837 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) | ||
3838 | { | ||
3839 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | ||
3840 | if (land != null) | ||
3841 | { | ||
3842 | // If we come in via login, landmark or map, we want to | ||
3843 | // honor landing points. If we come in via Lure, we want | ||
3844 | // to ignore them. | ||
3845 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | ||
3846 | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || | ||
3847 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0) | ||
3848 | { | ||
3849 | // Don't restrict gods, estate managers, or land owners to | ||
3850 | // the TP point. This behaviour mimics agni. | ||
3851 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && | ||
3852 | land.LandData.UserLocation != Vector3.Zero && | ||
3853 | GodLevel < 200 && | ||
3854 | ((land.LandData.OwnerID != m_uuid && | ||
3855 | (!m_scene.Permissions.IsGod(m_uuid)) && | ||
3856 | (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0)) | ||
3857 | { | ||
3858 | pos = land.LandData.UserLocation; | ||
3859 | } | ||
3860 | } | ||
3861 | |||
3862 | land.SendLandUpdateToClient(ControllingClient); | ||
3863 | } | ||
3864 | } | ||
3823 | } | 3865 | } |
3824 | } | 3866 | } |