From 67a91ee314b3c3bcf0d777057bba405cb33124e8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 10 Aug 2014 22:13:39 +0100 Subject: make sensors detect sitting avatars also by the distance to the root prim of the object as sl does (as sl avatar needs to be in the arc) --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 181399d..7bfe27b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -549,7 +549,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins return; toRegionPos = presence.AbsolutePosition; - dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); + dis = Util.GetDistanceTo(toRegionPos, fromRegionPos); + if (presence.IsSatOnObject && presence.ParentPart != null && + presence.ParentPart.ParentGroup != null && + presence.ParentPart.ParentGroup.RootPart != null) + { + Vector3 rpos = presence.ParentPart.ParentGroup.RootPart.AbsolutePosition; + double dis2 = Util.GetDistanceTo(rpos, fromRegionPos); + if (dis > dis2) + dis = dis2; + } // Disabled for now since all osNpc* methods check for appropriate ownership permission. // Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not -- cgit v1.1