From c0bc25059c932bbef41b2fbe2f319163407aed1b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Mar 2010 00:56:55 -0600 Subject: - implementing server 1.38 functions Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++ .../Shared/Api/Implementation/LSL_Api.cs | 99 +++++++++++++++++++--- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 4 + .../Shared/Api/Runtime/LSL_Constants.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 20 +++++ 5 files changed, 119 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 10a186e..4729382 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4707,5 +4707,10 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error("[Physics] " + ex); } } + + public Color4 GetTextColor() + { + return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dc4249c..f1241a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5406,12 +5406,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_host.AddScriptLPS(1); + + SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate); + } + + public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate) + { + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + foreach (var part in parts) + { + SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); + } + } + + private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate) + { + Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); pTexAnim.Flags = (Primitive.TextureAnimMode)mode; //ALL_SIDES if (face == ScriptBaseClass.ALL_SIDES) - face = 255; + face = 255; pTexAnim.Face = (uint)face; pTexAnim.Length = (float)length; @@ -5420,9 +5439,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api pTexAnim.SizeY = (uint)sizey; pTexAnim.Start = (float)start; - m_host.AddTextureAnimation(pTexAnim); - m_host.SendFullUpdateToAllClients(); - m_host.ParentGroup.HasGroupChanged = true; + part.AddTextureAnimation(pTexAnim); + part.SendFullUpdateToAllClients(); + part.ParentGroup.HasGroupChanged = true; } public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, @@ -5819,13 +5838,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ps; } + public void llLinkParticleSystem(int linknumber, LSL_List rules) + { + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + foreach (var part in parts) + { + SetParticleSystem(part, rules); + } + } + public void llParticleSystem(LSL_List rules) { m_host.AddScriptLPS(1); + SetParticleSystem(m_host, rules); + } + + private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { + + if (rules.Length == 0) { - m_host.RemoveParticleSystem(); - m_host.ParentGroup.HasGroupChanged = true; + part.RemoveParticleSystem(); + part.ParentGroup.HasGroupChanged = true; } else { @@ -5936,7 +5973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - prules.Target = m_host.UUID; + prules.Target = part.UUID; } break; @@ -5962,10 +5999,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } prules.CRC = 1; - m_host.AddNewParticleSystem(prules); - m_host.ParentGroup.HasGroupChanged = true; + part.AddNewParticleSystem(prules); + part.ParentGroup.HasGroupChanged = true; } - m_host.SendFullUpdateToAllClients(); + part.SendFullUpdateToAllClients(); } public void llGroundRepel(double height, int water, double tau) @@ -6759,6 +6796,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPrimParams(part, rules); } + public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) + { + llSetLinkPrimitiveParams(linknumber, rules); + } + protected void SetPrimParams(SceneObjectPart part, LSL_List rules) { int idx = 0; @@ -7115,6 +7157,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int style = rules.GetLSLIntegerItem(idx++); SetTexGen(part, face, style); break; + case (int)ScriptBaseClass.PRIM_TEXT: + if (remain < 3) + return; + string primText = rules.GetLSLStringItem(idx++); + LSL_Vector primTextColor = rules.GetVector3Item(idx++); + LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); + Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), + Util.Clip((float)primTextColor.y, 0.0f, 1.0f), + Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); + part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); + + break; } } } @@ -7358,6 +7412,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return GetLinkPrimitiveParams(m_host, rules); } + public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) + { + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + LSL_List res = new LSL_List(); + + foreach (var part in parts) + { + LSL_List partRes = GetLinkPrimitiveParams(part, rules); + res += partRes; + } + + return res; + } + public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) { LSL_List res = new LSL_List(); @@ -7635,6 +7706,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Float(0)); break; + case (int)ScriptBaseClass.PRIM_TEXT: + Color4 textColor = part.GetTextColor(); + res.Add(part.Text); + res.Add(new LSL_Vector(textColor.R, + textColor.G, + textColor.B)); + res.Add(new LSL_Float(textColor.A)); + break; } } return res; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index a74e8da..7ab04a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key llGetLinkKey(int linknum); LSL_String llGetLinkName(int linknum); LSL_Integer llGetLinkNumber(); + LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListLength(LSL_List src); LSL_Vector llGetLocalPos(); @@ -206,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llInstantMessage(string user, string message); LSL_String llIntegerToBase64(int number); LSL_String llKey2Name(string id); + void llLinkParticleSystem(int linknum, LSL_List rules); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); LSL_Integer llList2Integer(LSL_List src, int index); @@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetLinkColor(int linknumber, LSL_Vector color, int face); void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); void llSetLinkTexture(int linknumber, string texture, int face); + void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); void llSetLocalRot(LSL_Rotation rot); void llSetObjectDesc(string desc); void llSetObjectName(string name); @@ -330,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetPayPrice(int price, LSL_List quick_pay_buttons); void llSetPos(LSL_Vector pos); void llSetPrimitiveParams(LSL_List rules); + void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); void llSetPrimURL(string url); void llSetRemoteScriptAccessPin(int pin); void llSetRot(LSL_Rotation rot); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 7cf82b2..ee35fa4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -313,6 +313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake public const int PRIM_POINT_LIGHT = 23; // Huh? public const int PRIM_GLOW = 25; + public const int PRIM_TEXT = 26; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index a28e97b..3339995 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -674,6 +674,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetPrimitiveParams(rules); } + public LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules) + { + return m_LSL_Functions.llGetLinkPrimitiveParams(linknum, rules); + } + public LSL_Integer llGetRegionAgentCount() { return m_LSL_Functions.llGetRegionAgentCount(); @@ -889,6 +894,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llKey2Name(id); } + public void llLinkParticleSystem(int linknum, LSL_List rules) + { + m_LSL_Functions.llLinkParticleSystem(linknum, rules); + } + public LSL_String llList2CSV(LSL_List src) { return m_LSL_Functions.llList2CSV(src); @@ -1468,6 +1478,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSetLinkTexture(linknumber, texture, face); } + public void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate) + { + m_LSL_Functions.llSetLinkTextureAnim(linknum, mode, face, sizex, sizey, start, length, rate); + } + public void llSetLocalRot(LSL_Rotation rot) { m_LSL_Functions.llSetLocalRot(rot); @@ -1508,6 +1523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSetPrimitiveParams(rules); } + public void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules) + { + m_LSL_Functions.llSetLinkPrimitiveParamsFast(linknum, rules); + } + public void llSetPrimURL(string url) { m_LSL_Functions.llSetPrimURL(url); -- cgit v1.1