diff options
author | Melanie | 2012-01-24 04:06:37 +0000 |
---|---|---|
committer | Melanie | 2012-01-24 04:06:37 +0000 |
commit | 855d3a3ba5cdbd45997abac0f744488854583443 (patch) | |
tree | 2b4b0a56fb04cd8396e4cff75ba79187d7af1f24 /OpenSim | |
parent | Simplify and streamline telehub editing code. Verify rotations and fix (diff) | |
download | opensim-SC_OLD-855d3a3ba5cdbd45997abac0f744488854583443.zip opensim-SC_OLD-855d3a3ba5cdbd45997abac0f744488854583443.tar.gz opensim-SC_OLD-855d3a3ba5cdbd45997abac0f744488854583443.tar.bz2 opensim-SC_OLD-855d3a3ba5cdbd45997abac0f744488854583443.tar.xz |
Teleport routing, part 1
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c66f30e..5c56150 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3835,8 +3835,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
3835 | } | 3835 | } |
3836 | } | 3836 | } |
3837 | 3837 | ||
3838 | private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) | ||
3839 | { | ||
3840 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | ||
3841 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | ||
3842 | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || | ||
3843 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
3844 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | ||
3845 | { | ||
3846 | if (GodLevel < 200 && | ||
3847 | ((!m_scene.Permissions.IsGod(m_uuid) && | ||
3848 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | ||
3849 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
3850 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | ||
3851 | { | ||
3852 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | ||
3853 | if (spawnPoints.Length == 0) | ||
3854 | return; | ||
3855 | |||
3856 | float distance = 9999; | ||
3857 | int closest = -1; | ||
3858 | |||
3859 | for (int i = 0 ; i < spawnPoints.Length ; i++) | ||
3860 | { | ||
3861 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3862 | Vector3 offset = spawnPosition - pos; | ||
3863 | float d = Vector3.Mag(offset); | ||
3864 | if (d >= distance) | ||
3865 | continue; | ||
3866 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
3867 | if (land == null) | ||
3868 | continue; | ||
3869 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
3870 | continue; | ||
3871 | distance = d; | ||
3872 | closest = i; | ||
3873 | } | ||
3874 | if (closest == -1) | ||
3875 | return; | ||
3876 | |||
3877 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3878 | } | ||
3879 | } | ||
3880 | } | ||
3881 | |||
3838 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) | 3882 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) |
3839 | { | 3883 | { |
3884 | SceneObjectGroup telehub = null; | ||
3885 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) | ||
3886 | { | ||
3887 | if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | ||
3888 | { | ||
3889 | CheckAndAdjustTelehub(telehub, ref pos); | ||
3890 | return; | ||
3891 | } | ||
3892 | } | ||
3840 | 3893 | ||
3841 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 3894 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
3842 | if (land != null) | 3895 | if (land != null) |