fix for NPC not playing internal animations
parent
06dda14505
commit
35f2479858
|
@ -34,13 +34,17 @@ using OpenSim.Framework;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.CoreModules.World.Estate;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
public class NPCAvatar : IClientAPI, INPC
|
||||
{
|
||||
public bool SenseAsAgent { get; set; }
|
||||
private static readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
|
||||
|
||||
public bool SenseAsAgent { get; set; }
|
||||
private readonly string m_firstname;
|
||||
private readonly string m_lastname;
|
||||
private readonly Vector3 m_startPos;
|
||||
|
@ -57,8 +61,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
m_scene = scene;
|
||||
m_ownerID = ownerID;
|
||||
SenseAsAgent = senseAsAgent;
|
||||
|
||||
}
|
||||
|
||||
static NPCAvatar()
|
||||
{
|
||||
InitDefaultAnimations();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IScene Scene
|
||||
{
|
||||
get { return m_scene; }
|
||||
|
@ -130,8 +142,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
}
|
||||
|
||||
private static void InitDefaultAnimations()
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(reader);
|
||||
if (doc.DocumentElement != null)
|
||||
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
|
||||
{
|
||||
if (nod.Attributes["name"] != null)
|
||||
{
|
||||
string name = nod.Attributes["name"].Value.ToLower();
|
||||
string id = nod.InnerText;
|
||||
m_defaultAnimations.Add(name, (UUID)id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UUID GetDefaultAnimation(string name)
|
||||
{
|
||||
if (m_defaultAnimations.ContainsKey(name))
|
||||
{
|
||||
return m_defaultAnimations[name];
|
||||
}
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue