aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC
diff options
context:
space:
mode:
authorMelanie2012-03-09 23:00:24 +0000
committerMelanie2012-03-09 23:00:24 +0000
commit3dbf754651033d8e5d15a2c7b4bab3a803c1e4e6 (patch)
treed1b29f5a6f2f63e03e768b4d829e6c1771f441d6 /OpenSim/Region/OptionalModules/World/NPC
parentMerge branch 'ubitwork' (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-3dbf754651033d8e5d15a2c7b4bab3a803c1e4e6.zip
opensim-SC-3dbf754651033d8e5d15a2c7b4bab3a803c1e4e6.tar.gz
opensim-SC-3dbf754651033d8e5d15a2c7b4bab3a803c1e4e6.tar.bz2
opensim-SC-3dbf754651033d8e5d15a2c7b4bab3a803c1e4e6.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs37
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 d0b822c..cbc3813 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -34,13 +34,17 @@ using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.CoreModules.World.Estate; 36using OpenSim.Region.CoreModules.World.Estate;
37using log4net;
38using System.Reflection;
39using System.Xml;
37 40
38namespace OpenSim.Region.OptionalModules.World.NPC 41namespace 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