From 0c041ce12f393367e2754e88d9b8dad5e45f88c4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Oct 2011 01:42:31 +0100 Subject: Implement osNpcSit(). This is still in development so don't trust it Format is osNpcSit(, , OS_NPC_SIT_IMMEDIATE) e.g. osNpcSit(npc, llGetKey(), OS_NPC_SIT_IMMEDIATE); At the moment, sit only succeeds if the part has a sit target set. NPC immediately sits on the target even if miles away - they do not walk up to it. This method is in development - it may change so please don't trust it yet. Standing will follow shortly since that's kind of important once you're sitting :) --- .../World/NPC/Tests/NPCModuleTests.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs') diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 49c06bc..c5be0b6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -229,5 +229,29 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); } + + [Test] + public void TestSit() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + + Vector3 startPos = new Vector3(128, 128, 30); + INPCModule npcModule = scene.RequestModuleInterface(); + UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance); + + ScenePresence npc = scene.GetScenePresence(npcId); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + + // We must have a non Vector3.Zero sit target position otherwise part.SitTargetAvatar doesn't get set! + part.SitTargetPosition = new Vector3(0, 0, 1); + npcModule.Sit(npc.UUID, part.UUID, scene); + + // Assertions? + Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); + Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); + } } } \ No newline at end of file -- cgit v1.1