diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 224 |
1 files changed, 194 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aab41f5..bf84b16 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5924,8 +5924,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5924 | } | 5924 | } |
5925 | else | 5925 | else |
5926 | { | 5926 | { |
5927 | agentSize = new LSL_Vector(0.45, 0.6, avatar.Appearance.AvatarHeight); | 5927 | agentSize = GetAgentSize(avatar); |
5928 | } | 5928 | } |
5929 | |||
5929 | return agentSize; | 5930 | return agentSize; |
5930 | } | 5931 | } |
5931 | 5932 | ||
@@ -7949,61 +7950,224 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7949 | return new LSL_Vector(m_host.GetGeometricCenter()); | 7950 | return new LSL_Vector(m_host.GetGeometricCenter()); |
7950 | } | 7951 | } |
7951 | 7952 | ||
7952 | public LSL_List llGetPrimitiveParams(LSL_List rules) | 7953 | public LSL_List GetEntityParams(ISceneEntity entity, LSL_List rules) |
7953 | { | 7954 | { |
7954 | m_host.AddScriptLPS(1); | ||
7955 | |||
7956 | LSL_List result = new LSL_List(); | 7955 | LSL_List result = new LSL_List(); |
7956 | LSL_List remaining = null; | ||
7957 | 7957 | ||
7958 | LSL_List remaining = GetPrimParams(m_host, rules, ref result); | 7958 | while (true) |
7959 | { | ||
7960 | if (entity is SceneObjectPart) | ||
7961 | remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result); | ||
7962 | else | ||
7963 | remaining = GetAgentParams((ScenePresence)entity, rules, ref result); | ||
7964 | |||
7965 | if (remaining == null || remaining.Length <= 2) | ||
7966 | return result; | ||
7959 | 7967 | ||
7960 | while (remaining != null && remaining.Length > 2) | ||
7961 | { | ||
7962 | int linknumber = remaining.GetLSLIntegerItem(0); | 7968 | int linknumber = remaining.GetLSLIntegerItem(0); |
7963 | rules = remaining.GetSublist(1, -1); | 7969 | rules = remaining.GetSublist(1, -1); |
7964 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7970 | entity = GetLinkEntity(linknumber); |
7965 | |||
7966 | foreach (SceneObjectPart part in parts) | ||
7967 | remaining = GetPrimParams(part, rules, ref result); | ||
7968 | } | 7971 | } |
7972 | } | ||
7969 | 7973 | ||
7970 | return result; | 7974 | public LSL_List llGetPrimitiveParams(LSL_List rules) |
7975 | { | ||
7976 | m_host.AddScriptLPS(1); | ||
7977 | |||
7978 | return GetEntityParams(m_host, rules); | ||
7971 | } | 7979 | } |
7972 | 7980 | ||
7973 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) | 7981 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) |
7974 | { | 7982 | { |
7975 | m_host.AddScriptLPS(1); | 7983 | m_host.AddScriptLPS(1); |
7976 | 7984 | ||
7977 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7985 | return GetEntityParams(GetLinkEntity(linknumber), rules); |
7986 | } | ||
7978 | 7987 | ||
7979 | LSL_List res = new LSL_List(); | 7988 | public LSL_Vector GetAgentSize(ScenePresence sp) |
7980 | LSL_List remaining = null; | 7989 | { |
7990 | return new LSL_Vector(0.45, 0.6, sp.Appearance.AvatarHeight); | ||
7991 | } | ||
7981 | 7992 | ||
7982 | foreach (SceneObjectPart part in parts) | 7993 | /// <summary> |
7994 | /// Gets params for a seated avatar in a linkset. | ||
7995 | /// </summary> | ||
7996 | /// <returns></returns> | ||
7997 | /// <param name='sp'></param> | ||
7998 | /// <param name='rules'></param> | ||
7999 | /// <param name='res'></param> | ||
8000 | public LSL_List GetAgentParams(ScenePresence sp, LSL_List rules, ref LSL_List res) | ||
8001 | { | ||
8002 | int idx = 0; | ||
8003 | while (idx < rules.Length) | ||
7983 | { | 8004 | { |
7984 | remaining = GetPrimParams(part, rules, ref res); | 8005 | int code = (int)rules.GetLSLIntegerItem(idx++); |
7985 | } | 8006 | int remain = rules.Length-idx; |
7986 | 8007 | ||
7987 | while (remaining != null && remaining.Length > 2) | 8008 | switch (code) |
7988 | { | 8009 | { |
7989 | linknumber = remaining.GetLSLIntegerItem(0); | 8010 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
7990 | rules = remaining.GetSublist(1, -1); | 8011 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH)); |
7991 | parts = GetLinkParts(linknumber); | 8012 | break; |
7992 | 8013 | ||
7993 | foreach (SceneObjectPart part in parts) | 8014 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
7994 | remaining = GetPrimParams(part, rules, ref res); | 8015 | res.Add(ScriptBaseClass.FALSE); |
8016 | break; | ||
8017 | |||
8018 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | ||
8019 | res.Add(ScriptBaseClass.FALSE); | ||
8020 | break; | ||
8021 | |||
8022 | case (int)ScriptBaseClass.PRIM_PHANTOM: | ||
8023 | res.Add(ScriptBaseClass.FALSE); | ||
8024 | break; | ||
8025 | |||
8026 | case (int)ScriptBaseClass.PRIM_POSITION: | ||
8027 | res.Add(new LSL_Vector(sp.AbsolutePosition)); | ||
8028 | break; | ||
8029 | |||
8030 | case (int)ScriptBaseClass.PRIM_SIZE: | ||
8031 | res.Add(GetAgentSize(sp)); | ||
8032 | break; | ||
8033 | |||
8034 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
8035 | res.Add(sp.GetWorldRotation()); | ||
8036 | break; | ||
8037 | |||
8038 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
8039 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); | ||
8040 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); | ||
8041 | res.Add(new LSL_Vector(0, 1, 0)); | ||
8042 | res.Add(new LSL_Float(0)); | ||
8043 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8044 | res.Add(new LSL_Vector(1, 1, 0)); | ||
8045 | res.Add(new LSL_Vector(0, 0, 0)); | ||
8046 | break; | ||
8047 | |||
8048 | case (int)ScriptBaseClass.PRIM_TEXTURE: | ||
8049 | if (remain < 1) | ||
8050 | return null; | ||
8051 | |||
8052 | int face = (int)rules.GetLSLIntegerItem(idx++); | ||
8053 | if (face > 21) | ||
8054 | break; | ||
8055 | |||
8056 | res.Add(new LSL_String("")); | ||
8057 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8058 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8059 | res.Add(new LSL_Float(0)); | ||
8060 | break; | ||
8061 | |||
8062 | case (int)ScriptBaseClass.PRIM_COLOR: | ||
8063 | if (remain < 1) | ||
8064 | return null; | ||
8065 | |||
8066 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8067 | if (face > 21) | ||
8068 | break; | ||
8069 | |||
8070 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8071 | res.Add(new LSL_Float(0)); | ||
8072 | break; | ||
8073 | |||
8074 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | ||
8075 | if (remain < 1) | ||
8076 | return null; | ||
8077 | |||
8078 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8079 | if (face > 21) | ||
8080 | break; | ||
8081 | |||
8082 | res.Add(ScriptBaseClass.PRIM_SHINY_NONE); | ||
8083 | res.Add(ScriptBaseClass.PRIM_BUMP_NONE); | ||
8084 | break; | ||
8085 | |||
8086 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | ||
8087 | if (remain < 1) | ||
8088 | return null; | ||
8089 | |||
8090 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8091 | if (face > 21) | ||
8092 | break; | ||
8093 | |||
8094 | res.Add(ScriptBaseClass.FALSE); | ||
8095 | break; | ||
8096 | |||
8097 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | ||
8098 | res.Add(ScriptBaseClass.FALSE); | ||
8099 | res.Add(new LSL_Integer(0)); | ||
8100 | res.Add(new LSL_Float(0)); | ||
8101 | res.Add(new LSL_Float(0)); | ||
8102 | res.Add(new LSL_Float(0)); | ||
8103 | res.Add(new LSL_Float(0)); | ||
8104 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8105 | break; | ||
8106 | |||
8107 | case (int)ScriptBaseClass.PRIM_TEXGEN: | ||
8108 | if (remain < 1) | ||
8109 | return null; | ||
8110 | |||
8111 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8112 | if (face > 21) | ||
8113 | break; | ||
8114 | |||
8115 | res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT); | ||
8116 | break; | ||
8117 | |||
8118 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | ||
8119 | res.Add(ScriptBaseClass.FALSE); | ||
8120 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8121 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8122 | break; | ||
8123 | |||
8124 | case (int)ScriptBaseClass.PRIM_GLOW: | ||
8125 | if (remain < 1) | ||
8126 | return null; | ||
8127 | |||
8128 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8129 | if (face > 21) | ||
8130 | break; | ||
8131 | |||
8132 | res.Add(new LSL_Float(0)); | ||
8133 | break; | ||
8134 | |||
8135 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
8136 | res.Add(new LSL_String("")); | ||
8137 | res.Add(ScriptBaseClass.ZERO_VECTOR); | ||
8138 | res.Add(new LSL_Float(1)); | ||
8139 | break; | ||
8140 | |||
8141 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
8142 | res.Add(new LSL_Rotation(sp.Rotation)); | ||
8143 | break; | ||
8144 | |||
8145 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | ||
8146 | res.Add(new LSL_Vector(sp.OffsetPosition)); | ||
8147 | break; | ||
8148 | |||
8149 | case (int)ScriptBaseClass.PRIM_SLICE: | ||
8150 | res.Add(new LSL_Vector(0, 1, 0)); | ||
8151 | break; | ||
8152 | |||
8153 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
8154 | if(remain < 3) | ||
8155 | return null; | ||
8156 | |||
8157 | return rules.GetSublist(idx, -1); | ||
8158 | } | ||
7995 | } | 8159 | } |
7996 | 8160 | ||
7997 | return res; | 8161 | return null; |
7998 | } | 8162 | } |
7999 | 8163 | ||
8000 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) | 8164 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) |
8001 | { | 8165 | { |
8002 | int idx=0; | 8166 | int idx = 0; |
8003 | while (idx < rules.Length) | 8167 | while (idx < rules.Length) |
8004 | { | 8168 | { |
8005 | int code=(int)rules.GetLSLIntegerItem(idx++); | 8169 | int code = (int)rules.GetLSLIntegerItem(idx++); |
8006 | int remain=rules.Length-idx; | 8170 | int remain = rules.Length-idx; |
8007 | 8171 | ||
8008 | switch (code) | 8172 | switch (code) |
8009 | { | 8173 | { |
@@ -8246,7 +8410,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8246 | if (remain < 1) | 8410 | if (remain < 1) |
8247 | return null; | 8411 | return null; |
8248 | 8412 | ||
8249 | face=(int)rules.GetLSLIntegerItem(idx++); | 8413 | face = (int)rules.GetLSLIntegerItem(idx++); |
8250 | 8414 | ||
8251 | tex = part.Shape.Textures; | 8415 | tex = part.Shape.Textures; |
8252 | if (face == ScriptBaseClass.ALL_SIDES) | 8416 | if (face == ScriptBaseClass.ALL_SIDES) |