diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 103 |
1 files changed, 84 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1a8caae..34362bf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4134,28 +4134,93 @@ namespace OpenSim.Region.Framework.Scenes | |||
4134 | if (spawnPoints.Length == 0) | 4134 | if (spawnPoints.Length == 0) |
4135 | return; | 4135 | return; |
4136 | 4136 | ||
4137 | float distance = 9999; | 4137 | int index; |
4138 | int closest = -1; | 4138 | bool selected = false; |
4139 | 4139 | ||
4140 | for (int i = 0 ; i < spawnPoints.Length ; i++) | 4140 | switch (m_scene.SpawnPointRouting) |
4141 | { | 4141 | { |
4142 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4142 | case "closest": |
4143 | Vector3 offset = spawnPosition - pos; | ||
4144 | float d = Vector3.Mag(offset); | ||
4145 | if (d >= distance) | ||
4146 | continue; | ||
4147 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4148 | if (land == null) | ||
4149 | continue; | ||
4150 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4151 | continue; | ||
4152 | distance = d; | ||
4153 | closest = i; | ||
4154 | } | ||
4155 | if (closest == -1) | ||
4156 | return; | ||
4157 | 4143 | ||
4158 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4144 | float distance = 9999; |
4145 | int closest = -1; | ||
4146 | |||
4147 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4148 | { | ||
4149 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4150 | telehub.AbsolutePosition, | ||
4151 | telehub.GroupRotation | ||
4152 | ); | ||
4153 | Vector3 offset = spawnPosition - pos; | ||
4154 | float d = Vector3.Mag(offset); | ||
4155 | if (d >= distance) | ||
4156 | continue; | ||
4157 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4158 | if (land == null) | ||
4159 | continue; | ||
4160 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4161 | continue; | ||
4162 | distance = d; | ||
4163 | closest = i; | ||
4164 | } | ||
4165 | if (closest == -1) | ||
4166 | return; | ||
4167 | |||
4168 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4169 | return; | ||
4170 | |||
4171 | case "random": | ||
4172 | |||
4173 | do | ||
4174 | { | ||
4175 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
4176 | |||
4177 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4178 | telehub.AbsolutePosition, | ||
4179 | telehub.GroupRotation | ||
4180 | ); | ||
4181 | // SpawnPoint sp = spawnPoints[index]; | ||
4182 | |||
4183 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4184 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4185 | selected = false; | ||
4186 | else | ||
4187 | selected = true; | ||
4188 | |||
4189 | } while ( selected == false); | ||
4190 | |||
4191 | pos = spawnPoints[index].GetLocation( | ||
4192 | telehub.AbsolutePosition, | ||
4193 | telehub.GroupRotation | ||
4194 | ); | ||
4195 | return; | ||
4196 | |||
4197 | case "sequence": | ||
4198 | |||
4199 | do | ||
4200 | { | ||
4201 | index = m_scene.SpawnPoint(); | ||
4202 | |||
4203 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4204 | telehub.AbsolutePosition, | ||
4205 | telehub.GroupRotation | ||
4206 | ); | ||
4207 | // SpawnPoint sp = spawnPoints[index]; | ||
4208 | |||
4209 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4210 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4211 | selected = false; | ||
4212 | else | ||
4213 | selected = true; | ||
4214 | |||
4215 | } while (selected == false); | ||
4216 | |||
4217 | pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4218 | ; | ||
4219 | return; | ||
4220 | |||
4221 | default: | ||
4222 | return; | ||
4223 | } | ||
4159 | } | 4224 | } |
4160 | } | 4225 | } |
4161 | } | 4226 | } |