From 90b825cda8eac02d9bb0af0dd734a662014b4d26 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 28 Jun 2016 23:30:04 +0100 Subject: [PATCH] if a NPC is owned, allow access if ownerID matchs parcel owner or it is in the access list. option OS_NPC_OBJECT_GROUP it still needed if access is by group (this option should also work with not owned NPC) NEEDS TESTING, may prove to be a bad solution --- .../CoreModules/World/Land/LandObject.cs | 25 ++++++++++++++++++- .../Region/Framework/Interfaces/INPCModule.cs | 1 + .../OptionalModules/World/NPC/NPCAvatar.cs | 4 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 6b37dad0a1..4cea7bb209 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -694,7 +694,30 @@ namespace OpenSim.Region.CoreModules.World.Land if (HasGroupAccess(avatar)) return false; - return !IsInLandAccessList(avatar); + if(IsInLandAccessList(avatar)) + return false; + + // check for a NPC + ScenePresence sp; + if (!m_scene.TryGetScenePresence(avatar, out sp)) + return true; + + if(sp==null || !sp.isNPC) + return true; + + INPC npccli = (INPC)sp.ControllingClient; + if(npccli== null) + return true; + + UUID owner = npccli.Owner; + + if(owner == UUID.Zero) + return true; + + if (owner == LandData.OwnerID) + return false; + + return !IsInLandAccessList(owner); } public bool IsInLandAccessList(UUID avatar) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 14610ffe47..58ea309f99 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces /// bool SenseAsAgent { get; } UUID ActiveGroupId { get; set; } + UUID Owner { get; } } public interface INPCModule diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 95cf73c46e..43b4e0274c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -43,6 +43,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC public class NPCAvatar : IClientAPI, INPC { public bool SenseAsAgent { get; set; } + public UUID Owner + { + get { return m_ownerID;} + } public delegate void ChatToNPC( string message, byte type, Vector3 fromPos, string fromName,