diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 8c9c006..9ec4740 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -116,7 +116,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
116 | return false; | 116 | return false; |
117 | 117 | ||
118 | // Delete existing npc attachments | 118 | // Delete existing npc attachments |
119 | scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); | 119 | if(scene.AttachmentsModule != null) |
120 | scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); | ||
120 | 121 | ||
121 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet | 122 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet |
122 | // since it doesn't transfer attachments | 123 | // since it doesn't transfer attachments |
@@ -125,7 +126,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
125 | npc.Appearance = npcAppearance; | 126 | npc.Appearance = npcAppearance; |
126 | 127 | ||
127 | // Rez needed npc attachments | 128 | // Rez needed npc attachments |
128 | scene.AttachmentsModule.RezAttachments(npc); | 129 | if (scene.AttachmentsModule != null) |
130 | scene.AttachmentsModule.RezAttachments(npc); | ||
129 | 131 | ||
130 | IAvatarFactoryModule module = | 132 | IAvatarFactoryModule module = |
131 | scene.RequestModuleInterface<IAvatarFactoryModule>(); | 133 | scene.RequestModuleInterface<IAvatarFactoryModule>(); |
@@ -174,7 +176,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
174 | lock (m_avatars) | 176 | lock (m_avatars) |
175 | { | 177 | { |
176 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); | 178 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
177 | scene.AddNewClient(npcAvatar, PresenceType.Npc); | 179 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); |
178 | 180 | ||
179 | ScenePresence sp; | 181 | ScenePresence sp; |
180 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 182 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
@@ -205,8 +207,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
205 | if (scene.TryGetScenePresence(agentID, out sp)) | 207 | if (scene.TryGetScenePresence(agentID, out sp)) |
206 | { | 208 | { |
207 | // m_log.DebugFormat( | 209 | // m_log.DebugFormat( |
208 | // "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", | 210 | // "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", |
209 | // sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); | 211 | // sp.Name, pos, scene.RegionInfo.RegionName, |
212 | // noFly, landAtTarget); | ||
210 | 213 | ||
211 | sp.MoveToTarget(pos, noFly, landAtTarget); | 214 | sp.MoveToTarget(pos, noFly, landAtTarget); |
212 | sp.SetAlwaysRun = running; | 215 | sp.SetAlwaysRun = running; |
@@ -283,9 +286,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
283 | ScenePresence sp; | 286 | ScenePresence sp; |
284 | if (scene.TryGetScenePresence(agentID, out sp)) | 287 | if (scene.TryGetScenePresence(agentID, out sp)) |
285 | { | 288 | { |
286 | sp.HandleAgentRequestSit(m_avatars[agentID], agentID, | 289 | sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); |
287 | partID, Vector3.Zero); | ||
288 | //sp.HandleAgentSit(m_avatars[agentID], agentID); | ||
289 | 290 | ||
290 | return true; | 291 | return true; |
291 | } | 292 | } |
@@ -375,10 +376,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
375 | m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", | 376 | m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", |
376 | agentID, av.Name); | 377 | agentID, av.Name); |
377 | */ | 378 | */ |
378 | scene.RemoveClient(agentID, false); | 379 | |
380 | scene.CloseAgent(agentID, false); | ||
381 | |||
379 | m_avatars.Remove(agentID); | 382 | m_avatars.Remove(agentID); |
380 | 383 | ||
381 | // m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); | 384 | /* |
385 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", | ||
386 | agentID, av.Name); | ||
387 | */ | ||
382 | return true; | 388 | return true; |
383 | } | 389 | } |
384 | } | 390 | } |