diff options
author | satguru srivastava | 2012-03-08 20:46:22 -0600 |
---|---|---|
committer | Melanie | 2012-03-09 22:58:59 +0000 |
commit | 35f2479858df52022bd7eddd1e1e8db02ca4e2b8 (patch) | |
tree | f4206694f0c386643ca84564116b514ef2956197 /OpenSim | |
parent | Simplify minimap coarse location code by just reference SP.AbsolutePosition (diff) | |
download | opensim-SC_OLD-35f2479858df52022bd7eddd1e1e8db02ca4e2b8.zip opensim-SC_OLD-35f2479858df52022bd7eddd1e1e8db02ca4e2b8.tar.gz opensim-SC_OLD-35f2479858df52022bd7eddd1e1e8db02ca4e2b8.tar.bz2 opensim-SC_OLD-35f2479858df52022bd7eddd1e1e8db02ca4e2b8.tar.xz |
fix for NPC not playing internal animations
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index be0d56e..69c16c7 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -34,13 +34,17 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.CoreModules.World.Estate; | 36 | using OpenSim.Region.CoreModules.World.Estate; |
37 | using log4net; | ||
38 | using System.Reflection; | ||
39 | using System.Xml; | ||
37 | 40 | ||
38 | namespace OpenSim.Region.OptionalModules.World.NPC | 41 | namespace OpenSim.Region.OptionalModules.World.NPC |
39 | { | 42 | { |
40 | public class NPCAvatar : IClientAPI, INPC | 43 | public class NPCAvatar : IClientAPI, INPC |
41 | { | 44 | { |
42 | public bool SenseAsAgent { get; set; } | 45 | private static readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>(); |
43 | 46 | ||
47 | public bool SenseAsAgent { get; set; } | ||
44 | private readonly string m_firstname; | 48 | private readonly string m_firstname; |
45 | private readonly string m_lastname; | 49 | private readonly string m_lastname; |
46 | private readonly Vector3 m_startPos; | 50 | private readonly Vector3 m_startPos; |
@@ -57,8 +61,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
57 | m_scene = scene; | 61 | m_scene = scene; |
58 | m_ownerID = ownerID; | 62 | m_ownerID = ownerID; |
59 | SenseAsAgent = senseAsAgent; | 63 | SenseAsAgent = senseAsAgent; |
64 | |||
60 | } | 65 | } |
61 | 66 | ||
67 | static NPCAvatar() | ||
68 | { | ||
69 | InitDefaultAnimations(); | ||
70 | } | ||
71 | |||
72 | |||
73 | |||
62 | public IScene Scene | 74 | public IScene Scene |
63 | { | 75 | { |
64 | get { return m_scene; } | 76 | get { return m_scene; } |
@@ -130,8 +142,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
130 | 142 | ||
131 | } | 143 | } |
132 | 144 | ||
145 | private static void InitDefaultAnimations() | ||
146 | { | ||
147 | using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) | ||
148 | { | ||
149 | XmlDocument doc = new XmlDocument(); | ||
150 | doc.Load(reader); | ||
151 | if (doc.DocumentElement != null) | ||
152 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
153 | { | ||
154 | if (nod.Attributes["name"] != null) | ||
155 | { | ||
156 | string name = nod.Attributes["name"].Value.ToLower(); | ||
157 | string id = nod.InnerText; | ||
158 | m_defaultAnimations.Add(name, (UUID)id); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
133 | public UUID GetDefaultAnimation(string name) | 164 | public UUID GetDefaultAnimation(string name) |
134 | { | 165 | { |
166 | if (m_defaultAnimations.ContainsKey(name)) | ||
167 | { | ||
168 | return m_defaultAnimations[name]; | ||
169 | } | ||
135 | return UUID.Zero; | 170 | return UUID.Zero; |
136 | } | 171 | } |
137 | 172 | ||