From 12049e1120559a36ea5fd0453a36210808d04363 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jul 2012 11:03:12 +0200 Subject: [PATCH] Allow setting linked avatar positions from within a prim not the one sat on --- .../Shared/Api/Implementation/LSL_Api.cs | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5bade25e68..595dd8a3bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2469,9 +2469,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public LSL_Rotation llGetLocalRot() + { + return GetPartLocalRot(m_host); + } + + private LSL_Rotation GetPartLocalRot(SceneObjectPart part) { m_host.AddScriptLPS(1); - Quaternion rot = m_host.RotationOffset; + Quaternion rot = part.RotationOffset; return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); } @@ -8029,10 +8034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) + if (part.LinkNum > 1) { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); + localRot = GetPartLocalRot(part); + localPos = GetPartLocalPos(part); } v -= localPos; @@ -8054,17 +8059,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) - { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); - } + if (part.LinkNum > 1) + localRot = GetPartLocalRot(part); - LSL_Rotation r; - r = rules.GetQuaternionItem(idx++); r = r * llGetRootRotation() / localRot; av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); av.SendAvatarDataToAllAgents();