diff options
author | Melanie | 2011-11-02 12:09:18 +0000 |
---|---|---|
committer | Melanie | 2011-11-02 12:09:18 +0000 |
commit | c5fb39e21f41baf85f392ac916c1b59789235c8c (patch) | |
tree | d3faf8d026ce75f41d28b69883787ab8e1301cc1 | |
parent | Some positioning fixes from AVN trunk (diff) | |
download | opensim-SC-c5fb39e21f41baf85f392ac916c1b59789235c8c.zip opensim-SC-c5fb39e21f41baf85f392ac916c1b59789235c8c.tar.gz opensim-SC-c5fb39e21f41baf85f392ac916c1b59789235c8c.tar.bz2 opensim-SC-c5fb39e21f41baf85f392ac916c1b59789235c8c.tar.xz |
Restore the recursive calling of PRIM_LINK_TARGET because the version I made
breaks LINK_SET et al.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 661 |
1 files changed, 334 insertions, 327 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 20fe6c6..a51a88b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7067,396 +7067,403 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7067 | bool positionChanged = false; | 7067 | bool positionChanged = false; |
7068 | LSL_Vector currentPosition = GetPartLocalPos(part); | 7068 | LSL_Vector currentPosition = GetPartLocalPos(part); |
7069 | 7069 | ||
7070 | while (idx < rules.Length) | 7070 | try |
7071 | { | 7071 | { |
7072 | int code = rules.GetLSLIntegerItem(idx++); | 7072 | while (idx < rules.Length) |
7073 | { | ||
7074 | int code = rules.GetLSLIntegerItem(idx++); | ||
7073 | 7075 | ||
7074 | int remain = rules.Length - idx; | 7076 | int remain = rules.Length - idx; |
7075 | 7077 | ||
7076 | int face; | 7078 | int face; |
7077 | LSL_Vector v; | 7079 | LSL_Vector v; |
7078 | 7080 | ||
7079 | switch (code) | 7081 | switch (code) |
7080 | { | 7082 | { |
7081 | case (int)ScriptBaseClass.PRIM_POSITION: | 7083 | case (int)ScriptBaseClass.PRIM_POSITION: |
7082 | if (remain < 1) | 7084 | if (remain < 1) |
7083 | return; | 7085 | return; |
7084 | 7086 | ||
7085 | v=rules.GetVector3Item(idx++); | 7087 | v=rules.GetVector3Item(idx++); |
7086 | positionChanged = true; | 7088 | positionChanged = true; |
7087 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 7089 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
7088 | 7090 | ||
7089 | break; | 7091 | break; |
7090 | case (int)ScriptBaseClass.PRIM_SIZE: | 7092 | case (int)ScriptBaseClass.PRIM_SIZE: |
7091 | if (remain < 1) | 7093 | if (remain < 1) |
7092 | return; | 7094 | return; |
7093 | 7095 | ||
7094 | v=rules.GetVector3Item(idx++); | 7096 | v=rules.GetVector3Item(idx++); |
7095 | SetScale(part, v); | 7097 | SetScale(part, v); |
7096 | 7098 | ||
7097 | break; | 7099 | break; |
7098 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7100 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7099 | if (remain < 1) | 7101 | if (remain < 1) |
7100 | return; | 7102 | return; |
7101 | 7103 | ||
7102 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 7104 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
7103 | // try to let this work as in SL... | 7105 | // try to let this work as in SL... |
7104 | if (part.ParentID == 0) | 7106 | if (part.ParentID == 0) |
7105 | { | 7107 | { |
7106 | // special case: If we are root, rotate complete SOG to new rotation | 7108 | // special case: If we are root, rotate complete SOG to new rotation |
7107 | SetRot(part, Rot2Quaternion(q)); | 7109 | SetRot(part, Rot2Quaternion(q)); |
7108 | } | 7110 | } |
7109 | else | 7111 | else |
7110 | { | 7112 | { |
7111 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 7113 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
7112 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | 7114 | SceneObjectPart rootPart = part.ParentGroup.RootPart; |
7113 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | 7115 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7114 | } | 7116 | } |
7115 | 7117 | ||
7116 | break; | 7118 | break; |
7117 | 7119 | ||
7118 | case (int)ScriptBaseClass.PRIM_TYPE: | 7120 | case (int)ScriptBaseClass.PRIM_TYPE: |
7119 | if (remain < 3) | 7121 | if (remain < 3) |
7120 | return; | 7122 | return; |
7121 | 7123 | ||
7122 | code = (int)rules.GetLSLIntegerItem(idx++); | 7124 | code = (int)rules.GetLSLIntegerItem(idx++); |
7123 | 7125 | ||
7124 | remain = rules.Length - idx; | 7126 | remain = rules.Length - idx; |
7125 | float hollow; | 7127 | float hollow; |
7126 | LSL_Vector twist; | 7128 | LSL_Vector twist; |
7127 | LSL_Vector taper_b; | 7129 | LSL_Vector taper_b; |
7128 | LSL_Vector topshear; | 7130 | LSL_Vector topshear; |
7129 | float revolutions; | 7131 | float revolutions; |
7130 | float radiusoffset; | 7132 | float radiusoffset; |
7131 | float skew; | 7133 | float skew; |
7132 | LSL_Vector holesize; | 7134 | LSL_Vector holesize; |
7133 | LSL_Vector profilecut; | 7135 | LSL_Vector profilecut; |
7134 | 7136 | ||
7135 | switch (code) | 7137 | switch (code) |
7136 | { | 7138 | { |
7137 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | 7139 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
7138 | if (remain < 6) | 7140 | if (remain < 6) |
7139 | return; | 7141 | return; |
7140 | 7142 | ||
7141 | face = (int)rules.GetLSLIntegerItem(idx++); | 7143 | face = (int)rules.GetLSLIntegerItem(idx++); |
7142 | v = rules.GetVector3Item(idx++); // cut | 7144 | v = rules.GetVector3Item(idx++); // cut |
7143 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7145 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7144 | twist = rules.GetVector3Item(idx++); | 7146 | twist = rules.GetVector3Item(idx++); |
7145 | taper_b = rules.GetVector3Item(idx++); | 7147 | taper_b = rules.GetVector3Item(idx++); |
7146 | topshear = rules.GetVector3Item(idx++); | 7148 | topshear = rules.GetVector3Item(idx++); |
7147 | 7149 | ||
7148 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 7150 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7149 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); | 7151 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); |
7150 | break; | 7152 | break; |
7151 | 7153 | ||
7152 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 7154 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
7153 | if (remain < 6) | 7155 | if (remain < 6) |
7154 | return; | 7156 | return; |
7155 | 7157 | ||
7156 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7158 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7157 | v = rules.GetVector3Item(idx++); // cut | 7159 | v = rules.GetVector3Item(idx++); // cut |
7158 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7160 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7159 | twist = rules.GetVector3Item(idx++); | 7161 | twist = rules.GetVector3Item(idx++); |
7160 | taper_b = rules.GetVector3Item(idx++); | 7162 | taper_b = rules.GetVector3Item(idx++); |
7161 | topshear = rules.GetVector3Item(idx++); | 7163 | topshear = rules.GetVector3Item(idx++); |
7162 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 7164 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7163 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); | 7165 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); |
7164 | break; | 7166 | break; |
7165 | 7167 | ||
7166 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 7168 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
7167 | if (remain < 6) | 7169 | if (remain < 6) |
7168 | return; | 7170 | return; |
7169 | 7171 | ||
7170 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7172 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7171 | v = rules.GetVector3Item(idx++); //cut | 7173 | v = rules.GetVector3Item(idx++); //cut |
7172 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7174 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7173 | twist = rules.GetVector3Item(idx++); | 7175 | twist = rules.GetVector3Item(idx++); |
7174 | taper_b = rules.GetVector3Item(idx++); | 7176 | taper_b = rules.GetVector3Item(idx++); |
7175 | topshear = rules.GetVector3Item(idx++); | 7177 | topshear = rules.GetVector3Item(idx++); |
7176 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 7178 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7177 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); | 7179 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); |
7178 | break; | 7180 | break; |
7179 | 7181 | ||
7180 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 7182 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: |
7181 | if (remain < 5) | 7183 | if (remain < 5) |
7182 | return; | 7184 | return; |
7183 | 7185 | ||
7184 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7186 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7185 | v = rules.GetVector3Item(idx++); // cut | 7187 | v = rules.GetVector3Item(idx++); // cut |
7186 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7188 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7187 | twist = rules.GetVector3Item(idx++); | 7189 | twist = rules.GetVector3Item(idx++); |
7188 | taper_b = rules.GetVector3Item(idx++); // dimple | 7190 | taper_b = rules.GetVector3Item(idx++); // dimple |
7189 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, | 7191 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, |
7190 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); | 7192 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); |
7191 | break; | 7193 | break; |
7192 | 7194 | ||
7193 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 7195 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: |
7194 | if (remain < 11) | 7196 | if (remain < 11) |
7195 | return; | 7197 | return; |
7196 | 7198 | ||
7197 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7199 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7198 | v = rules.GetVector3Item(idx++); //cut | 7200 | v = rules.GetVector3Item(idx++); //cut |
7199 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7201 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7200 | twist = rules.GetVector3Item(idx++); | 7202 | twist = rules.GetVector3Item(idx++); |
7201 | holesize = rules.GetVector3Item(idx++); | 7203 | holesize = rules.GetVector3Item(idx++); |
7202 | topshear = rules.GetVector3Item(idx++); | 7204 | topshear = rules.GetVector3Item(idx++); |
7203 | profilecut = rules.GetVector3Item(idx++); | 7205 | profilecut = rules.GetVector3Item(idx++); |
7204 | taper_b = rules.GetVector3Item(idx++); // taper_a | 7206 | taper_b = rules.GetVector3Item(idx++); // taper_a |
7205 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7207 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7206 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7208 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7207 | skew = (float)rules.GetLSLFloatItem(idx++); | 7209 | skew = (float)rules.GetLSLFloatItem(idx++); |
7208 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7210 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7209 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); | 7211 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); |
7210 | break; | 7212 | break; |
7211 | 7213 | ||
7212 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 7214 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
7213 | if (remain < 11) | 7215 | if (remain < 11) |
7214 | return; | 7216 | return; |
7215 | 7217 | ||
7216 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7218 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7217 | v = rules.GetVector3Item(idx++); //cut | 7219 | v = rules.GetVector3Item(idx++); //cut |
7218 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7220 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7219 | twist = rules.GetVector3Item(idx++); | 7221 | twist = rules.GetVector3Item(idx++); |
7220 | holesize = rules.GetVector3Item(idx++); | 7222 | holesize = rules.GetVector3Item(idx++); |
7221 | topshear = rules.GetVector3Item(idx++); | 7223 | topshear = rules.GetVector3Item(idx++); |
7222 | profilecut = rules.GetVector3Item(idx++); | 7224 | profilecut = rules.GetVector3Item(idx++); |
7223 | taper_b = rules.GetVector3Item(idx++); // taper_a | 7225 | taper_b = rules.GetVector3Item(idx++); // taper_a |
7224 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7226 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7225 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7227 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7226 | skew = (float)rules.GetLSLFloatItem(idx++); | 7228 | skew = (float)rules.GetLSLFloatItem(idx++); |
7227 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7229 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7228 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); | 7230 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); |
7229 | break; | 7231 | break; |
7230 | 7232 | ||
7231 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 7233 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
7232 | if (remain < 11) | 7234 | if (remain < 11) |
7233 | return; | 7235 | return; |
7234 | 7236 | ||
7235 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7237 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7236 | v = rules.GetVector3Item(idx++); //cut | 7238 | v = rules.GetVector3Item(idx++); //cut |
7237 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7239 | hollow = (float)rules.GetLSLFloatItem(idx++); |
7238 | twist = rules.GetVector3Item(idx++); | 7240 | twist = rules.GetVector3Item(idx++); |
7239 | holesize = rules.GetVector3Item(idx++); | 7241 | holesize = rules.GetVector3Item(idx++); |
7240 | topshear = rules.GetVector3Item(idx++); | 7242 | topshear = rules.GetVector3Item(idx++); |
7241 | profilecut = rules.GetVector3Item(idx++); | 7243 | profilecut = rules.GetVector3Item(idx++); |
7242 | taper_b = rules.GetVector3Item(idx++); // taper_a | 7244 | taper_b = rules.GetVector3Item(idx++); // taper_a |
7243 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 7245 | revolutions = (float)rules.GetLSLFloatItem(idx++); |
7244 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 7246 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); |
7245 | skew = (float)rules.GetLSLFloatItem(idx++); | 7247 | skew = (float)rules.GetLSLFloatItem(idx++); |
7246 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 7248 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7247 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); | 7249 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); |
7248 | break; | 7250 | break; |
7249 | 7251 | ||
7250 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 7252 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
7251 | if (remain < 2) | 7253 | if (remain < 2) |
7252 | return; | 7254 | return; |
7253 | 7255 | ||
7254 | string map = rules.Data[idx++].ToString(); | 7256 | string map = rules.Data[idx++].ToString(); |
7255 | face = (int)rules.GetLSLIntegerItem(idx++); // type | 7257 | face = (int)rules.GetLSLIntegerItem(idx++); // type |
7256 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); | 7258 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); |
7257 | break; | 7259 | break; |
7258 | } | 7260 | } |
7259 | 7261 | ||
7260 | break; | 7262 | break; |
7261 | 7263 | ||
7262 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 7264 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
7263 | if (remain < 5) | 7265 | if (remain < 5) |
7264 | return; | 7266 | return; |
7265 | 7267 | ||
7266 | face=(int)rules.GetLSLIntegerItem(idx++); | 7268 | face=(int)rules.GetLSLIntegerItem(idx++); |
7267 | string tex=rules.Data[idx++].ToString(); | 7269 | string tex=rules.Data[idx++].ToString(); |
7268 | LSL_Vector repeats=rules.GetVector3Item(idx++); | 7270 | LSL_Vector repeats=rules.GetVector3Item(idx++); |
7269 | LSL_Vector offsets=rules.GetVector3Item(idx++); | 7271 | LSL_Vector offsets=rules.GetVector3Item(idx++); |
7270 | double rotation=(double)rules.GetLSLFloatItem(idx++); | 7272 | double rotation=(double)rules.GetLSLFloatItem(idx++); |
7271 | 7273 | ||
7272 | SetTexture(part, tex, face); | 7274 | SetTexture(part, tex, face); |
7273 | ScaleTexture(part, repeats.x, repeats.y, face); | 7275 | ScaleTexture(part, repeats.x, repeats.y, face); |
7274 | OffsetTexture(part, offsets.x, offsets.y, face); | 7276 | OffsetTexture(part, offsets.x, offsets.y, face); |
7275 | RotateTexture(part, rotation, face); | 7277 | RotateTexture(part, rotation, face); |
7276 | 7278 | ||
7277 | break; | 7279 | break; |
7278 | 7280 | ||
7279 | case (int)ScriptBaseClass.PRIM_COLOR: | 7281 | case (int)ScriptBaseClass.PRIM_COLOR: |
7280 | if (remain < 3) | 7282 | if (remain < 3) |
7281 | return; | 7283 | return; |
7282 | 7284 | ||
7283 | face=(int)rules.GetLSLIntegerItem(idx++); | 7285 | face=(int)rules.GetLSLIntegerItem(idx++); |
7284 | LSL_Vector color=rules.GetVector3Item(idx++); | 7286 | LSL_Vector color=rules.GetVector3Item(idx++); |
7285 | double alpha=(double)rules.GetLSLFloatItem(idx++); | 7287 | double alpha=(double)rules.GetLSLFloatItem(idx++); |
7286 | 7288 | ||
7287 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 7289 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
7288 | SetAlpha(part, alpha, face); | 7290 | SetAlpha(part, alpha, face); |
7289 | 7291 | ||
7290 | break; | 7292 | break; |
7291 | 7293 | ||
7292 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 7294 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7293 | if (remain < 7) | 7295 | if (remain < 7) |
7294 | return; | 7296 | return; |
7295 | 7297 | ||
7296 | bool flexi = rules.GetLSLIntegerItem(idx++); | 7298 | bool flexi = rules.GetLSLIntegerItem(idx++); |
7297 | int softness = rules.GetLSLIntegerItem(idx++); | 7299 | int softness = rules.GetLSLIntegerItem(idx++); |
7298 | float gravity = (float)rules.GetLSLFloatItem(idx++); | 7300 | float gravity = (float)rules.GetLSLFloatItem(idx++); |
7299 | float friction = (float)rules.GetLSLFloatItem(idx++); | 7301 | float friction = (float)rules.GetLSLFloatItem(idx++); |
7300 | float wind = (float)rules.GetLSLFloatItem(idx++); | 7302 | float wind = (float)rules.GetLSLFloatItem(idx++); |
7301 | float tension = (float)rules.GetLSLFloatItem(idx++); | 7303 | float tension = (float)rules.GetLSLFloatItem(idx++); |
7302 | LSL_Vector force = rules.GetVector3Item(idx++); | 7304 | LSL_Vector force = rules.GetVector3Item(idx++); |
7303 | 7305 | ||
7304 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); | 7306 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); |
7305 | 7307 | ||
7306 | break; | 7308 | break; |
7307 | 7309 | ||
7308 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 7310 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
7309 | if (remain < 5) | 7311 | if (remain < 5) |
7310 | return; | 7312 | return; |
7311 | bool light = rules.GetLSLIntegerItem(idx++); | 7313 | bool light = rules.GetLSLIntegerItem(idx++); |
7312 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); | 7314 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); |
7313 | float intensity = (float)rules.GetLSLFloatItem(idx++); | 7315 | float intensity = (float)rules.GetLSLFloatItem(idx++); |
7314 | float radius = (float)rules.GetLSLFloatItem(idx++); | 7316 | float radius = (float)rules.GetLSLFloatItem(idx++); |
7315 | float falloff = (float)rules.GetLSLFloatItem(idx++); | 7317 | float falloff = (float)rules.GetLSLFloatItem(idx++); |
7316 | 7318 | ||
7317 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); | 7319 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); |
7318 | 7320 | ||
7319 | break; | 7321 | break; |
7320 | 7322 | ||
7321 | case (int)ScriptBaseClass.PRIM_GLOW: | 7323 | case (int)ScriptBaseClass.PRIM_GLOW: |
7322 | if (remain < 2) | 7324 | if (remain < 2) |
7323 | return; | 7325 | return; |
7324 | face = rules.GetLSLIntegerItem(idx++); | 7326 | face = rules.GetLSLIntegerItem(idx++); |
7325 | float glow = (float)rules.GetLSLFloatItem(idx++); | 7327 | float glow = (float)rules.GetLSLFloatItem(idx++); |
7326 | 7328 | ||
7327 | SetGlow(part, face, glow); | 7329 | SetGlow(part, face, glow); |
7328 | 7330 | ||
7329 | break; | 7331 | break; |
7330 | 7332 | ||
7331 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 7333 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
7332 | if (remain < 3) | 7334 | if (remain < 3) |
7333 | return; | 7335 | return; |
7334 | face = (int)rules.GetLSLIntegerItem(idx++); | 7336 | face = (int)rules.GetLSLIntegerItem(idx++); |
7335 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 7337 | int shiny = (int)rules.GetLSLIntegerItem(idx++); |
7336 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | 7338 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); |
7337 | 7339 | ||
7338 | SetShiny(part, face, shiny, bump); | 7340 | SetShiny(part, face, shiny, bump); |
7339 | 7341 | ||
7340 | break; | 7342 | break; |
7341 | 7343 | ||
7342 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 7344 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7343 | if (remain < 2) | 7345 | if (remain < 2) |
7344 | return; | 7346 | return; |
7345 | face = rules.GetLSLIntegerItem(idx++); | 7347 | face = rules.GetLSLIntegerItem(idx++); |
7346 | bool st = rules.GetLSLIntegerItem(idx++); | 7348 | bool st = rules.GetLSLIntegerItem(idx++); |
7347 | SetFullBright(part, face , st); | 7349 | SetFullBright(part, face , st); |
7348 | break; | 7350 | break; |
7349 | 7351 | ||
7350 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 7352 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
7351 | if (remain < 1) | 7353 | if (remain < 1) |
7352 | return; | 7354 | return; |
7353 | int mat = rules.GetLSLIntegerItem(idx++); | 7355 | int mat = rules.GetLSLIntegerItem(idx++); |
7354 | if (mat < 0 || mat > 7) | 7356 | if (mat < 0 || mat > 7) |
7355 | return; | 7357 | return; |
7356 | 7358 | ||
7357 | part.Material = Convert.ToByte(mat); | 7359 | part.Material = Convert.ToByte(mat); |
7358 | break; | 7360 | break; |
7359 | 7361 | ||
7360 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 7362 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
7361 | if (remain < 1) | 7363 | if (remain < 1) |
7362 | return; | 7364 | return; |
7363 | 7365 | ||
7364 | string ph = rules.Data[idx++].ToString(); | 7366 | string ph = rules.Data[idx++].ToString(); |
7365 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | 7367 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); |
7366 | 7368 | ||
7367 | break; | 7369 | break; |
7368 | 7370 | ||
7369 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 7371 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
7370 | if (remain < 1) | 7372 | if (remain < 1) |
7371 | return; | 7373 | return; |
7372 | string phy = rules.Data[idx++].ToString(); | 7374 | string phy = rules.Data[idx++].ToString(); |
7373 | bool physics; | 7375 | bool physics; |
7374 | 7376 | ||
7375 | if (phy.Equals("1")) | 7377 | if (phy.Equals("1")) |
7376 | physics = true; | 7378 | physics = true; |
7377 | else | 7379 | else |
7378 | physics = false; | 7380 | physics = false; |
7379 | 7381 | ||
7380 | part.ScriptSetPhysicsStatus(physics); | 7382 | part.ScriptSetPhysicsStatus(physics); |
7381 | break; | 7383 | break; |
7382 | 7384 | ||
7383 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 7385 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
7384 | if (remain < 1) | 7386 | if (remain < 1) |
7385 | return; | 7387 | return; |
7386 | string temp = rules.Data[idx++].ToString(); | 7388 | string temp = rules.Data[idx++].ToString(); |
7387 | 7389 | ||
7388 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | 7390 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); |
7389 | 7391 | ||
7390 | break; | 7392 | break; |
7391 | 7393 | ||
7392 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 7394 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
7393 | if (remain < 2) | 7395 | if (remain < 2) |
7394 | return; | 7396 | return; |
7395 | //face,type | 7397 | //face,type |
7396 | face = rules.GetLSLIntegerItem(idx++); | 7398 | face = rules.GetLSLIntegerItem(idx++); |
7397 | int style = rules.GetLSLIntegerItem(idx++); | 7399 | int style = rules.GetLSLIntegerItem(idx++); |
7398 | SetTexGen(part, face, style); | 7400 | SetTexGen(part, face, style); |
7399 | break; | 7401 | break; |
7400 | case (int)ScriptBaseClass.PRIM_TEXT: | 7402 | case (int)ScriptBaseClass.PRIM_TEXT: |
7401 | if (remain < 3) | 7403 | if (remain < 3) |
7402 | return; | 7404 | return; |
7403 | string primText = rules.GetLSLStringItem(idx++); | 7405 | string primText = rules.GetLSLStringItem(idx++); |
7404 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 7406 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); |
7405 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 7407 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); |
7406 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | 7408 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), |
7407 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | 7409 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), |
7408 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | 7410 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); |
7409 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | 7411 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); |
7412 | |||
7413 | break; | ||
7414 | case (int)ScriptBaseClass.PRIM_NAME: | ||
7415 | if (remain < 1) | ||
7416 | return; | ||
7417 | string primName = rules.GetLSLStringItem(idx++); | ||
7418 | part.Name = primName; | ||
7419 | break; | ||
7420 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7421 | if (remain < 1) | ||
7422 | return; | ||
7423 | string primDesc = rules.GetLSLStringItem(idx++); | ||
7424 | part.Description = primDesc; | ||
7425 | break; | ||
7426 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7427 | if (remain < 1) | ||
7428 | return; | ||
7429 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | ||
7430 | SetRot(part, Rot2Quaternion(lr)); | ||
7431 | break; | ||
7432 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
7433 | if (remain < 3) | ||
7434 | return; | ||
7435 | LSL_Vector axis = rules.GetVector3Item(idx++); | ||
7436 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | ||
7437 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | ||
7438 | TargetOmega(part, axis, (double)spinrate, (double)gain); | ||
7439 | break; | ||
7440 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
7441 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
7442 | return; | ||
7443 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
7444 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
7445 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
7410 | 7446 | ||
7411 | break; | ||
7412 | case (int)ScriptBaseClass.PRIM_NAME: | ||
7413 | if (remain < 1) | ||
7414 | return; | ||
7415 | string primName = rules.GetLSLStringItem(idx++); | ||
7416 | part.Name = primName; | ||
7417 | break; | ||
7418 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7419 | if (remain < 1) | ||
7420 | return; | ||
7421 | string primDesc = rules.GetLSLStringItem(idx++); | ||
7422 | part.Description = primDesc; | ||
7423 | break; | ||
7424 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7425 | if (remain < 1) | ||
7426 | return; | ||
7427 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | ||
7428 | SetRot(part, Rot2Quaternion(lr)); | ||
7429 | break; | ||
7430 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
7431 | if (remain < 3) | ||
7432 | return; | ||
7433 | LSL_Vector axis = rules.GetVector3Item(idx++); | ||
7434 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | ||
7435 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | ||
7436 | TargetOmega(part, axis, (double)spinrate, (double)gain); | ||
7437 | break; | ||
7438 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
7439 | if (remain < 1) | ||
7440 | return; | 7447 | return; |
7441 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 7448 | } |
7442 | part = part.ParentGroup.GetLinkNumPart((int)new_linknumber); | ||
7443 | break; | ||
7444 | } | 7449 | } |
7445 | } | 7450 | } |
7446 | 7451 | finally | |
7447 | if (positionChanged) | ||
7448 | { | 7452 | { |
7449 | if (part.ParentGroup.RootPart == part) | 7453 | if (positionChanged) |
7450 | { | 7454 | { |
7451 | SceneObjectGroup parent = part.ParentGroup; | 7455 | if (part.ParentGroup.RootPart == part) |
7452 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); | 7456 | { |
7453 | } | 7457 | SceneObjectGroup parent = part.ParentGroup; |
7454 | else | 7458 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); |
7455 | { | 7459 | } |
7456 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); | 7460 | else |
7457 | SceneObjectGroup parent = part.ParentGroup; | 7461 | { |
7458 | parent.HasGroupChanged = true; | 7462 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); |
7459 | parent.ScheduleGroupForTerseUpdate(); | 7463 | SceneObjectGroup parent = part.ParentGroup; |
7464 | parent.HasGroupChanged = true; | ||
7465 | parent.ScheduleGroupForTerseUpdate(); | ||
7466 | } | ||
7460 | } | 7467 | } |
7461 | } | 7468 | } |
7462 | } | 7469 | } |