From 3d504261b0e189f8111912a3fff9d45579c04eed Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:35:59 +0100 Subject: renaming to be similar to equivalent Set command --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +++++----- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2bfb9b3..c706f48 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetLinkPrimitiveParams(m_host, rules); + return GetPrimParams(m_host, rules); } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,14 +7923,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (var part in parts) { - LSL_List partRes = GetLinkPrimitiveParams(part, rules); + LSL_List partRes = GetPrimParams(part, rules); res += partRes; } return res; } - public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) { LSL_List res = new LSL_List(); int idx=0; @@ -10752,7 +10752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); if (obj == null) @@ -10761,7 +10761,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return new LSL_List(); - return GetLinkPrimitiveParams(obj, rules); + return GetPrimParams(obj, rules); } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d9..c277708 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules); + retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); } return retVal; } @@ -2965,7 +2965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) -- cgit v1.1 From a8044999fb056de0a815093953f82b33d540dd6f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:41:43 +0100 Subject: use SceneObjectPart instead of var --- 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') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c706f48..03b5982 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5828,7 +5828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); } @@ -6190,7 +6190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetParticleSystem(part, rules); } @@ -7921,7 +7921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List res = new LSL_List(); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { LSL_List partRes = GetPrimParams(part, rules); res += partRes; -- cgit v1.1 From 2a2e120470ea530ea0a6f035c5cf28247f94532c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:02:13 +0100 Subject: since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param --- .../Shared/Api/Implementation/LSL_Api.cs | 38 ++++++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 03b5982..6e46992 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetPrimParams(m_host, rules); + + LSL_List result = new LSL_List(); + + GetPrimParams(m_host, rules, ref result); + + return result; } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,16 +7928,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) { - LSL_List partRes = GetPrimParams(part, rules); - res += partRes; + GetPrimParams(part, rules, ref res); } return res; } - public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) + public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { - LSL_List res = new LSL_List(); int idx=0; while (idx < rules.Length) { @@ -8077,7 +8080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return res; + return; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8117,7 +8120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8146,7 +8149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8177,7 +8180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8219,7 +8222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8260,7 +8263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8314,7 +8317,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } - return res; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10755,13 +10757,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); - if (obj == null) - return new LSL_List(); - if (obj.OwnerID != m_host.OwnerID) - return new LSL_List(); + LSL_List result = new LSL_List(); - return GetPrimParams(obj, rules); + if (obj != null && obj.OwnerID != m_host.OwnerID) + { + GetPrimParams(obj, rules, ref result); + } + + return result; } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c277708..a391b73 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); + ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 5203665bb2d68c6a4e0ea3180334b607db6ab1ce Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:25:37 +0100 Subject: refactoring to local variable for cleaner code --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a391b73..927f37c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2246,11 +2246,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); m_host.AddScriptLPS(1); InitLSL(); + // One needs to cast m_LSL_Api because we're using functions not + // on the ILSL_Api interface. + LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); - List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); + List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); + LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 58714b0aca71ce026226c6f76753905877792caf Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:28 +0100 Subject: minor formatting --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e46992..0f0eac6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7238,10 +7238,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) remaining = SetPrimParams(part, rules); - while(remaining != null && remaining.Length > 2) + while (remaining != null && remaining.Length > 2) { linknumber = remaining.GetLSLIntegerItem(0); - rules = remaining.GetSublist(1,-1); + rules = remaining.GetSublist(1, -1); parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) -- cgit v1.1 From 6e86b230120776a7da4727dd1aedeca6b91e3169 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:39 +0100 Subject: implementing PRIM_LINK_TARGET on GetPrimParams ala SetPrimParams --- .../Shared/Api/Implementation/LSL_Api.cs | 58 ++++++++++++++++++---- .../Shared/Api/Implementation/OSSL_Api.cs | 13 ++++- 2 files changed, 60 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0f0eac6..b001c51 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7913,7 +7913,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List result = new LSL_List(); - GetPrimParams(m_host, rules, ref result); + LSL_List remaining = GetPrimParams(m_host, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } return result; } @@ -7925,16 +7935,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); LSL_List res = new LSL_List(); + LSL_List remaining = null; foreach (SceneObjectPart part in parts) { - GetPrimParams(part, rules, ref res); + remaining = GetPrimParams(part, rules, ref res); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref res); } return res; } - public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { int idx=0; while (idx < rules.Length) @@ -8080,7 +8101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return; + return null; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8120,7 +8141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8149,7 +8170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8180,7 +8201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8222,7 +8243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8263,7 +8284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8315,8 +8336,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api 0 )); break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: + if(remain < 3) + return null; + + return rules.GetSublist(idx, -1); } } + + return null; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10762,7 +10790,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj != null && obj.OwnerID != m_host.OwnerID) { - GetPrimParams(obj, rules, ref result); + LSL_List remaining = GetPrimParams(obj, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } } return result; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 927f37c..1afa4fb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,10 +2250,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // on the ILSL_Api interface. LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); + LSL_List remaining = null; List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - LSL_Api.GetPrimParams(part, rules, ref retVal); + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = LSL_Api.GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1