diff options
author | Justin Clark-Casey (justincc) | 2012-03-06 01:27:30 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-06 01:27:30 +0000 |
commit | d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e (patch) | |
tree | b62aa7e3b623c3e4a86031ea5a289b0a8d3ea32f /OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |
parent | Updates to MSSQL store for 0.7.3 to include: (diff) | |
download | opensim-SC-d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e.zip opensim-SC-d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e.tar.gz opensim-SC-d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e.tar.bz2 opensim-SC-d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e.tar.xz |
Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914
The part reverted is from commit 2ebb421.
Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments.
I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :)
Regression test added for this case.
Mantis ref: http://opensimulator.org/mantis/view.php?id=5914
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-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 | } |