aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-28 19:42:28 -0400
committerTeravus Ovares (Dan Olivares)2009-08-28 19:42:28 -0400
commit9eb8c14e87986221f52872a697e49ec7059aa54b (patch)
treea211b891a37b0f911aa19b9b2cae524e618b732f /OpenSim/Region/Framework/Scenes
parent* Allow corner prim crossings. Previously this was only on a single cardinal... (diff)
downloadopensim-SC_OLD-9eb8c14e87986221f52872a697e49ec7059aa54b.zip
opensim-SC_OLD-9eb8c14e87986221f52872a697e49ec7059aa54b.tar.gz
opensim-SC_OLD-9eb8c14e87986221f52872a697e49ec7059aa54b.tar.bz2
opensim-SC_OLD-9eb8c14e87986221f52872a697e49ec7059aa54b.tar.xz
* Deal with teleports to other virtual regions in the same scene.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs89
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs1
3 files changed, 113 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dfd06bb..2c1d0e5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3267,16 +3267,47 @@ namespace OpenSim.Region.Framework.Scenes
3267 3267
3268 if (sp != null) 3268 if (sp != null)
3269 { 3269 {
3270 uint regionX = m_regInfo.RegionLocX;
3271 uint regionY = m_regInfo.RegionLocY;
3272
3273 Utils.LongToUInts(regionHandle, out regionX, out regionY);
3274
3275 int shiftx = (int) regionX - (int) m_regInfo.RegionLocX * (int)Constants.RegionSize;
3276 int shifty = (int)regionY - (int)m_regInfo.RegionLocY * (int)Constants.RegionSize;
3277
3278 position.X += shiftx;
3279 position.Y += shifty;
3280
3281 bool result = false;
3282
3283 if (TestBorderCross(position,Cardinals.N))
3284 result = true;
3285
3286 if (TestBorderCross(position, Cardinals.S))
3287 result = true;
3288
3289 if (TestBorderCross(position, Cardinals.E))
3290 result = true;
3291
3292 if (TestBorderCross(position, Cardinals.W))
3293 result = true;
3294
3295 // bordercross if position is outside of region
3296
3297 if (!result)
3298 regionHandle = m_regInfo.RegionHandle;
3299
3270 if (m_teleportModule != null) 3300 if (m_teleportModule != null)
3271 { 3301 {
3272 m_teleportModule.RequestTeleportToLocation(sp, regionHandle, 3302 m_teleportModule.RequestTeleportToLocation(sp, regionHandle,
3273 position, lookAt, teleportFlags); 3303 position, lookAt, teleportFlags);
3274 } 3304 }
3275 else 3305 else
3276 { 3306 {
3277 m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, 3307 m_sceneGridService.RequestTeleportToLocation(sp, regionHandle,
3278 position, lookAt, teleportFlags); 3308 position, lookAt, teleportFlags);
3279 } 3309 }
3310
3280 } 3311 }
3281 } 3312 }
3282 3313
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 65c97e8..167d5f7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -803,11 +803,11 @@ namespace OpenSim.Region.Framework.Scenes
803 if (regionHandle == m_regionInfo.RegionHandle) 803 if (regionHandle == m_regionInfo.RegionHandle)
804 { 804 {
805 m_log.DebugFormat( 805 m_log.DebugFormat(
806 "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation {0} within {1}", 806 "[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation {0} within {1}",
807 position, m_regionInfo.RegionName); 807 position, m_regionInfo.RegionName);
808 808
809 // Teleport within the same region 809 // Teleport within the same region
810 if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0) 810 if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0)
811 { 811 {
812 Vector3 emergencyPos = new Vector3(128, 128, 128); 812 Vector3 emergencyPos = new Vector3(128, 128, 128);
813 813
@@ -816,10 +816,17 @@ namespace OpenSim.Region.Framework.Scenes
816 position, avatar.Name, avatar.UUID, emergencyPos); 816 position, avatar.Name, avatar.UUID, emergencyPos);
817 position = emergencyPos; 817 position = emergencyPos;
818 } 818 }
819 819
820 // TODO: Get proper AVG Height 820 // TODO: Get proper AVG Height
821 float localAVHeight = 1.56f; 821 float localAVHeight = 1.56f;
822 float posZLimit = (float)avatar.Scene.Heightmap[(int)position.X, (int)position.Y]; 822 float posZLimit = 22;
823
824 // TODO: Check other Scene HeightField
825 if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <=(int)Constants.RegionSize)
826 {
827 posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y];
828 }
829
823 float newPosZ = posZLimit + localAVHeight; 830 float newPosZ = posZLimit + localAVHeight;
824 if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 831 if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
825 { 832 {
@@ -1084,6 +1091,21 @@ namespace OpenSim.Region.Framework.Scenes
1084 } 1091 }
1085 } 1092 }
1086 1093
1094 private bool IsOutsideRegion(Scene s, Vector3 pos)
1095 {
1096
1097 if (s.TestBorderCross(pos,Cardinals.N))
1098 return true;
1099 if (s.TestBorderCross(pos, Cardinals.S))
1100 return true;
1101 if (s.TestBorderCross(pos, Cardinals.E))
1102 return true;
1103 if (s.TestBorderCross(pos, Cardinals.W))
1104 return true;
1105
1106 return false;
1107 }
1108
1087 public bool WaitForCallback(UUID id) 1109 public bool WaitForCallback(UUID id)
1088 { 1110 {
1089 int count = 200; 1111 int count = 200;
@@ -1165,27 +1187,76 @@ namespace OpenSim.Region.Framework.Scenes
1165 // distance into new region to place avatar 1187 // distance into new region to place avatar
1166 const float enterDistance = 0.1f; 1188 const float enterDistance = 0.1f;
1167 1189
1168 if (pos.X < boundaryDistance) 1190 if (scene.TestBorderCross(pos, Cardinals.W))
1191 {
1192 if (scene.TestBorderCross(pos, Cardinals.N))
1193 {
1194 Border b = scene.GetCrossedBorder(pos, Cardinals.N);
1195 neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize);
1196 }
1197
1198
1199 neighbourx--;
1200 newpos.X = Constants.RegionSize - enterDistance;
1201
1202 }
1203 else if (scene.TestBorderCross(pos, Cardinals.E))
1204 {
1205 if (scene.TestBorderCross(pos, Cardinals.S))
1206 {
1207 neighboury--;
1208 newpos.Y = Constants.RegionSize - enterDistance;
1209 }
1210 else if (scene.TestBorderCross(pos, Cardinals.N))
1211 {
1212 Border b = scene.GetCrossedBorder(pos, Cardinals.N);
1213 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
1214 newpos.Y = enterDistance;
1215 }
1216 else
1217 {
1218 Border b = scene.GetCrossedBorder(pos, Cardinals.E);
1219 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
1220 newpos.X = enterDistance;
1221 }
1222
1223 }
1224 else if (scene.TestBorderCross(pos, Cardinals.S))
1225 {
1226 neighboury--;
1227 newpos.Y = Constants.RegionSize - enterDistance;
1228 }
1229 else if (scene.TestBorderCross(pos, Cardinals.N))
1230 {
1231 Border b = scene.GetCrossedBorder(pos, Cardinals.N);
1232 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
1233 newpos.Y = enterDistance;
1234 }
1235
1236 /*
1237
1238 if (pos.X < boundaryDistance) //West
1169 { 1239 {
1170 neighbourx--; 1240 neighbourx--;
1171 newpos.X = Constants.RegionSize - enterDistance; 1241 newpos.X = Constants.RegionSize - enterDistance;
1172 } 1242 }
1173 else if (pos.X > Constants.RegionSize - boundaryDistance) 1243 else if (pos.X > Constants.RegionSize - boundaryDistance) // East
1174 { 1244 {
1175 neighbourx++; 1245 neighbourx++;
1176 newpos.X = enterDistance; 1246 newpos.X = enterDistance;
1177 } 1247 }
1178 1248
1179 if (pos.Y < boundaryDistance) 1249 if (pos.Y < boundaryDistance) // South
1180 { 1250 {
1181 neighboury--; 1251 neighboury--;
1182 newpos.Y = Constants.RegionSize - enterDistance; 1252 newpos.Y = Constants.RegionSize - enterDistance;
1183 } 1253 }
1184 else if (pos.Y > Constants.RegionSize - boundaryDistance) 1254 else if (pos.Y > Constants.RegionSize - boundaryDistance) // North
1185 { 1255 {
1186 neighboury++; 1256 neighboury++;
1187 newpos.Y = enterDistance; 1257 newpos.Y = enterDistance;
1188 } 1258 }
1259 */
1189 1260
1190 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 1261 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
1191 d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); 1262 d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index aae1823..46e3289 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2854,6 +2854,7 @@ namespace OpenSim.Region.Framework.Scenes
2854 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2854 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2855 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2855 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2856 2856
2857
2857 // Makes sure avatar does not end up outside region 2858 // Makes sure avatar does not end up outside region
2858 if (neighbor < 0) 2859 if (neighbor < 0)
2859 AbsolutePosition = new Vector3( 2860 AbsolutePosition = new Vector3(