diff options
author | Melanie | 2012-08-25 23:36:33 +0100 |
---|---|---|
committer | Melanie | 2012-08-25 23:36:33 +0100 |
commit | d76ff560d4eae4035f959731fb1da9b5185fa9ec (patch) | |
tree | b37cebde4afde373ec96b782be6256fb17150421 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Minor formatting cleanup (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-d76ff560d4eae4035f959731fb1da9b5185fa9ec.zip opensim-SC-d76ff560d4eae4035f959731fb1da9b5185fa9ec.tar.gz opensim-SC-d76ff560d4eae4035f959731fb1da9b5185fa9ec.tar.bz2 opensim-SC-d76ff560d4eae4035f959731fb1da9b5185fa9ec.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 110 |
1 files changed, 70 insertions, 40 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ed3c2a4..5316d08 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8639,7 +8639,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8639 | 8639 | ||
8640 | LSL_List result = new LSL_List(); | 8640 | LSL_List result = new LSL_List(); |
8641 | 8641 | ||
8642 | GetPrimParams(m_host, rules, ref result); | 8642 | LSL_List remaining = GetPrimParams(m_host, rules, ref result); |
8643 | |||
8644 | while (remaining != null && remaining.Length > 2) | ||
8645 | { | ||
8646 | int linknumber = remaining.GetLSLIntegerItem(0); | ||
8647 | rules = remaining.GetSublist(1, -1); | ||
8648 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
8649 | |||
8650 | foreach (SceneObjectPart part in parts) | ||
8651 | remaining = GetPrimParams(part, rules, ref result); | ||
8652 | } | ||
8643 | 8653 | ||
8644 | return result; | 8654 | return result; |
8645 | } | 8655 | } |
@@ -8651,30 +8661,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8651 | // acording to SL wiki this must indicate a single link number or link_root or link_this. | 8661 | // acording to SL wiki this must indicate a single link number or link_root or link_this. |
8652 | // keep other options as before | 8662 | // keep other options as before |
8653 | 8663 | ||
8654 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 8664 | List<SceneObjectPart> parts; |
8655 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | 8665 | List<ScenePresence> avatars; |
8656 | 8666 | ||
8657 | LSL_List res = new LSL_List(); | 8667 | LSL_List res = new LSL_List(); |
8668 | LSL_List remaining = null; | ||
8658 | 8669 | ||
8659 | if (parts.Count > 0) | 8670 | while (rules.Length > 0) |
8660 | { | 8671 | { |
8661 | foreach (var part in parts) | 8672 | parts = GetLinkParts(linknumber); |
8673 | avatars = GetLinkAvatars(linknumber); | ||
8674 | |||
8675 | remaining = null; | ||
8676 | foreach (SceneObjectPart part in parts) | ||
8662 | { | 8677 | { |
8663 | GetPrimParams(part, rules, ref res); | 8678 | remaining = GetPrimParams(part, rules, ref res); |
8664 | } | 8679 | } |
8665 | } | ||
8666 | if (avatars.Count > 0) | ||
8667 | { | ||
8668 | foreach (ScenePresence avatar in avatars) | 8680 | foreach (ScenePresence avatar in avatars) |
8669 | { | 8681 | { |
8670 | GetPrimParams(avatar, rules, ref res); | 8682 | remaining = GetPrimParams(avatar, rules, ref res); |
8683 | } | ||
8684 | |||
8685 | if (remaining != null && remaining.Length > 0) | ||
8686 | { | ||
8687 | linknumber = remaining.GetLSLIntegerItem(0); | ||
8688 | rules = remaining.GetSublist(1, -1); | ||
8671 | } | 8689 | } |
8672 | // TODO: FINISH MERGE | ||
8673 | } | 8690 | } |
8691 | |||
8674 | return res; | 8692 | return res; |
8675 | } | 8693 | } |
8676 | 8694 | ||
8677 | public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) | 8695 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) |
8678 | { | 8696 | { |
8679 | int idx=0; | 8697 | int idx=0; |
8680 | while (idx < rules.Length) | 8698 | while (idx < rules.Length) |
@@ -8813,7 +8831,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8813 | 8831 | ||
8814 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 8832 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
8815 | if (remain < 1) | 8833 | if (remain < 1) |
8816 | return; | 8834 | return null; |
8817 | 8835 | ||
8818 | int face = (int)rules.GetLSLIntegerItem(idx++); | 8836 | int face = (int)rules.GetLSLIntegerItem(idx++); |
8819 | Primitive.TextureEntry tex = part.Shape.Textures; | 8837 | Primitive.TextureEntry tex = part.Shape.Textures; |
@@ -8853,7 +8871,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8853 | 8871 | ||
8854 | case (int)ScriptBaseClass.PRIM_COLOR: | 8872 | case (int)ScriptBaseClass.PRIM_COLOR: |
8855 | if (remain < 1) | 8873 | if (remain < 1) |
8856 | return; | 8874 | return null; |
8857 | 8875 | ||
8858 | face=(int)rules.GetLSLIntegerItem(idx++); | 8876 | face=(int)rules.GetLSLIntegerItem(idx++); |
8859 | 8877 | ||
@@ -8882,7 +8900,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8882 | 8900 | ||
8883 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8901 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
8884 | if (remain < 1) | 8902 | if (remain < 1) |
8885 | return; | 8903 | return null; |
8904 | |||
8886 | face = (int)rules.GetLSLIntegerItem(idx++); | 8905 | face = (int)rules.GetLSLIntegerItem(idx++); |
8887 | 8906 | ||
8888 | tex = part.Shape.Textures; | 8907 | tex = part.Shape.Textures; |
@@ -8938,7 +8957,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8938 | 8957 | ||
8939 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 8958 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
8940 | if (remain < 1) | 8959 | if (remain < 1) |
8941 | return; | 8960 | return null; |
8961 | |||
8942 | face = (int)rules.GetLSLIntegerItem(idx++); | 8962 | face = (int)rules.GetLSLIntegerItem(idx++); |
8943 | 8963 | ||
8944 | tex = part.Shape.Textures; | 8964 | tex = part.Shape.Textures; |
@@ -8992,7 +9012,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8992 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 9012 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
8993 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | 9013 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) |
8994 | if (remain < 1) | 9014 | if (remain < 1) |
8995 | return; | 9015 | return null; |
9016 | |||
8996 | face = (int)rules.GetLSLIntegerItem(idx++); | 9017 | face = (int)rules.GetLSLIntegerItem(idx++); |
8997 | 9018 | ||
8998 | tex = part.Shape.Textures; | 9019 | tex = part.Shape.Textures; |
@@ -9040,7 +9061,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9040 | 9061 | ||
9041 | case (int)ScriptBaseClass.PRIM_GLOW: | 9062 | case (int)ScriptBaseClass.PRIM_GLOW: |
9042 | if (remain < 1) | 9063 | if (remain < 1) |
9043 | return; | 9064 | return null; |
9065 | |||
9044 | face = (int)rules.GetLSLIntegerItem(idx++); | 9066 | face = (int)rules.GetLSLIntegerItem(idx++); |
9045 | 9067 | ||
9046 | tex = part.Shape.Textures; | 9068 | tex = part.Shape.Textures; |
@@ -9084,14 +9106,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9084 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9106 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
9085 | res.Add(new LSL_Vector(GetPartLocalPos(part))); | 9107 | res.Add(new LSL_Vector(GetPartLocalPos(part))); |
9086 | break; | 9108 | break; |
9087 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9088 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9089 | return; | ||
9090 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
9091 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
9092 | LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | ||
9093 | res += tres; | ||
9094 | return; | ||
9095 | case (int)ScriptBaseClass.PRIM_SLICE: | 9109 | case (int)ScriptBaseClass.PRIM_SLICE: |
9096 | PrimType prim_type = part.GetPrimType(); | 9110 | PrimType prim_type = part.GetPrimType(); |
9097 | bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); | 9111 | bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); |
@@ -9101,8 +9115,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9101 | 0 | 9115 | 0 |
9102 | )); | 9116 | )); |
9103 | break; | 9117 | break; |
9118 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
9119 | if(remain < 3) | ||
9120 | return null; | ||
9121 | |||
9122 | return rules.GetSublist(idx, -1); | ||
9104 | } | 9123 | } |
9105 | } | 9124 | } |
9125 | |||
9126 | return null; | ||
9106 | } | 9127 | } |
9107 | 9128 | ||
9108 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) | 9129 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) |
@@ -11668,7 +11689,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11668 | 11689 | ||
11669 | if (obj != null && obj.OwnerID != m_host.OwnerID) | 11690 | if (obj != null && obj.OwnerID != m_host.OwnerID) |
11670 | { | 11691 | { |
11671 | GetPrimParams(obj, rules, ref result); | 11692 | LSL_List remaining = GetPrimParams(obj, rules, ref result); |
11693 | |||
11694 | while (remaining != null && remaining.Length > 2) | ||
11695 | { | ||
11696 | int linknumber = remaining.GetLSLIntegerItem(0); | ||
11697 | rules = remaining.GetSublist(1, -1); | ||
11698 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
11699 | |||
11700 | foreach (SceneObjectPart part in parts) | ||
11701 | remaining = GetPrimParams(part, rules, ref result); | ||
11702 | } | ||
11672 | } | 11703 | } |
11673 | 11704 | ||
11674 | return result; | 11705 | return result; |
@@ -12792,7 +12823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12792 | return null; | 12823 | return null; |
12793 | } | 12824 | } |
12794 | 12825 | ||
12795 | public void GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) | 12826 | public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) |
12796 | { | 12827 | { |
12797 | // avatars case | 12828 | // avatars case |
12798 | // replies as SL wiki | 12829 | // replies as SL wiki |
@@ -12864,7 +12895,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12864 | 12895 | ||
12865 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 12896 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
12866 | if (remain < 1) | 12897 | if (remain < 1) |
12867 | return; | 12898 | return null; |
12868 | 12899 | ||
12869 | int face = (int)rules.GetLSLIntegerItem(idx++); | 12900 | int face = (int)rules.GetLSLIntegerItem(idx++); |
12870 | if (face == ScriptBaseClass.ALL_SIDES) | 12901 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -12891,7 +12922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12891 | 12922 | ||
12892 | case (int)ScriptBaseClass.PRIM_COLOR: | 12923 | case (int)ScriptBaseClass.PRIM_COLOR: |
12893 | if (remain < 1) | 12924 | if (remain < 1) |
12894 | return; | 12925 | return null; |
12895 | 12926 | ||
12896 | face = (int)rules.GetLSLIntegerItem(idx++); | 12927 | face = (int)rules.GetLSLIntegerItem(idx++); |
12897 | 12928 | ||
@@ -12912,7 +12943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12912 | 12943 | ||
12913 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 12944 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
12914 | if (remain < 1) | 12945 | if (remain < 1) |
12915 | return; | 12946 | return null; |
12916 | face = (int)rules.GetLSLIntegerItem(idx++); | 12947 | face = (int)rules.GetLSLIntegerItem(idx++); |
12917 | 12948 | ||
12918 | if (face == ScriptBaseClass.ALL_SIDES) | 12949 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -12932,7 +12963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12932 | 12963 | ||
12933 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 12964 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
12934 | if (remain < 1) | 12965 | if (remain < 1) |
12935 | return; | 12966 | return null; |
12936 | face = (int)rules.GetLSLIntegerItem(idx++); | 12967 | face = (int)rules.GetLSLIntegerItem(idx++); |
12937 | 12968 | ||
12938 | if (face == ScriptBaseClass.ALL_SIDES) | 12969 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -12961,7 +12992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12961 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 12992 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
12962 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) | 12993 | // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) |
12963 | if (remain < 1) | 12994 | if (remain < 1) |
12964 | return; | 12995 | return null; |
12965 | face = (int)rules.GetLSLIntegerItem(idx++); | 12996 | face = (int)rules.GetLSLIntegerItem(idx++); |
12966 | 12997 | ||
12967 | if (face == ScriptBaseClass.ALL_SIDES) | 12998 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -12987,7 +13018,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12987 | 13018 | ||
12988 | case (int)ScriptBaseClass.PRIM_GLOW: | 13019 | case (int)ScriptBaseClass.PRIM_GLOW: |
12989 | if (remain < 1) | 13020 | if (remain < 1) |
12990 | return; | 13021 | return null; |
12991 | face = (int)rules.GetLSLIntegerItem(idx++); | 13022 | face = (int)rules.GetLSLIntegerItem(idx++); |
12992 | 13023 | ||
12993 | if (face == ScriptBaseClass.ALL_SIDES) | 13024 | if (face == ScriptBaseClass.ALL_SIDES) |
@@ -13041,14 +13072,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13041 | 13072 | ||
13042 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 13073 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
13043 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 13074 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
13044 | return; | 13075 | return null; |
13045 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
13046 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
13047 | 13076 | ||
13048 | res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); | 13077 | return rules.GetSublist(idx, -1); |
13049 | return; | ||
13050 | } | 13078 | } |
13051 | } | 13079 | } |
13080 | |||
13081 | return null; | ||
13052 | } | 13082 | } |
13053 | } | 13083 | } |
13054 | 13084 | ||