From 365b5951ff06c6676708b159efb10db62ccd85d2 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Thu, 5 Mar 2009 03:20:28 +0000
Subject: Fixes Mantis #3194. Thank you kindly, Godfrey for a patch that: fixes
 llSetLinkPrimitiveParams() - PRIM_ROTATION rotates the prim containing the
 script, rather than the specified child prim

---
 .../Shared/Api/Implementation/LSL_Api.cs             | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0734e1c..fcd94a4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6433,7 +6433,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
                             return;
 
                         LSL_Rotation q = rules.GetQuaternionItem(idx++);
-                        llSetRot(q);
+                        // try to let this work as in SL...
+                        if (part.ParentID == 0)
+                        {
+                            // special case: If we are root, rotate complete SOG to new rotation
+                            SetRot(part, Rot2Quaternion(q));
+     					}
+			            else
+			            {
+			                // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
+			                SceneObjectGroup group = part.ParentGroup;
+			                if (group != null) // a bit paranoid, maybe
+			                {
+			                    SceneObjectPart rootPart = group.RootPart;
+			                    if (rootPart != null) // again, better safe than sorry
+			                    {
+			                        SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
+			                    }
+			                }
+			            }
 
                         break;
 
-- 
cgit v1.1