From a658bddbcd03a12d55f51368248ec86d0d9d61e1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 11 Nov 2011 19:59:12 +0000 Subject: Bump warp sit distance up to 10 meters, as discussed on opensim-dev mailing list last week. This means that if the avatar is within 10 meters of the selected target, it sits on it immediately without walking. Existing autopilot outside this range will be disabled in a later commit --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Scenes/Tests/ScenePresenceSitTests.cs | 57 ++++++++++++++++------ 2 files changed, 42 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') 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 if (autopilot) { - if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) + if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) { autopilot = false; 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 public class ScenePresenceSitTests { private TestScene m_scene; -// private AvatarFactoryModule afm; -// private UserManagementModule umm; -// private AttachmentsModule am; [SetUp] public void Init() { -// IConfigSource config = new IniConfigSource(); -// config.AddConfig("NPC"); -// config.Configs["NPC"].Set("Enabled", "true"); -// config.AddConfig("Modules"); -// config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); -// -// afm = new AvatarFactoryModule(); -// umm = new UserManagementModule(); -// am = new AttachmentsModule(); - m_scene = SceneHelpers.SetupScene(); -// SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); + } + + [Test] + public void TestSitOutsideRange() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); + + // More than 10 meters away from 0, 0, 0 (default part position) + Vector3 startPos = new Vector3(10.1f, 0, 0); + sp.AbsolutePosition = startPos; + + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + + sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); + + Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); + Assert.That(sp.ParentID, Is.EqualTo(0)); + } + + [Test] + public void TestSitWithinRange() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); + + // Less than 10 meters away from 0, 0, 0 (default part position) + Vector3 startPos = new Vector3(9.9f, 0, 0); + sp.AbsolutePosition = startPos; + + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + + sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); + + Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); + Assert.That(sp.ParentID, Is.EqualTo(part.LocalId)); } [Test] @@ -74,8 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); - // FIXME: To get this to work for now, we are going to place the npc right next to the target so that - // the autopilot doesn't trigger + // Make sure we're within range to sit Vector3 startPos = new Vector3(1, 1, 1); sp.AbsolutePosition = startPos; -- cgit v1.1