Implement osNpcSit(). This is still in development so don't trust it

Format is osNpcSit(<npc-uuid>, <target-uuid>, 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 :)
This commit is contained in:
Justin Clark-Casey (justincc)
2011-10-17 01:42:31 +01:00
parent bbd0e68c06
commit 0c041ce12f
10 changed files with 75 additions and 5 deletions

View File

@@ -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<INPCModule>();
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));
}
}
}