From bee3f203cd93ed3816ff9d24ea04d4aa898cf779 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Dec 2014 22:52:46 +0000
Subject: Allow scripts in attachments on an owned NPC to call NPC functions on
that NPC
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 11 +++++++++++
OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 9 ++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index d5dcddd..478833e 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -122,6 +122,17 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// Check if the caller has permission to manipulate the given NPC.
///
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ /// true if they do, false if they don't.
///
///
///
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 95e59ab..b834619 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -441,13 +441,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
///
/// Check if the caller has permission to manipulate the given NPC.
///
+ ///
+ /// 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.
+ ///
///
///
/// true if they do, false if they don't.
private bool CheckPermissions(NPCAvatar av, UUID callerID)
{
return callerID == UUID.Zero || av.OwnerID == UUID.Zero ||
- av.OwnerID == callerID;
+ av.OwnerID == callerID || av.AgentId == callerID;
}
}
}
\ No newline at end of file
--
cgit v1.1