aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs57
2 files changed, 42 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fdf944b..e098c62 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2034,7 +2034,7 @@ namespace OpenSim.Region.Framework.Scenes
2034 2034
2035 if (autopilot) 2035 if (autopilot)
2036 { 2036 {
2037 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) 2037 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
2038 { 2038 {
2039 autopilot = false; 2039 autopilot = false;
2040 2040
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 627bce7..2636473 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -45,25 +45,51 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 public class ScenePresenceSitTests 45 public class ScenePresenceSitTests
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48// private AvatarFactoryModule afm;
49// private UserManagementModule umm;
50// private AttachmentsModule am;
51 48
52 [SetUp] 49 [SetUp]
53 public void Init() 50 public void Init()
54 { 51 {
55// IConfigSource config = new IniConfigSource();
56// config.AddConfig("NPC");
57// config.Configs["NPC"].Set("Enabled", "true");
58// config.AddConfig("Modules");
59// config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
60//
61// afm = new AvatarFactoryModule();
62// umm = new UserManagementModule();
63// am = new AttachmentsModule();
64
65 m_scene = SceneHelpers.SetupScene(); 52 m_scene = SceneHelpers.SetupScene();
66// SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); 53 }
54
55 [Test]
56 public void TestSitOutsideRange()
57 {
58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure();
60
61 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
62
63 // More than 10 meters away from 0, 0, 0 (default part position)
64 Vector3 startPos = new Vector3(10.1f, 0, 0);
65 sp.AbsolutePosition = startPos;
66
67 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
68
69 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero);
70
71 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
72 Assert.That(sp.ParentID, Is.EqualTo(0));
73 }
74
75 [Test]
76 public void TestSitWithinRange()
77 {
78 TestHelpers.InMethod();
79// log4net.Config.XmlConfigurator.Configure();
80
81 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
82
83 // Less than 10 meters away from 0, 0, 0 (default part position)
84 Vector3 startPos = new Vector3(9.9f, 0, 0);
85 sp.AbsolutePosition = startPos;
86
87 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
88
89 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero);
90
91 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
92 Assert.That(sp.ParentID, Is.EqualTo(part.LocalId));
67 } 93 }
68 94
69 [Test] 95 [Test]
@@ -74,8 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
74 100
75 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 101 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
76 102
77 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that 103 // Make sure we're within range to sit
78 // the autopilot doesn't trigger
79 Vector3 startPos = new Vector3(1, 1, 1); 104 Vector3 startPos = new Vector3(1, 1, 1);
80 sp.AbsolutePosition = startPos; 105 sp.AbsolutePosition = startPos;
81 106