From f565f44d89d57fe688d81d5c77b5aa43df922d96 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 10 Apr 2008 15:38:33 +0000 Subject: Thank you Justin for a patch that solves the issue of: When a sensor detects an Avatar, and llDetectedOwner is called on the script, the current implementation attempts to find the detected avatar as a SceneObjectPart and return the owner of that part. --- .../Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index a070248..6a0b3e2 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -509,11 +509,21 @@ namespace OpenSim.Region.ScriptEngine.Common EntityBase SensedObject = entityDetectedKey(number); if (SensedObject ==null) return String.Empty; - //return SensedObject.O .Name; // What is the owner of the object ? - //EntityBase SensedObject = World.GetScenePresence(SensedUUID); LLUUID SensedUUID = uuidDetectedKey(number); - SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID); - if (SOP != null) { return SOP.ObjectOwner.ToString(); } + if (World.GetScenePresence(SensedUUID) == null) + { + // sensed object is not an avatar + // so get the owner of the sensed object + SceneObjectPart SOP = World.GetSceneObjectPart(SensedUUID); + if (SOP != null) { return SOP.ObjectOwner.ToString(); } + } + else + { + // sensed object is an avatar, and so must be its own owner + return SensedUUID.ToString(); + } + + return String.Empty; } -- cgit v1.1