Merge branch 'master' into bigmerge

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
This commit is contained in:
Melanie
2011-11-05 11:05:32 +00:00
6 changed files with 55 additions and 8 deletions

View File

@@ -208,7 +208,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp);
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
sp.HandleAgentSit(m_avatars[agentID], agentID);
// sp.HandleAgentSit(m_avatars[agentID], agentID);
return true;
}

View File

@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
}
[Test]
public void TestSitAndStand()
public void TestSitAndStandWithSitTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
@@ -245,12 +245,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
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);
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
Assert.That(
npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
npcModule.Stand(npc.UUID, scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(0));
}
[Test]
public void TestSitAndStandWithNoSitTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(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
Vector3 startPos = new Vector3(1, 1, 1);
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);
npcModule.Sit(npc.UUID, part.UUID, scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
Assert.That(
npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.8857438f)));
npcModule.Stand(npc.UUID, scene);