diff options
author | Teravus Ovares (Dan Olivares) | 2009-09-13 07:20:18 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-09-13 07:20:18 -0400 |
commit | 4241cdc9291eb5beeaa3120bf3079541b6452410 (patch) | |
tree | 5268835b9ee3649a0fd17c6b051f42f42ddb61ac /OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |
parent | Guarding the unpacking of the email field introduced by Robsmart. Most profil... (diff) | |
download | opensim-SC_OLD-4241cdc9291eb5beeaa3120bf3079541b6452410.zip opensim-SC_OLD-4241cdc9291eb5beeaa3120bf3079541b6452410.tar.gz opensim-SC_OLD-4241cdc9291eb5beeaa3120bf3079541b6452410.tar.bz2 opensim-SC_OLD-4241cdc9291eb5beeaa3120bf3079541b6452410.tar.xz |
* More comments in the RegionCombinerModule
* Changed the Destination ID to 0 in the TeleportFinish Event (why did we have it as 3?)
* Added border based trigger teleports
* Fix MakeRootAgent border cross tests for ensuring that the position is inside the region to use the borders to figure out if it's outside the Region
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 124 |
1 files changed, 113 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 1c71a99..b38148b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -1074,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1074 | if (eq != null) | 1074 | if (eq != null) |
1075 | { | 1075 | { |
1076 | eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, | 1076 | eq.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, |
1077 | 4, teleportFlags, capsPath, avatar.UUID); | 1077 | 0, teleportFlags, capsPath, avatar.UUID); |
1078 | } | 1078 | } |
1079 | else | 1079 | else |
1080 | { | 1080 | { |
@@ -1269,16 +1269,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
1269 | if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | 1269 | if (scene.TestBorderCross(pos + northCross, Cardinals.N)) |
1270 | { | 1270 | { |
1271 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | 1271 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); |
1272 | neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize); | 1272 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); |
1273 | } | 1273 | } |
1274 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 1274 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
1275 | { | 1275 | { |
1276 | neighboury--; | 1276 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); |
1277 | newpos.Y = Constants.RegionSize - enterDistance; | 1277 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) |
1278 | { | ||
1279 | neighboury--; | ||
1280 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1281 | } | ||
1282 | else | ||
1283 | { | ||
1284 | neighboury = b.TriggerRegionY; | ||
1285 | neighbourx = b.TriggerRegionX; | ||
1286 | |||
1287 | Vector3 newposition = pos; | ||
1288 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1289 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1290 | agent.ControllingClient.SendAgentAlertMessage( | ||
1291 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1292 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1293 | return; | ||
1294 | } | ||
1278 | } | 1295 | } |
1279 | 1296 | ||
1280 | neighbourx--; | 1297 | Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W); |
1281 | newpos.X = Constants.RegionSize - enterDistance; | 1298 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) |
1299 | { | ||
1300 | neighbourx--; | ||
1301 | newpos.X = Constants.RegionSize - enterDistance; | ||
1302 | } | ||
1303 | else | ||
1304 | { | ||
1305 | neighboury = ba.TriggerRegionY; | ||
1306 | neighbourx = ba.TriggerRegionX; | ||
1307 | |||
1308 | |||
1309 | Vector3 newposition = pos; | ||
1310 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1311 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1312 | agent.ControllingClient.SendAgentAlertMessage( | ||
1313 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1314 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1315 | |||
1316 | |||
1317 | return; | ||
1318 | } | ||
1282 | 1319 | ||
1283 | } | 1320 | } |
1284 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) | 1321 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) |
@@ -1289,8 +1326,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1289 | 1326 | ||
1290 | if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 1327 | if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
1291 | { | 1328 | { |
1292 | neighboury--; | 1329 | Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S); |
1293 | newpos.Y = Constants.RegionSize - enterDistance; | 1330 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) |
1331 | { | ||
1332 | neighboury--; | ||
1333 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1334 | } | ||
1335 | else | ||
1336 | { | ||
1337 | neighboury = ba.TriggerRegionY; | ||
1338 | neighbourx = ba.TriggerRegionX; | ||
1339 | Vector3 newposition = pos; | ||
1340 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1341 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1342 | agent.ControllingClient.SendAgentAlertMessage( | ||
1343 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1344 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1345 | return; | ||
1346 | } | ||
1294 | } | 1347 | } |
1295 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | 1348 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) |
1296 | { | 1349 | { |
@@ -1298,16 +1351,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1298 | neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); | 1351 | neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); |
1299 | newpos.Y = enterDistance; | 1352 | newpos.Y = enterDistance; |
1300 | } | 1353 | } |
1301 | 1354 | ||
1302 | 1355 | ||
1303 | } | 1356 | } |
1304 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 1357 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
1305 | { | 1358 | { |
1306 | neighboury--; | 1359 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); |
1307 | newpos.Y = Constants.RegionSize - enterDistance; | 1360 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) |
1361 | { | ||
1362 | neighboury--; | ||
1363 | newpos.Y = Constants.RegionSize - enterDistance; | ||
1364 | } | ||
1365 | else | ||
1366 | { | ||
1367 | neighboury = b.TriggerRegionY; | ||
1368 | neighbourx = b.TriggerRegionX; | ||
1369 | Vector3 newposition = pos; | ||
1370 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
1371 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
1372 | agent.ControllingClient.SendAgentAlertMessage( | ||
1373 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
1374 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
1375 | return; | ||
1376 | } | ||
1308 | } | 1377 | } |
1309 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | 1378 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) |
1310 | { | 1379 | { |
1380 | |||
1311 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | 1381 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); |
1312 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); | 1382 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); |
1313 | newpos.Y = enterDistance; | 1383 | newpos.Y = enterDistance; |
@@ -1342,6 +1412,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); | 1412 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d); |
1343 | } | 1413 | } |
1344 | 1414 | ||
1415 | public void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene) | ||
1416 | { | ||
1417 | Util.FireAndForget(delegate | ||
1418 | { | ||
1419 | Thread.Sleep(10000); | ||
1420 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); | ||
1421 | if (im != null) | ||
1422 | { | ||
1423 | UUID gotoLocation = Util.BuildFakeParcelID( | ||
1424 | Util.UIntsToLong( | ||
1425 | (regionX * | ||
1426 | (uint)Constants.RegionSize), | ||
1427 | (regionY * | ||
1428 | (uint)Constants.RegionSize)), | ||
1429 | (uint)(int)position.X, | ||
1430 | (uint)(int)position.Y, | ||
1431 | (uint)(int)position.Z); | ||
1432 | GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero, | ||
1433 | "Region", agent.UUID, | ||
1434 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
1435 | "", gotoLocation, false, new Vector3(127, 0, 0), | ||
1436 | new Byte[0]); | ||
1437 | im.SendInstantMessage(m, delegate(bool success) | ||
1438 | { | ||
1439 | m_log.DebugFormat("[CLIENT]: Client Initiating Teleport sending IM success = {0}", success); | ||
1440 | }); | ||
1441 | |||
1442 | } | ||
1443 | |||
1444 | }); | ||
1445 | } | ||
1446 | |||
1345 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); | 1447 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying); |
1346 | 1448 | ||
1347 | /// <summary> | 1449 | /// <summary> |