aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-25 01:51:40 +0100
committerJustin Clark-Casey (justincc)2012-04-25 01:51:40 +0100
commita65ca24701ac34415bf76f4d9094ab42ae721c9a (patch)
treed31e0c5934d58716b3d97440c8870c2c21eba569
parentComment out AvatarService.SetAvatar debug log line for now (diff)
downloadopensim-SC_OLD-a65ca24701ac34415bf76f4d9094ab42ae721c9a.zip
opensim-SC_OLD-a65ca24701ac34415bf76f4d9094ab42ae721c9a.tar.gz
opensim-SC_OLD-a65ca24701ac34415bf76f4d9094ab42ae721c9a.tar.bz2
opensim-SC_OLD-a65ca24701ac34415bf76f4d9094ab42ae721c9a.tar.xz
Add regression test TestSameRegionTeleport()
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs36
3 files changed, 43 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index feb783f..221e0bd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
192 m_log.WarnFormat( 192 m_log.WarnFormat(
193 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 193 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
194 position, sp.Name, sp.UUID, emergencyPos); 194 position, sp.Name, sp.UUID, emergencyPos);
195 195
196 position = emergencyPos; 196 position = emergencyPos;
197 } 197 }
198 198
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b5f789b..9005acd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -990,6 +990,8 @@ namespace OpenSim.Region.Framework.Scenes
990 /// <param name="pos"></param> 990 /// <param name="pos"></param>
991 public void Teleport(Vector3 pos) 991 public void Teleport(Vector3 pos)
992 { 992 {
993// m_log.DebugFormat("[SCENE PRESENCE]: Moving {0} to {1} in {2}", Name, pos, Scene.RegionInfo.RegionName);
994
993 bool isFlying = Flying; 995 bool isFlying = Flying;
994 RemoveFromPhysicalScene(); 996 RemoveFromPhysicalScene();
995 Velocity = Vector3.Zero; 997 Velocity = Vector3.Zero;
@@ -1002,6 +1004,10 @@ namespace OpenSim.Region.Framework.Scenes
1002 1004
1003 public void TeleportWithMomentum(Vector3 pos) 1005 public void TeleportWithMomentum(Vector3 pos)
1004 { 1006 {
1007// m_log.DebugFormat(
1008// "[SCENE PRESENCE]: Moving {0} to {1} with existing momentum {2} in {3} ",
1009// Name, pos, Velocity, Scene.RegionInfo.RegionName);
1010
1005 bool isFlying = Flying; 1011 bool isFlying = Flying;
1006 RemoveFromPhysicalScene(); 1012 RemoveFromPhysicalScene();
1007 CheckLandingPoint(ref pos); 1013 CheckLandingPoint(ref pos);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index bebc10c..eb7bfbd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -33,6 +33,7 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
38using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
@@ -47,6 +48,41 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 [TestFixture] 48 [TestFixture]
48 public class ScenePresenceTeleportTests 49 public class ScenePresenceTeleportTests
49 { 50 {
51 [Test]
52 public void TestSameRegionTeleport()
53 {
54 TestHelpers.InMethod();
55// log4net.Config.XmlConfigurator.Configure();
56
57 EntityTransferModule etm = new EntityTransferModule();
58
59 IConfigSource config = new IniConfigSource();
60 config.AddConfig("Modules");
61 // Not strictly necessary since FriendsModule assumes it is the default (!)
62 config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
63
64 TestScene scene = SceneHelpers.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
65 SceneHelpers.SetupSceneModules(scene, config, etm);
66
67 Vector3 teleportPosition = new Vector3(10, 11, 12);
68 Vector3 teleportLookAt = new Vector3(20, 21, 22);
69
70 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
71 sp.AbsolutePosition = new Vector3(30, 31, 32);
72 scene.RequestTeleportLocation(
73 sp.ControllingClient,
74 scene.RegionInfo.RegionHandle,
75 teleportPosition,
76 teleportLookAt,
77 (uint)TeleportFlags.ViaLocation);
78
79 Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
80
81 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
82 // position instead).
83// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
84 }
85
50 /// <summary> 86 /// <summary>
51 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 87 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
52 /// </summary> 88 /// </summary>