aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 775dc91..d6b90e1 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -41,6 +41,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
41 41
42 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 42 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
43 43
44 private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
45
46 private AvatarAppearance GetAppearance(UUID target, Scene scene)
47 {
48 if (m_appearanceCache.ContainsKey(target))
49 return m_appearanceCache[target];
50
51 return scene.CommsManager.AvatarService.GetUserAppearance(target);
52 }
53
44 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) 54 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
45 { 55 {
46 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); 56 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
@@ -52,7 +62,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
52 ScenePresence sp; 62 ScenePresence sp;
53 if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) 63 if(scene.TryGetAvatar(npcAvatar.AgentId, out sp))
54 { 64 {
55 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom); 65 AvatarAppearance x = GetAppearance(cloneAppearanceFrom, scene);
56 66
57 List<byte> wearbyte = new List<byte>(); 67 List<byte> wearbyte = new List<byte>();
58 for (int i = 0; i < x.VisualParams.Length; i++) 68 for (int i = 0; i < x.VisualParams.Length; i++)