diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fdbcbb0..bac356e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3844,8 +3844,67 @@ namespace OpenSim.Region.Framework.Scenes | |||
3844 | } | 3844 | } |
3845 | } | 3845 | } |
3846 | 3846 | ||
3847 | private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) | ||
3848 | { | ||
3849 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | ||
3850 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | ||
3851 | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || | ||
3852 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
3853 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | ||
3854 | { | ||
3855 | if (GodLevel < 200 && | ||
3856 | ((!m_scene.Permissions.IsGod(m_uuid) && | ||
3857 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | ||
3858 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
3859 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | ||
3860 | { | ||
3861 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | ||
3862 | if (spawnPoints.Length == 0) | ||
3863 | return; | ||
3864 | |||
3865 | float distance = 9999; | ||
3866 | int closest = -1; | ||
3867 | |||
3868 | for (int i = 0 ; i < spawnPoints.Length ; i++) | ||
3869 | { | ||
3870 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3871 | Vector3 offset = spawnPosition - pos; | ||
3872 | float d = Vector3.Mag(offset); | ||
3873 | if (d >= distance) | ||
3874 | continue; | ||
3875 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
3876 | if (land == null) | ||
3877 | continue; | ||
3878 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
3879 | continue; | ||
3880 | distance = d; | ||
3881 | closest = i; | ||
3882 | } | ||
3883 | if (closest == -1) | ||
3884 | return; | ||
3885 | |||
3886 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3887 | } | ||
3888 | } | ||
3889 | } | ||
3890 | |||
3847 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) | 3891 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) |
3848 | { | 3892 | { |
3893 | string reason; | ||
3894 | |||
3895 | // Honor bans | ||
3896 | if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y)) | ||
3897 | return; | ||
3898 | |||
3899 | SceneObjectGroup telehub = null; | ||
3900 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) | ||
3901 | { | ||
3902 | if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | ||
3903 | { | ||
3904 | CheckAndAdjustTelehub(telehub, ref pos); | ||
3905 | return; | ||
3906 | } | ||
3907 | } | ||
3849 | 3908 | ||
3850 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 3909 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
3851 | if (land != null) | 3910 | if (land != null) |