diff options
author | Melanie | 2012-03-06 01:45:20 +0000 |
---|---|---|
committer | Melanie | 2012-03-06 01:45:20 +0000 |
commit | 5004d0ad09ecb82ffa4ebbf1ff789761e11aad97 (patch) | |
tree | 47b527a5cfe7d7103c85755a344654dd14701e5d /OpenSim/Region/OptionalModules/World | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Fix off by one error in script error reporting. (diff) | |
download | opensim-SC-5004d0ad09ecb82ffa4ebbf1ff789761e11aad97.zip opensim-SC-5004d0ad09ecb82ffa4ebbf1ff789761e11aad97.tar.gz opensim-SC-5004d0ad09ecb82ffa4ebbf1ff789761e11aad97.tar.bz2 opensim-SC-5004d0ad09ecb82ffa4ebbf1ff789761e11aad97.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 117 |
1 files changed, 56 insertions, 61 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 36e2d4a..9a7e9e8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class NPCModuleTests | 51 | public class NPCModuleTests |
52 | { | 52 | { |
53 | private TestScene scene; | 53 | private TestScene m_scene; |
54 | private AvatarFactoryModule afm; | 54 | private AvatarFactoryModule m_afMod; |
55 | private UserManagementModule umm; | 55 | private UserManagementModule m_umMod; |
56 | private AttachmentsModule am; | 56 | private AttachmentsModule m_attMod; |
57 | private NPCModule m_npcMod; | ||
57 | 58 | ||
58 | [TestFixtureSetUp] | 59 | [TestFixtureSetUp] |
59 | public void FixtureInit() | 60 | public void FixtureInit() |
@@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
79 | config.AddConfig("Modules"); | 80 | config.AddConfig("Modules"); |
80 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 81 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
81 | 82 | ||
82 | afm = new AvatarFactoryModule(); | 83 | m_afMod = new AvatarFactoryModule(); |
83 | umm = new UserManagementModule(); | 84 | m_umMod = new UserManagementModule(); |
84 | am = new AttachmentsModule(); | 85 | m_attMod = new AttachmentsModule(); |
86 | m_npcMod = new NPCModule(); | ||
85 | 87 | ||
86 | scene = SceneHelpers.SetupScene(); | 88 | m_scene = SceneHelpers.SetupScene(); |
87 | SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); | 89 | SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); |
88 | } | 90 | } |
89 | 91 | ||
90 | [Test] | 92 | [Test] |
@@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
93 | TestHelpers.InMethod(); | 95 | TestHelpers.InMethod(); |
94 | // log4net.Config.XmlConfigurator.Configure(); | 96 | // log4net.Config.XmlConfigurator.Configure(); |
95 | 97 | ||
96 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 98 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
97 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 99 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
98 | 100 | ||
99 | // 8 is the index of the first baked texture in AvatarAppearance | 101 | // 8 is the index of the first baked texture in AvatarAppearance |
@@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
104 | 106 | ||
105 | // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell | 107 | // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell |
106 | // ScenePresence.SendInitialData() to reset our entire appearance. | 108 | // ScenePresence.SendInitialData() to reset our entire appearance. |
107 | scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); | 109 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); |
108 | 110 | ||
109 | afm.SetAppearance(sp, originalTe, null); | 111 | m_afMod.SetAppearance(sp, originalTe, null); |
110 | 112 | ||
111 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 113 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
112 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); | ||
113 | 114 | ||
114 | ScenePresence npc = scene.GetScenePresence(npcId); | 115 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
115 | 116 | ||
116 | Assert.That(npc, Is.Not.Null); | 117 | Assert.That(npc, Is.Not.Null); |
117 | Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); | 118 | Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); |
118 | Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); | 119 | Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); |
119 | } | 120 | } |
120 | 121 | ||
121 | [Test] | 122 | [Test] |
@@ -124,16 +125,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
124 | TestHelpers.InMethod(); | 125 | TestHelpers.InMethod(); |
125 | // log4net.Config.XmlConfigurator.Configure(); | 126 | // log4net.Config.XmlConfigurator.Configure(); |
126 | 127 | ||
127 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 128 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
128 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 129 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
129 | 130 | ||
130 | Vector3 startPos = new Vector3(128, 128, 30); | 131 | Vector3 startPos = new Vector3(128, 128, 30); |
131 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 132 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
132 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
133 | 133 | ||
134 | npcModule.DeleteNPC(npcId, scene); | 134 | m_npcMod.DeleteNPC(npcId, m_scene); |
135 | 135 | ||
136 | ScenePresence deletedNpc = scene.GetScenePresence(npcId); | 136 | ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); |
137 | 137 | ||
138 | Assert.That(deletedNpc, Is.Null); | 138 | Assert.That(deletedNpc, Is.Null); |
139 | } | 139 | } |
@@ -145,21 +145,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
145 | // log4net.Config.XmlConfigurator.Configure(); | 145 | // log4net.Config.XmlConfigurator.Configure(); |
146 | 146 | ||
147 | UUID userId = TestHelpers.ParseTail(0x1); | 147 | UUID userId = TestHelpers.ParseTail(0x1); |
148 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | 148 | UserAccountHelpers.CreateUserWithInventory(m_scene, userId); |
149 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 149 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
150 | 150 | ||
151 | UUID attItemId = TestHelpers.ParseTail(0x2); | 151 | UUID attItemId = TestHelpers.ParseTail(0x2); |
152 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 152 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
153 | string attName = "att"; | 153 | string attName = "att"; |
154 | 154 | ||
155 | UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | 155 | UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); |
156 | 156 | ||
157 | am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); | 157 | m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); |
158 | 158 | ||
159 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 159 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
160 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); | ||
161 | 160 | ||
162 | ScenePresence npc = scene.GetScenePresence(npcId); | 161 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
163 | 162 | ||
164 | // Check scene presence status | 163 | // Check scene presence status |
165 | Assert.That(npc.HasAttachments(), Is.True); | 164 | Assert.That(npc.HasAttachments(), Is.True); |
@@ -185,11 +184,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
185 | // log4net.Config.XmlConfigurator.Configure(); | 184 | // log4net.Config.XmlConfigurator.Configure(); |
186 | 185 | ||
187 | UUID userId = TestHelpers.ParseTail(0x1); | 186 | UUID userId = TestHelpers.ParseTail(0x1); |
188 | UserAccountHelpers.CreateUserWithInventory(scene, userId); | 187 | UserAccountHelpers.CreateUserWithInventory(m_scene, userId); |
189 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 188 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
190 | 189 | ||
191 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 190 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
192 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); | ||
193 | 191 | ||
194 | // Now add the attachment to the original avatar and use that to load a new appearance | 192 | // Now add the attachment to the original avatar and use that to load a new appearance |
195 | // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here | 193 | // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here |
@@ -197,13 +195,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
197 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 195 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
198 | string attName = "att"; | 196 | string attName = "att"; |
199 | 197 | ||
200 | UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | 198 | UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); |
201 | 199 | ||
202 | am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); | 200 | m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); |
203 | 201 | ||
204 | npcModule.SetNPCAppearance(npcId, sp.Appearance, scene); | 202 | m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene); |
205 | 203 | ||
206 | ScenePresence npc = scene.GetScenePresence(npcId); | 204 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
207 | 205 | ||
208 | // Check scene presence status | 206 | // Check scene presence status |
209 | Assert.That(npc.HasAttachments(), Is.True); | 207 | Assert.That(npc.HasAttachments(), Is.True); |
@@ -228,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
228 | TestHelpers.InMethod(); | 226 | TestHelpers.InMethod(); |
229 | // log4net.Config.XmlConfigurator.Configure(); | 227 | // log4net.Config.XmlConfigurator.Configure(); |
230 | 228 | ||
231 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 229 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
232 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); | 230 | // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); |
233 | 231 | ||
234 | Vector3 startPos = new Vector3(128, 128, 30); | 232 | Vector3 startPos = new Vector3(128, 128, 30); |
235 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 233 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
236 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
237 | 234 | ||
238 | ScenePresence npc = scene.GetScenePresence(npcId); | 235 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
239 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 236 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
240 | 237 | ||
241 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. | 238 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. |
242 | npc.Flying = true; | 239 | npc.Flying = true; |
243 | 240 | ||
244 | scene.Update(); | 241 | m_scene.Update(); |
245 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 242 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
246 | 243 | ||
247 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); | 244 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); |
248 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 245 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); |
249 | 246 | ||
250 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 247 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
251 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); | 248 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); |
252 | Assert.That( | 249 | Assert.That( |
253 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); | 250 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); |
254 | 251 | ||
255 | scene.Update(); | 252 | m_scene.Update(); |
256 | 253 | ||
257 | // We should really check the exact figure. | 254 | // We should really check the exact figure. |
258 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); | 255 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); |
@@ -261,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
261 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); | 258 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); |
262 | 259 | ||
263 | for (int i = 0; i < 10; i++) | 260 | for (int i = 0; i < 10; i++) |
264 | scene.Update(); | 261 | m_scene.Update(); |
265 | 262 | ||
266 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 263 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
267 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); | 264 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); |
@@ -271,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
271 | // Try a second movement | 268 | // Try a second movement |
272 | startPos = npc.AbsolutePosition; | 269 | startPos = npc.AbsolutePosition; |
273 | targetPos = startPos + new Vector3(10, 0, 0); | 270 | targetPos = startPos + new Vector3(10, 0, 0); |
274 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 271 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); |
275 | 272 | ||
276 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 273 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
277 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); | 274 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); |
278 | Assert.That( | 275 | Assert.That( |
279 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); | 276 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); |
280 | 277 | ||
281 | scene.Update(); | 278 | m_scene.Update(); |
282 | 279 | ||
283 | // We should really check the exact figure. | 280 | // We should really check the exact figure. |
284 | Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); | 281 | Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); |
@@ -287,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
287 | Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); | 284 | Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); |
288 | 285 | ||
289 | for (int i = 0; i < 10; i++) | 286 | for (int i = 0; i < 10; i++) |
290 | scene.Update(); | 287 | m_scene.Update(); |
291 | 288 | ||
292 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 289 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
293 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); | 290 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); |
@@ -300,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
300 | TestHelpers.InMethod(); | 297 | TestHelpers.InMethod(); |
301 | // log4net.Config.XmlConfigurator.Configure(); | 298 | // log4net.Config.XmlConfigurator.Configure(); |
302 | 299 | ||
303 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 300 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
304 | 301 | ||
305 | Vector3 startPos = new Vector3(128, 128, 30); | 302 | Vector3 startPos = new Vector3(128, 128, 30); |
306 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 303 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
307 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
308 | 304 | ||
309 | ScenePresence npc = scene.GetScenePresence(npcId); | 305 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
310 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 306 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); |
311 | 307 | ||
312 | part.SitTargetPosition = new Vector3(0, 0, 1); | 308 | part.SitTargetPosition = new Vector3(0, 0, 1); |
313 | npcModule.Sit(npc.UUID, part.UUID, scene); | 309 | m_npcMod.Sit(npc.UUID, part.UUID, m_scene); |
314 | 310 | ||
315 | Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); | 311 | Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); |
316 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); | 312 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); |
@@ -318,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
318 | npc.AbsolutePosition, | 314 | npc.AbsolutePosition, |
319 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); | 315 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); |
320 | 316 | ||
321 | npcModule.Stand(npc.UUID, scene); | 317 | m_npcMod.Stand(npc.UUID, m_scene); |
322 | 318 | ||
323 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 319 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
324 | Assert.That(npc.ParentID, Is.EqualTo(0)); | 320 | Assert.That(npc.ParentID, Is.EqualTo(0)); |
@@ -330,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
330 | TestHelpers.InMethod(); | 326 | TestHelpers.InMethod(); |
331 | // log4net.Config.XmlConfigurator.Configure(); | 327 | // log4net.Config.XmlConfigurator.Configure(); |
332 | 328 | ||
333 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 329 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
334 | 330 | ||
335 | // FIXME: To get this to work for now, we are going to place the npc right next to the target so that | 331 | // FIXME: To get this to work for now, we are going to place the npc right next to the target so that |
336 | // the autopilot doesn't trigger | 332 | // the autopilot doesn't trigger |
337 | Vector3 startPos = new Vector3(1, 1, 1); | 333 | Vector3 startPos = new Vector3(1, 1, 1); |
338 | 334 | ||
339 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 335 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); |
340 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); | ||
341 | 336 | ||
342 | ScenePresence npc = scene.GetScenePresence(npcId); | 337 | ScenePresence npc = m_scene.GetScenePresence(npcId); |
343 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 338 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); |
344 | 339 | ||
345 | npcModule.Sit(npc.UUID, part.UUID, scene); | 340 | m_npcMod.Sit(npc.UUID, part.UUID, m_scene); |
346 | 341 | ||
347 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 342 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
348 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); | 343 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); |
@@ -355,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
355 | npc.AbsolutePosition, | 350 | npc.AbsolutePosition, |
356 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); | 351 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); |
357 | 352 | ||
358 | npcModule.Stand(npc.UUID, scene); | 353 | m_npcMod.Stand(npc.UUID, m_scene); |
359 | 354 | ||
360 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 355 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
361 | Assert.That(npc.ParentID, Is.EqualTo(0)); | 356 | Assert.That(npc.ParentID, Is.EqualTo(0)); |