diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2052cdb..2b8379d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -88,22 +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 | 101 | ||
102 | // Set new sp appearance. Also sends to clients. | 102 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments |
103 | scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true)); | 103 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); |
104 | npc.Appearance = npcAppearance; | ||
104 | 105 | ||
105 | // Rez needed sp attachments | 106 | // Rez needed npc attachments |
106 | scene.AttachmentsModule.RezAttachments(sp); | 107 | scene.AttachmentsModule.RezAttachments(npc); |
108 | |||
109 | IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
110 | module.SendAppearance(npc.UUID); | ||
107 | 111 | ||
108 | return true; | 112 | return true; |
109 | } | 113 | } |