Allow scripts in attachments on an owned NPC to call NPC functions on that NPC

mb-throttle-test
Justin Clark-Casey (justincc) 2014-12-04 22:52:46 +00:00
parent d930ca7b1d
commit bee3f203cd
2 changed files with 19 additions and 1 deletions

View File

@ -122,6 +122,17 @@ namespace OpenSim.Region.Framework.Interfaces
/// <summary> /// <summary>
/// Check if the caller has permission to manipulate the given NPC. /// Check if the caller has permission to manipulate the given NPC.
/// </summary> /// </summary>
/// <remarks>
/// A caller has permission if
/// * An NPC exists with the given npcID.
/// * The caller UUID given is UUID.Zero.
/// * The avatar is unowned (owner is UUID.Zero).
/// * The avatar is owned and the owner and callerID match.
/// * The avatar is owned and the callerID matches its agentID.
/// </remarks>
/// <param name="av"></param>
/// <param name="callerID"></param>
/// <returns>true if they do, false if they don't.</returns>
/// <param name="npcID"></param> /// <param name="npcID"></param>
/// <param name="callerID"></param> /// <param name="callerID"></param>
/// <returns> /// <returns>

View File

@ -441,13 +441,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
/// <summary> /// <summary>
/// Check if the caller has permission to manipulate the given NPC. /// Check if the caller has permission to manipulate the given NPC.
/// </summary> /// </summary>
/// <remarks>
/// A caller has permission if
/// * The caller UUID given is UUID.Zero.
/// * The avatar is unowned (owner is UUID.Zero).
/// * The avatar is owned and the owner and callerID match.
/// * The avatar is owned and the callerID matches its agentID.
/// </remarks>
/// <param name="av"></param> /// <param name="av"></param>
/// <param name="callerID"></param> /// <param name="callerID"></param>
/// <returns>true if they do, false if they don't.</returns> /// <returns>true if they do, false if they don't.</returns>
private bool CheckPermissions(NPCAvatar av, UUID callerID) private bool CheckPermissions(NPCAvatar av, UUID callerID)
{ {
return callerID == UUID.Zero || av.OwnerID == UUID.Zero || return callerID == UUID.Zero || av.OwnerID == UUID.Zero ||
av.OwnerID == callerID; av.OwnerID == callerID || av.AgentId == callerID;
} }
} }
} }