aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs23
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs147
4 files changed, 107 insertions, 67 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 7d7c5c5..0f62b2a 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
70 m_client = client; 70 m_client = client;
71 m_scene = scene; 71 m_scene = scene;
72 72
73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); 73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
74 } 74 }
75 75
76 private void SendServerCommand(string command) 76 private void SendServerCommand(string command)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index eb39026..a7c5020 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
57 57
58 m_listener.Start(50); 58 m_listener.Start(50);
59 59
60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); 60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
61 m_baseScene = baseScene; 61 m_baseScene = baseScene;
62 } 62 }
63 63
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 78e9b29..68f21c8 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -88,25 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
88 88
89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) 89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
90 { 90 {
91 ScenePresence sp = scene.GetScenePresence(agentId); 91 ScenePresence npc = scene.GetScenePresence(agentId);
92 if (sp == null || sp.IsChildAgent) 92 if (npc == null || npc.IsChildAgent)
93 return false; 93 return false;
94 94
95 lock (m_avatars) 95 lock (m_avatars)
96 if (!m_avatars.ContainsKey(agentId)) 96 if (!m_avatars.ContainsKey(agentId))
97 return false; 97 return false;
98 98
99 // Delete existing sp attachments 99 // Delete existing npc attachments
100 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); 100 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
101
102 AvatarAppearance app = new AvatarAppearance(appearance, true);
103 sp.Appearance = app;
104 101
105 // Set new sp appearance. Also sends to clients. 102 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
106 scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, app); 103 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
104 npc.Appearance = npcAppearance;
107 105
108 // Rez needed sp attachments 106 // Rez needed npc attachments
109 scene.AttachmentsModule.RezAttachments(sp); 107 scene.AttachmentsModule.RezAttachments(npc);
108
109 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
110 module.SendAppearance(npc.UUID);
110 111
111 return true; 112 return true;
112 } 113 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index d507822..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,42 +125,83 @@ 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 }
140 140
141 [Test] 141 [Test]
142 public void TestAttachments() 142 public void TestCreateWithAttachments()
143 { 143 {
144 TestHelpers.InMethod(); 144 TestHelpers.InMethod();
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);
162
163 // Check scene presence status
164 Assert.That(npc.HasAttachments(), Is.True);
165 List<SceneObjectGroup> attachments = npc.GetAttachments();
166 Assert.That(attachments.Count, Is.EqualTo(1));
167 SceneObjectGroup attSo = attachments[0];
168
169 // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
170 // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
171// Assert.That(attSo.Name, Is.EqualTo(attName));
172
173 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
174 Assert.That(attSo.IsAttachment);
175 Assert.That(attSo.UsesPhysics, Is.False);
176 Assert.That(attSo.IsTemporary, Is.False);
177 Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
178 }
179
180 [Test]
181 public void TestLoadAppearance()
182 {
183 TestHelpers.InMethod();
184// log4net.Config.XmlConfigurator.Configure();
185
186 UUID userId = TestHelpers.ParseTail(0x1);
187 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
188 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
189
190 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
191
192 // Now add the attachment to the original avatar and use that to load a new appearance
193 // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
194 UUID attItemId = TestHelpers.ParseTail(0x2);
195 UUID attAssetId = TestHelpers.ParseTail(0x3);
196 string attName = "att";
197
198 UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
199
200 m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
201
202 m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);
203
204 ScenePresence npc = m_scene.GetScenePresence(npcId);
163 205
164 // Check scene presence status 206 // Check scene presence status
165 Assert.That(npc.HasAttachments(), Is.True); 207 Assert.That(npc.HasAttachments(), Is.True);
@@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
184 TestHelpers.InMethod(); 226 TestHelpers.InMethod();
185// log4net.Config.XmlConfigurator.Configure(); 227// log4net.Config.XmlConfigurator.Configure();
186 228
187 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 229 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
188// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 230// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
189 231
190 Vector3 startPos = new Vector3(128, 128, 30); 232 Vector3 startPos = new Vector3(128, 128, 30);
191 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 233 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
192 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
193 234
194 ScenePresence npc = scene.GetScenePresence(npcId); 235 ScenePresence npc = m_scene.GetScenePresence(npcId);
195 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 236 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
196 237
197 // 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.
198 npc.Flying = true; 239 npc.Flying = true;
199 240
200 scene.Update(); 241 m_scene.Update();
201 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 242 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
202 243
203 Vector3 targetPos = startPos + new Vector3(0, 10, 0); 244 Vector3 targetPos = startPos + new Vector3(0, 10, 0);
204 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); 245 m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
205 246
206 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 247 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
207 //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)));
208 Assert.That( 249 Assert.That(
209 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));
210 251
211 scene.Update(); 252 m_scene.Update();
212 253
213 // We should really check the exact figure. 254 // We should really check the exact figure.
214 Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); 255 Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
@@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
217 Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); 258 Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
218 259
219 for (int i = 0; i < 10; i++) 260 for (int i = 0; i < 10; i++)
220 scene.Update(); 261 m_scene.Update();
221 262
222 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 263 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
223 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");
@@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
227 // Try a second movement 268 // Try a second movement
228 startPos = npc.AbsolutePosition; 269 startPos = npc.AbsolutePosition;
229 targetPos = startPos + new Vector3(10, 0, 0); 270 targetPos = startPos + new Vector3(10, 0, 0);
230 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); 271 m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
231 272
232 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 273 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
233// 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)));
234 Assert.That( 275 Assert.That(
235 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));
236 277
237 scene.Update(); 278 m_scene.Update();
238 279
239 // We should really check the exact figure. 280 // We should really check the exact figure.
240 Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); 281 Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
@@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
243 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); 284 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
244 285
245 for (int i = 0; i < 10; i++) 286 for (int i = 0; i < 10; i++)
246 scene.Update(); 287 m_scene.Update();
247 288
248 distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 289 distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
249 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");
@@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
256 TestHelpers.InMethod(); 297 TestHelpers.InMethod();
257// log4net.Config.XmlConfigurator.Configure(); 298// log4net.Config.XmlConfigurator.Configure();
258 299
259 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 300 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
260 301
261 Vector3 startPos = new Vector3(128, 128, 30); 302 Vector3 startPos = new Vector3(128, 128, 30);
262 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 303 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
263 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
264 304
265 ScenePresence npc = scene.GetScenePresence(npcId); 305 ScenePresence npc = m_scene.GetScenePresence(npcId);
266 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 306 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
267 307
268 part.SitTargetPosition = new Vector3(0, 0, 1); 308 part.SitTargetPosition = new Vector3(0, 0, 1);
269 npcModule.Sit(npc.UUID, part.UUID, scene); 309 m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
270 310
271 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); 311 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
272 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 312 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
274 npc.AbsolutePosition, 314 npc.AbsolutePosition,
275 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 315 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
276 316
277 npcModule.Stand(npc.UUID, scene); 317 m_npcMod.Stand(npc.UUID, m_scene);
278 318
279 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 319 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
280 Assert.That(npc.ParentID, Is.EqualTo(0)); 320 Assert.That(npc.ParentID, Is.EqualTo(0));
@@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
286 TestHelpers.InMethod(); 326 TestHelpers.InMethod();
287// log4net.Config.XmlConfigurator.Configure(); 327// log4net.Config.XmlConfigurator.Configure();
288 328
289 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 329 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
290 330
291 // 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
292 // the autopilot doesn't trigger 332 // the autopilot doesn't trigger
293 Vector3 startPos = new Vector3(1, 1, 1); 333 Vector3 startPos = new Vector3(1, 1, 1);
294 334
295 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 335 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
296 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
297 336
298 ScenePresence npc = scene.GetScenePresence(npcId); 337 ScenePresence npc = m_scene.GetScenePresence(npcId);
299 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 338 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
300 339
301 npcModule.Sit(npc.UUID, part.UUID, scene); 340 m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
302 341
303 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 342 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
304 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 343 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
311 npc.AbsolutePosition, 350 npc.AbsolutePosition,
312 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); 351 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
313 352
314 npcModule.Stand(npc.UUID, scene); 353 m_npcMod.Stand(npc.UUID, m_scene);
315 354
316 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 355 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
317 Assert.That(npc.ParentID, Is.EqualTo(0)); 356 Assert.That(npc.ParentID, Is.EqualTo(0));