From c6c91e6599de6d4402ec0258da03cc975147da90 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 00:13:08 +0100 Subject: refactor: Fold most SOP.ScriptSet* methods back into script code. Simplify. --- .../Shared/Api/Implementation/LSL_Api.cs | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 26969a5..7c21ba9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) { - if (value != 0) - m_host.ScriptSetPhantomStatus(true); - else - m_host.ScriptSetPhantomStatus(false); + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); } if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) @@ -6446,9 +6444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { if (!m_host.ParentGroup.IsDeleted) - { - m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0); - } + m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); } } @@ -6456,7 +6452,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// This is a depecated function so this just replicates the result of /// invoking it in SL /// - public void llRemoteLoadScript(string target, string name, int running, int start_param) { m_host.AddScriptLPS(1); @@ -7254,14 +7249,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; string ph = rules.Data[idx++].ToString(); - bool phantom; - if (ph.Equals("1")) - phantom = true; - else - phantom = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); - part.ScriptSetPhantomStatus(phantom); break; case (int)ScriptBaseClass.PRIM_PHYSICS: @@ -7282,14 +7273,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; string temp = rules.Data[idx++].ToString(); - bool tempOnRez; - if (temp.Equals("1")) - tempOnRez = true; - else - tempOnRez = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); - part.ScriptSetTemporaryStatus(tempOnRez); break; case (int)ScriptBaseClass.PRIM_TEXGEN: -- cgit v1.1 From e869eeb0bfc48c769f680970f99e4c67dd5a1a70 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 03:51:34 +0100 Subject: Implement first draft functions for saving and loading NPC appearance from storage. This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent. By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type. Notecards also allow different appearances to be swapped and manipulated easily. This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text. This works in my basic test but is not at all ready for user use or bug reporting yet. --- .../Shared/Api/Implementation/LSL_Api.cs | 33 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c21ba9..86ee28a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10565,9 +10565,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public static string GetLine(UUID assetID, int line, int maxLength) + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// + public static string GetLine(UUID assetID, int lineNumber) { - if (line < 0) + if (lineNumber < 0) return ""; string data; @@ -10579,17 +10585,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_Notecards[assetID].lastRef = DateTime.Now; - if (line >= m_Notecards[assetID].text.Length) + if (lineNumber >= m_Notecards[assetID].text.Length) return "\n\n\n"; - data = m_Notecards[assetID].text[line]; - if (data.Length > maxLength) - data = data.Substring(0, maxLength); + data = m_Notecards[assetID].text[lineNumber]; return data; } } + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// Maximum length of the returned line. Longer lines will be truncated + /// + public static string GetLine(UUID assetID, int lineNumber, int maxLength) + { + string line = GetLine(assetID, lineNumber); + + if (line.Length > maxLength) + line = line.Substring(0, maxLength); + + return line; + } + public static void CacheCheck() { foreach (UUID key in new List(m_Notecards.Keys)) -- cgit v1.1 From a21e98ae1a3e2f570cc119e020d4d4ea111e0ad2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 23:28:14 +0100 Subject: implement osNpcGetRot() and osNpcSetRot() Rotation works if done around the z axis. Anything else leads to random results. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 86ee28a..8a281d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // convert a LSL_Rotation to a Quaternion - protected Quaternion Rot2Quaternion(LSL_Rotation r) + public static Quaternion Rot2Quaternion(LSL_Rotation r) { Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); q.Normalize(); @@ -2061,6 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return llGetRootRotation(); } + m_host.AddScriptLPS(1); Quaternion q = m_host.GetWorldRotation(); return new LSL_Rotation(q.X, q.Y, q.Z, q.W); -- cgit v1.1 From b80dfb6572438cb583e95884c0f607342f0c88d4 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Fri, 12 Aug 2011 21:09:01 -0500 Subject: llGetPrimitiveParams fix prim hollow/hole shape value --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8a281d4..c84afee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7650,7 +7650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_BOX: case ScriptBaseClass.PRIM_TYPE_CYLINDER: case ScriptBaseClass.PRIM_TYPE_PRISM: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7659,7 +7659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case ScriptBaseClass.PRIM_TYPE_SPHERE: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7675,7 +7675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_TUBE: case ScriptBaseClass.PRIM_TYPE_TORUS: // holeshape - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. // cut res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); -- cgit v1.1