From d04f6688e42f340f0dedec2c4982cf2fd4cf1686 Mon Sep 17 00:00:00 2001 From: Jeff Lee Date: Sat, 19 Dec 2009 18:25:45 -0500 Subject: Fixes some incorrect values returned by llGetPrimitiveParams() and osGetLinkPrimitiveParams(). Signed-off-by: Melanie --- .../Shared/Api/Implementation/LSL_Api.cs | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7f71d09..79b2391 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5801,7 +5801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); return World.SimulatorFPS; } - + /* particle system rules should be coming into this routine as doubles, that is rule[0] should be an integer from this list and rule[1] should be the arg @@ -7401,9 +7401,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_POSITION: - res.Add(new LSL_Vector(part.AbsolutePosition.X, + LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, part.AbsolutePosition.Y, - part.AbsolutePosition.Z)); + part.AbsolutePosition.Z); + // For some reason, the part.AbsolutePosition.* values do not change if the + // linkset is rotated; they always reflect the child prim's world position + // as though the linkset is unrotated. This is incompatible behavior with SL's + // implementation, so will break scripts imported from there (not to mention it + // makes it more difficult to determine a child prim's actual inworld position). + if (part.ParentID != 0) + v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition(); + res.Add( v ); break; case (int)ScriptBaseClass.PRIM_SIZE: @@ -7421,6 +7429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api PrimitiveBaseShape Shape = part.Shape; int primType = getScriptPrimType(part.Shape); res.Add(new LSL_Integer(primType)); + double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX + double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. switch (primType) { case ScriptBaseClass.PRIM_TYPE_BOX: @@ -7431,7 +7441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); - res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); + res.Add(new LSL_Vector(topshearx, topsheary, 0)); break; case ScriptBaseClass.PRIM_TYPE_SPHERE: @@ -7466,7 +7476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); // vector topshear - res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); + res.Add(new LSL_Vector(topshearx, topsheary, 0)); // vector profilecut res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); @@ -7475,8 +7485,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); // float revolutions - res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( - + res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned + // byte is being used to represent the entire + // range of floating-point values from 1.0 + // through 4.0 (which is how SL does it). + // float radiusoffset res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); -- cgit v1.1 From e530180c1e8e9758df7cb9a72ad0715fd7c8a0e7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 00:26:12 +0000 Subject: Glue code for a couple of new LSL function implementations --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 79b2391..cf3a1a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2724,7 +2724,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopLookAt() { m_host.AddScriptLPS(1); - NotImplemented("llStopLookAt"); +// NotImplemented("llStopLookAt"); + m_host.StopLookAt(); } public void llSetTimerEvent(double sec) @@ -3071,7 +3072,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRotLookAt(LSL_Rotation target, double strength, double damping) { m_host.AddScriptLPS(1); - NotImplemented("llRotLookAt"); +// NotImplemented("llRotLookAt"); + m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); } public LSL_Integer llStringLength(string str) -- cgit v1.1 From 1876ce90af98722a205d1c7181ef66b6a2b54fc5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 09:24:01 +0000 Subject: FINALLY! Script compile errors now appear in the script error pane, not in a funky debug window. --- OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 2 +- .../Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index e427f50..b1fb6c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -111,7 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (emessage.StartsWith(slinfo+": ")) emessage = emessage.Substring(slinfo.Length+2); - message = String.Format("Line ({0},{1}) {2}", + message = String.Format("({0},{1}) {2}", e.slInfo.lineNumber - 2, e.slInfo.charPosition - 1, emessage); diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 3080c71..d8c0ba5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -623,7 +623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // The Second Life viewer's script editor begins // countingn lines and columns at 0, so we subtract 1. - errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", + errtext += String.Format("({0},{1}): {4} {2}: {3}\n", lslPos.Key - 1, lslPos.Value - 1, CompErr.ErrorNumber, text, severity); hadErrors = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 3ca7f7c..63afb0b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -1673,7 +1673,7 @@ default { // The syntax error is on line 6, char 5 (expected ';', found // '}'). - Assert.AreEqual("Line (4,4) syntax error", e.Message); + Assert.AreEqual("(4,4) syntax error", e.Message); throw; } } @@ -1698,7 +1698,7 @@ default catch (System.Exception e) { // The syntax error is on line 5, char 14 (Syntax error) - Assert.AreEqual("Line (3,13) syntax error", e.Message); + Assert.AreEqual("(3,13) syntax error", e.Message); throw; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5c5d57e..d30d2dc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -967,7 +967,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (col == 0) col++; message = string.Format("Runtime error:\n" + - "Line ({0}): {1}", scriptLine - 1, + "({0}): {1}", scriptLine - 1, e.InnerException.Message); System.Console.WriteLine(e.ToString()+"\n"); -- cgit v1.1