Add osNpcPlayAnimation and osNpcStopAnimation which respect ownership as well

This commit is contained in:
Melanie
2012-01-06 22:59:08 +00:00
parent a34278cfc3
commit a47aa46962
3 changed files with 56 additions and 0 deletions

View File

@@ -897,6 +897,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation");
AvatarPlayAnimation(avatar, animation);
}
private void AvatarPlayAnimation(string avatar, string animation)
{
UUID avatarID = (UUID)avatar;
m_host.AddScriptLPS(1);
@@ -929,6 +934,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation");
AvatarStopAnimation(avatar, animation);
}
private void AvatarStopAnimation(string avatar, string animation)
{
UUID avatarID = (UUID)avatar;
m_host.AddScriptLPS(1);
@@ -2341,6 +2351,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void osNpcPlayAnimation(LSL_Key npc, string animation)
{
CheckThreatLevel(ThreatLevel.High, "osPlayAnimation");
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
UUID npcID = new UUID(npc.m_string);
if (module.IsNPC(npcID))
{
UUID ownerID = module.GetOwner(npcID);
if (ownerID == UUID.Zero || ownerID == m_host.OwnerID)
AvatarPlayAnimation(npcID.ToString(), animation);
}
}
}
public void osNpcStopAnimation(LSL_Key npc, string animation)
{
CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation");
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
UUID npcID = new UUID(npc.m_string);
if (module.IsNPC(npcID))
{
UUID ownerID = module.GetOwner(npcID);
if (ownerID == UUID.Zero || ownerID == m_host.OwnerID)
AvatarStopAnimation(npcID.ToString(), animation);
}
}
}
/// <summary>
/// Save the current appearance of the script owner permanently to the named notecard.
/// </summary>