aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorMelanie2011-11-05 11:05:32 +0000
committerMelanie2011-11-05 11:05:32 +0000
commit2cf6172689fd67d969c368fe397700ded23572fd (patch)
tree252883c9250264cc914a8e41935e47a03ae50fb1 /OpenSim/Region/OptionalModules/World
parentMerge branch 'master' into bigmerge (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-2cf6172689fd67d969c368fe397700ded23572fd.zip
opensim-SC_OLD-2cf6172689fd67d969c368fe397700ded23572fd.tar.gz
opensim-SC_OLD-2cf6172689fd67d969c368fe397700ded23572fd.tar.bz2
opensim-SC_OLD-2cf6172689fd67d969c368fe397700ded23572fd.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs41
2 files changed, 40 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 10181aa..56ff367 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -208,7 +208,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
208 ScenePresence sp; 208 ScenePresence sp;
209 scene.TryGetScenePresence(agentID, out sp); 209 scene.TryGetScenePresence(agentID, out sp);
210 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); 210 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
211 sp.HandleAgentSit(m_avatars[agentID], agentID); 211// sp.HandleAgentSit(m_avatars[agentID], agentID);
212 212
213 return true; 213 return true;
214 } 214 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 174d74c..d2b79f7 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
231 } 231 }
232 232
233 [Test] 233 [Test]
234 public void TestSitAndStand() 234 public void TestSitAndStandWithSitTarget()
235 { 235 {
236 TestHelpers.InMethod(); 236 TestHelpers.InMethod();
237// log4net.Config.XmlConfigurator.Configure(); 237// log4net.Config.XmlConfigurator.Configure();
@@ -245,12 +245,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
245 ScenePresence npc = scene.GetScenePresence(npcId); 245 ScenePresence npc = scene.GetScenePresence(npcId);
246 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 246 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
247 247
248 // We must have a non Vector3.Zero sit target position otherwise part.SitTargetAvatar doesn't get set!
249 part.SitTargetPosition = new Vector3(0, 0, 1); 248 part.SitTargetPosition = new Vector3(0, 0, 1);
250 npcModule.Sit(npc.UUID, part.UUID, scene); 249 npcModule.Sit(npc.UUID, part.UUID, scene);
251 250
252 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); 251 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
253 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 252 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
253 Assert.That(
254 npc.AbsolutePosition,
255 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
256
257 npcModule.Stand(npc.UUID, scene);
258
259 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
260 Assert.That(npc.ParentID, Is.EqualTo(0));
261 }
262
263 [Test]
264 public void TestSitAndStandWithNoSitTarget()
265 {
266 TestHelpers.InMethod();
267// log4net.Config.XmlConfigurator.Configure();
268
269 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
270
271 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
272 // the autopilot doesn't trigger
273 Vector3 startPos = new Vector3(1, 1, 1);
274
275 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
276 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance);
277
278 ScenePresence npc = scene.GetScenePresence(npcId);
279 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
280
281 npcModule.Sit(npc.UUID, part.UUID, scene);
282
283 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
284 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
285
286 // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
287 // default avatar.
288 Assert.That(
289 npc.AbsolutePosition,
290 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.8857438f)));
254 291
255 npcModule.Stand(npc.UUID, scene); 292 npcModule.Stand(npc.UUID, scene);
256 293