aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorDan Lake2011-11-02 14:59:34 -0700
committerDan Lake2011-11-02 14:59:34 -0700
commita724ebacd79de37823fe8a17be195509b15a2a33 (patch)
tree8bb1bd5cb99222c92f4ce862cd512be6fb48052b /OpenSim/Region/ScriptEngine/Shared/Api
parentChanges UpdateFlag in SOP to an enumeration of NONE, TERSE and FULL. (diff)
parentGet some hopefully more useful exception information when OpenJPEG.EncodeFrom... (diff)
downloadopensim-SC-a724ebacd79de37823fe8a17be195509b15a2a33.zip
opensim-SC-a724ebacd79de37823fe8a17be195509b15a2a33.tar.gz
opensim-SC-a724ebacd79de37823fe8a17be195509b15a2a33.tar.bz2
opensim-SC-a724ebacd79de37823fe8a17be195509b15a2a33.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs677
1 files changed, 362 insertions, 315 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b3d0dd5..0750579 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1958,6 +1958,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1958 return end; 1958 return end;
1959 } 1959 }
1960 1960
1961 protected LSL_Vector GetSetPosTarget(SceneObjectPart part, LSL_Vector targetPos, LSL_Vector fromPos)
1962 {
1963 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
1964 return fromPos;
1965
1966 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1967
1968
1969 float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
1970 bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
1971
1972 if (part.ParentGroup.RootPart == part)
1973 {
1974 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
1975 targetPos.z = ground;
1976 }
1977 LSL_Vector real_vec = SetPosAdjust(fromPos, targetPos);
1978
1979 return real_vec;
1980 }
1981
1961 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) 1982 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
1962 { 1983 {
1963 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) 1984 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
@@ -7040,380 +7061,406 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7040 { 7061 {
7041 int idx = 0; 7062 int idx = 0;
7042 7063
7043 while (idx < rules.Length) 7064 bool positionChanged = false;
7065 LSL_Vector currentPosition = GetPartLocalPos(part);
7066
7067 try
7044 { 7068 {
7045 int code = rules.GetLSLIntegerItem(idx++); 7069 while (idx < rules.Length)
7070 {
7071 int code = rules.GetLSLIntegerItem(idx++);
7046 7072
7047 int remain = rules.Length - idx; 7073 int remain = rules.Length - idx;
7048 7074
7049 int face; 7075 int face;
7050 LSL_Vector v; 7076 LSL_Vector v;
7051 7077
7052 switch (code) 7078 switch (code)
7053 { 7079 {
7054 case (int)ScriptBaseClass.PRIM_POSITION: 7080 case (int)ScriptBaseClass.PRIM_POSITION:
7055 if (remain < 1) 7081 if (remain < 1)
7056 return; 7082 return;
7057 7083
7058 v=rules.GetVector3Item(idx++); 7084 v=rules.GetVector3Item(idx++);
7059 SetPos(part, v); 7085 positionChanged = true;
7086 currentPosition = GetSetPosTarget(part, v, currentPosition);
7060 7087
7061 break; 7088 break;
7062 case (int)ScriptBaseClass.PRIM_SIZE: 7089 case (int)ScriptBaseClass.PRIM_SIZE:
7063 if (remain < 1) 7090 if (remain < 1)
7064 return; 7091 return;
7065 7092
7066 v=rules.GetVector3Item(idx++); 7093 v=rules.GetVector3Item(idx++);
7067 SetScale(part, v); 7094 SetScale(part, v);
7068 7095
7069 break; 7096 break;
7070 case (int)ScriptBaseClass.PRIM_ROTATION: 7097 case (int)ScriptBaseClass.PRIM_ROTATION:
7071 if (remain < 1) 7098 if (remain < 1)
7072 return; 7099 return;
7073 7100
7074 LSL_Rotation q = rules.GetQuaternionItem(idx++); 7101 LSL_Rotation q = rules.GetQuaternionItem(idx++);
7075 // try to let this work as in SL... 7102 // try to let this work as in SL...
7076 if (part.ParentID == 0) 7103 if (part.ParentID == 0)
7077 { 7104 {
7078 // special case: If we are root, rotate complete SOG to new rotation 7105 // special case: If we are root, rotate complete SOG to new rotation
7079 SetRot(part, Rot2Quaternion(q)); 7106 SetRot(part, Rot2Quaternion(q));
7080 } 7107 }
7081 else 7108 else
7082 { 7109 {
7083 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 7110 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
7084 SceneObjectPart rootPart = part.ParentGroup.RootPart; 7111 SceneObjectPart rootPart = part.ParentGroup.RootPart;
7085 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); 7112 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7086 } 7113 }
7087 7114
7088 break; 7115 break;
7089 7116
7090 case (int)ScriptBaseClass.PRIM_TYPE: 7117 case (int)ScriptBaseClass.PRIM_TYPE:
7091 if (remain < 3) 7118 if (remain < 3)
7092 return; 7119 return;
7093 7120
7094 code = (int)rules.GetLSLIntegerItem(idx++); 7121 code = (int)rules.GetLSLIntegerItem(idx++);
7095 7122
7096 remain = rules.Length - idx; 7123 remain = rules.Length - idx;
7097 float hollow; 7124 float hollow;
7098 LSL_Vector twist; 7125 LSL_Vector twist;
7099 LSL_Vector taper_b; 7126 LSL_Vector taper_b;
7100 LSL_Vector topshear; 7127 LSL_Vector topshear;
7101 float revolutions; 7128 float revolutions;
7102 float radiusoffset; 7129 float radiusoffset;
7103 float skew; 7130 float skew;
7104 LSL_Vector holesize; 7131 LSL_Vector holesize;
7105 LSL_Vector profilecut; 7132 LSL_Vector profilecut;
7106 7133
7107 switch (code) 7134 switch (code)
7108 { 7135 {
7109 case (int)ScriptBaseClass.PRIM_TYPE_BOX: 7136 case (int)ScriptBaseClass.PRIM_TYPE_BOX:
7110 if (remain < 6) 7137 if (remain < 6)
7111 return; 7138 return;
7112 7139
7113 face = (int)rules.GetLSLIntegerItem(idx++); 7140 face = (int)rules.GetLSLIntegerItem(idx++);
7114 v = rules.GetVector3Item(idx++); // cut 7141 v = rules.GetVector3Item(idx++); // cut
7115 hollow = (float)rules.GetLSLFloatItem(idx++); 7142 hollow = (float)rules.GetLSLFloatItem(idx++);
7116 twist = rules.GetVector3Item(idx++); 7143 twist = rules.GetVector3Item(idx++);
7117 taper_b = rules.GetVector3Item(idx++); 7144 taper_b = rules.GetVector3Item(idx++);
7118 topshear = rules.GetVector3Item(idx++); 7145 topshear = rules.GetVector3Item(idx++);
7119 7146
7120 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 7147 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7121 (byte)ProfileShape.Square, (byte)Extrusion.Straight); 7148 (byte)ProfileShape.Square, (byte)Extrusion.Straight);
7122 break; 7149 break;
7123 7150
7124 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 7151 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
7125 if (remain < 6) 7152 if (remain < 6)
7126 return; 7153 return;
7127 7154
7128 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7155 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7129 v = rules.GetVector3Item(idx++); // cut 7156 v = rules.GetVector3Item(idx++); // cut
7130 hollow = (float)rules.GetLSLFloatItem(idx++); 7157 hollow = (float)rules.GetLSLFloatItem(idx++);
7131 twist = rules.GetVector3Item(idx++); 7158 twist = rules.GetVector3Item(idx++);
7132 taper_b = rules.GetVector3Item(idx++); 7159 taper_b = rules.GetVector3Item(idx++);
7133 topshear = rules.GetVector3Item(idx++); 7160 topshear = rules.GetVector3Item(idx++);
7134 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 7161 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7135 (byte)ProfileShape.Circle, (byte)Extrusion.Straight); 7162 (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
7136 break; 7163 break;
7137 7164
7138 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 7165 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
7139 if (remain < 6) 7166 if (remain < 6)
7140 return; 7167 return;
7141 7168
7142 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7169 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7143 v = rules.GetVector3Item(idx++); //cut 7170 v = rules.GetVector3Item(idx++); //cut
7144 hollow = (float)rules.GetLSLFloatItem(idx++); 7171 hollow = (float)rules.GetLSLFloatItem(idx++);
7145 twist = rules.GetVector3Item(idx++); 7172 twist = rules.GetVector3Item(idx++);
7146 taper_b = rules.GetVector3Item(idx++); 7173 taper_b = rules.GetVector3Item(idx++);
7147 topshear = rules.GetVector3Item(idx++); 7174 topshear = rules.GetVector3Item(idx++);
7148 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 7175 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7149 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); 7176 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
7150 break; 7177 break;
7151 7178
7152 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 7179 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
7153 if (remain < 5) 7180 if (remain < 5)
7154 return; 7181 return;
7155 7182
7156 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7183 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7157 v = rules.GetVector3Item(idx++); // cut 7184 v = rules.GetVector3Item(idx++); // cut
7158 hollow = (float)rules.GetLSLFloatItem(idx++); 7185 hollow = (float)rules.GetLSLFloatItem(idx++);
7159 twist = rules.GetVector3Item(idx++); 7186 twist = rules.GetVector3Item(idx++);
7160 taper_b = rules.GetVector3Item(idx++); // dimple 7187 taper_b = rules.GetVector3Item(idx++); // dimple
7161 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 7188 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
7162 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); 7189 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
7163 break; 7190 break;
7164 7191
7165 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 7192 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
7166 if (remain < 11) 7193 if (remain < 11)
7167 return; 7194 return;
7168 7195
7169 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7196 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7170 v = rules.GetVector3Item(idx++); //cut 7197 v = rules.GetVector3Item(idx++); //cut
7171 hollow = (float)rules.GetLSLFloatItem(idx++); 7198 hollow = (float)rules.GetLSLFloatItem(idx++);
7172 twist = rules.GetVector3Item(idx++); 7199 twist = rules.GetVector3Item(idx++);
7173 holesize = rules.GetVector3Item(idx++); 7200 holesize = rules.GetVector3Item(idx++);
7174 topshear = rules.GetVector3Item(idx++); 7201 topshear = rules.GetVector3Item(idx++);
7175 profilecut = rules.GetVector3Item(idx++); 7202 profilecut = rules.GetVector3Item(idx++);
7176 taper_b = rules.GetVector3Item(idx++); // taper_a 7203 taper_b = rules.GetVector3Item(idx++); // taper_a
7177 revolutions = (float)rules.GetLSLFloatItem(idx++); 7204 revolutions = (float)rules.GetLSLFloatItem(idx++);
7178 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7205 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7179 skew = (float)rules.GetLSLFloatItem(idx++); 7206 skew = (float)rules.GetLSLFloatItem(idx++);
7180 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7207 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7181 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); 7208 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
7182 break; 7209 break;
7183 7210
7184 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 7211 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
7185 if (remain < 11) 7212 if (remain < 11)
7186 return; 7213 return;
7187 7214
7188 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7215 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7189 v = rules.GetVector3Item(idx++); //cut 7216 v = rules.GetVector3Item(idx++); //cut
7190 hollow = (float)rules.GetLSLFloatItem(idx++); 7217 hollow = (float)rules.GetLSLFloatItem(idx++);
7191 twist = rules.GetVector3Item(idx++); 7218 twist = rules.GetVector3Item(idx++);
7192 holesize = rules.GetVector3Item(idx++); 7219 holesize = rules.GetVector3Item(idx++);
7193 topshear = rules.GetVector3Item(idx++); 7220 topshear = rules.GetVector3Item(idx++);
7194 profilecut = rules.GetVector3Item(idx++); 7221 profilecut = rules.GetVector3Item(idx++);
7195 taper_b = rules.GetVector3Item(idx++); // taper_a 7222 taper_b = rules.GetVector3Item(idx++); // taper_a
7196 revolutions = (float)rules.GetLSLFloatItem(idx++); 7223 revolutions = (float)rules.GetLSLFloatItem(idx++);
7197 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7224 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7198 skew = (float)rules.GetLSLFloatItem(idx++); 7225 skew = (float)rules.GetLSLFloatItem(idx++);
7199 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7226 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7200 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); 7227 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
7201 break; 7228 break;
7202 7229
7203 case (int)ScriptBaseClass.PRIM_TYPE_RING: 7230 case (int)ScriptBaseClass.PRIM_TYPE_RING:
7204 if (remain < 11) 7231 if (remain < 11)
7205 return; 7232 return;
7206 7233
7207 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 7234 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
7208 v = rules.GetVector3Item(idx++); //cut 7235 v = rules.GetVector3Item(idx++); //cut
7209 hollow = (float)rules.GetLSLFloatItem(idx++); 7236 hollow = (float)rules.GetLSLFloatItem(idx++);
7210 twist = rules.GetVector3Item(idx++); 7237 twist = rules.GetVector3Item(idx++);
7211 holesize = rules.GetVector3Item(idx++); 7238 holesize = rules.GetVector3Item(idx++);
7212 topshear = rules.GetVector3Item(idx++); 7239 topshear = rules.GetVector3Item(idx++);
7213 profilecut = rules.GetVector3Item(idx++); 7240 profilecut = rules.GetVector3Item(idx++);
7214 taper_b = rules.GetVector3Item(idx++); // taper_a 7241 taper_b = rules.GetVector3Item(idx++); // taper_a
7215 revolutions = (float)rules.GetLSLFloatItem(idx++); 7242 revolutions = (float)rules.GetLSLFloatItem(idx++);
7216 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7243 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7217 skew = (float)rules.GetLSLFloatItem(idx++); 7244 skew = (float)rules.GetLSLFloatItem(idx++);
7218 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7245 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7219 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); 7246 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
7220 break; 7247 break;
7221 7248
7222 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 7249 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
7223 if (remain < 2) 7250 if (remain < 2)
7224 return; 7251 return;
7225 7252
7226 string map = rules.Data[idx++].ToString(); 7253 string map = rules.Data[idx++].ToString();
7227 face = (int)rules.GetLSLIntegerItem(idx++); // type 7254 face = (int)rules.GetLSLIntegerItem(idx++); // type
7228 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); 7255 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
7229 break; 7256 break;
7230 } 7257 }
7231 7258
7232 break; 7259 break;
7233 7260
7234 case (int)ScriptBaseClass.PRIM_TEXTURE: 7261 case (int)ScriptBaseClass.PRIM_TEXTURE:
7235 if (remain < 5) 7262 if (remain < 5)
7236 return; 7263 return;
7237 7264
7238 face=(int)rules.GetLSLIntegerItem(idx++); 7265 face=(int)rules.GetLSLIntegerItem(idx++);
7239 string tex=rules.Data[idx++].ToString(); 7266 string tex=rules.Data[idx++].ToString();
7240 LSL_Vector repeats=rules.GetVector3Item(idx++); 7267 LSL_Vector repeats=rules.GetVector3Item(idx++);
7241 LSL_Vector offsets=rules.GetVector3Item(idx++); 7268 LSL_Vector offsets=rules.GetVector3Item(idx++);
7242 double rotation=(double)rules.GetLSLFloatItem(idx++); 7269 double rotation=(double)rules.GetLSLFloatItem(idx++);
7243 7270
7244 SetTexture(part, tex, face); 7271 SetTexture(part, tex, face);
7245 ScaleTexture(part, repeats.x, repeats.y, face); 7272 ScaleTexture(part, repeats.x, repeats.y, face);
7246 OffsetTexture(part, offsets.x, offsets.y, face); 7273 OffsetTexture(part, offsets.x, offsets.y, face);
7247 RotateTexture(part, rotation, face); 7274 RotateTexture(part, rotation, face);
7248 7275
7249 break; 7276 break;
7250 7277
7251 case (int)ScriptBaseClass.PRIM_COLOR: 7278 case (int)ScriptBaseClass.PRIM_COLOR:
7252 if (remain < 3) 7279 if (remain < 3)
7253 return; 7280 return;
7254 7281
7255 face=(int)rules.GetLSLIntegerItem(idx++); 7282 face=(int)rules.GetLSLIntegerItem(idx++);
7256 LSL_Vector color=rules.GetVector3Item(idx++); 7283 LSL_Vector color=rules.GetVector3Item(idx++);
7257 double alpha=(double)rules.GetLSLFloatItem(idx++); 7284 double alpha=(double)rules.GetLSLFloatItem(idx++);
7258 7285
7259 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 7286 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
7260 SetAlpha(part, alpha, face); 7287 SetAlpha(part, alpha, face);
7261 7288
7262 break; 7289 break;
7263 7290
7264 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 7291 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
7265 if (remain < 7) 7292 if (remain < 7)
7266 return; 7293 return;
7267 7294
7268 bool flexi = rules.GetLSLIntegerItem(idx++); 7295 bool flexi = rules.GetLSLIntegerItem(idx++);
7269 int softness = rules.GetLSLIntegerItem(idx++); 7296 int softness = rules.GetLSLIntegerItem(idx++);
7270 float gravity = (float)rules.GetLSLFloatItem(idx++); 7297 float gravity = (float)rules.GetLSLFloatItem(idx++);
7271 float friction = (float)rules.GetLSLFloatItem(idx++); 7298 float friction = (float)rules.GetLSLFloatItem(idx++);
7272 float wind = (float)rules.GetLSLFloatItem(idx++); 7299 float wind = (float)rules.GetLSLFloatItem(idx++);
7273 float tension = (float)rules.GetLSLFloatItem(idx++); 7300 float tension = (float)rules.GetLSLFloatItem(idx++);
7274 LSL_Vector force = rules.GetVector3Item(idx++); 7301 LSL_Vector force = rules.GetVector3Item(idx++);
7275 7302
7276 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); 7303 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
7277 7304
7278 break; 7305 break;
7279 7306
7280 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 7307 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
7281 if (remain < 5) 7308 if (remain < 5)
7282 return; 7309 return;
7283 bool light = rules.GetLSLIntegerItem(idx++); 7310 bool light = rules.GetLSLIntegerItem(idx++);
7284 LSL_Vector lightcolor = rules.GetVector3Item(idx++); 7311 LSL_Vector lightcolor = rules.GetVector3Item(idx++);
7285 float intensity = (float)rules.GetLSLFloatItem(idx++); 7312 float intensity = (float)rules.GetLSLFloatItem(idx++);
7286 float radius = (float)rules.GetLSLFloatItem(idx++); 7313 float radius = (float)rules.GetLSLFloatItem(idx++);
7287 float falloff = (float)rules.GetLSLFloatItem(idx++); 7314 float falloff = (float)rules.GetLSLFloatItem(idx++);
7288 7315
7289 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 7316 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
7290 7317
7291 break; 7318 break;
7292 7319
7293 case (int)ScriptBaseClass.PRIM_GLOW: 7320 case (int)ScriptBaseClass.PRIM_GLOW:
7294 if (remain < 2) 7321 if (remain < 2)
7295 return; 7322 return;
7296 face = rules.GetLSLIntegerItem(idx++); 7323 face = rules.GetLSLIntegerItem(idx++);
7297 float glow = (float)rules.GetLSLFloatItem(idx++); 7324 float glow = (float)rules.GetLSLFloatItem(idx++);
7298 7325
7299 SetGlow(part, face, glow); 7326 SetGlow(part, face, glow);
7300 7327
7301 break; 7328 break;
7302 7329
7303 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 7330 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
7304 if (remain < 3) 7331 if (remain < 3)
7305 return; 7332 return;
7306 face = (int)rules.GetLSLIntegerItem(idx++); 7333 face = (int)rules.GetLSLIntegerItem(idx++);
7307 int shiny = (int)rules.GetLSLIntegerItem(idx++); 7334 int shiny = (int)rules.GetLSLIntegerItem(idx++);
7308 Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); 7335 Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++));
7309 7336
7310 SetShiny(part, face, shiny, bump); 7337 SetShiny(part, face, shiny, bump);
7311 7338
7312 break; 7339 break;
7313 7340
7314 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 7341 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7315 if (remain < 2) 7342 if (remain < 2)
7316 return; 7343 return;
7317 face = rules.GetLSLIntegerItem(idx++); 7344 face = rules.GetLSLIntegerItem(idx++);
7318 bool st = rules.GetLSLIntegerItem(idx++); 7345 bool st = rules.GetLSLIntegerItem(idx++);
7319 SetFullBright(part, face , st); 7346 SetFullBright(part, face , st);
7320 break; 7347 break;
7321 7348
7322 case (int)ScriptBaseClass.PRIM_MATERIAL: 7349 case (int)ScriptBaseClass.PRIM_MATERIAL:
7323 if (remain < 1) 7350 if (remain < 1)
7324 return; 7351 return;
7325 int mat = rules.GetLSLIntegerItem(idx++); 7352 int mat = rules.GetLSLIntegerItem(idx++);
7326 if (mat < 0 || mat > 7) 7353 if (mat < 0 || mat > 7)
7327 return; 7354 return;
7328 7355
7329 part.Material = Convert.ToByte(mat); 7356 part.Material = Convert.ToByte(mat);
7330 break; 7357 break;
7331 7358
7332 case (int)ScriptBaseClass.PRIM_PHANTOM: 7359 case (int)ScriptBaseClass.PRIM_PHANTOM:
7333 if (remain < 1) 7360 if (remain < 1)
7334 return; 7361 return;
7335 7362
7336 string ph = rules.Data[idx++].ToString(); 7363 string ph = rules.Data[idx++].ToString();
7337 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); 7364 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
7338 7365
7339 break; 7366 break;
7340 7367
7341 case (int)ScriptBaseClass.PRIM_PHYSICS: 7368 case (int)ScriptBaseClass.PRIM_PHYSICS:
7342 if (remain < 1) 7369 if (remain < 1)
7343 return; 7370 return;
7344 string phy = rules.Data[idx++].ToString(); 7371 string phy = rules.Data[idx++].ToString();
7345 bool physics; 7372 bool physics;
7346 7373
7347 if (phy.Equals("1")) 7374 if (phy.Equals("1"))
7348 physics = true; 7375 physics = true;
7349 else 7376 else
7350 physics = false; 7377 physics = false;
7351 7378
7352 part.ScriptSetPhysicsStatus(physics); 7379 part.ScriptSetPhysicsStatus(physics);
7353 break; 7380 break;
7354 7381
7355 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7382 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7356 if (remain < 1) 7383 if (remain < 1)
7357 return; 7384 return;
7358 string temp = rules.Data[idx++].ToString(); 7385 string temp = rules.Data[idx++].ToString();
7359 7386
7360 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); 7387 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
7361 7388
7362 break; 7389 break;
7363 7390
7364 case (int)ScriptBaseClass.PRIM_TEXGEN: 7391 case (int)ScriptBaseClass.PRIM_TEXGEN:
7365 if (remain < 2) 7392 if (remain < 2)
7366 return; 7393 return;
7367 //face,type 7394 //face,type
7368 face = rules.GetLSLIntegerItem(idx++); 7395 face = rules.GetLSLIntegerItem(idx++);
7369 int style = rules.GetLSLIntegerItem(idx++); 7396 int style = rules.GetLSLIntegerItem(idx++);
7370 SetTexGen(part, face, style); 7397 SetTexGen(part, face, style);
7371 break; 7398 break;
7372 case (int)ScriptBaseClass.PRIM_TEXT: 7399 case (int)ScriptBaseClass.PRIM_TEXT:
7373 if (remain < 3) 7400 if (remain < 3)
7374 return; 7401 return;
7375 string primText = rules.GetLSLStringItem(idx++); 7402 string primText = rules.GetLSLStringItem(idx++);
7376 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 7403 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
7377 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 7404 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
7378 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), 7405 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
7379 Util.Clip((float)primTextColor.y, 0.0f, 1.0f), 7406 Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
7380 Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); 7407 Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
7381 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 7408 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7409
7410 break;
7411 case (int)ScriptBaseClass.PRIM_NAME:
7412 if (remain < 1)
7413 return;
7414 string primName = rules.GetLSLStringItem(idx++);
7415 part.Name = primName;
7416 break;
7417 case (int)ScriptBaseClass.PRIM_DESC:
7418 if (remain < 1)
7419 return;
7420 string primDesc = rules.GetLSLStringItem(idx++);
7421 part.Description = primDesc;
7422 break;
7423 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7424 if (remain < 1)
7425 return;
7426 LSL_Rotation lr = rules.GetQuaternionItem(idx++);
7427 SetRot(part, Rot2Quaternion(lr));
7428 break;
7429 case (int)ScriptBaseClass.PRIM_OMEGA:
7430 if (remain < 3)
7431 return;
7432 LSL_Vector axis = rules.GetVector3Item(idx++);
7433 LSL_Float spinrate = rules.GetLSLFloatItem(idx++);
7434 LSL_Float gain = rules.GetLSLFloatItem(idx++);
7435 TargetOmega(part, axis, (double)spinrate, (double)gain);
7436 break;
7437 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
7438 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
7439 return;
7440 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
7441 LSL_List new_rules = rules.GetSublist(idx, -1);
7442 setLinkPrimParams((int)new_linknumber, new_rules);
7382 7443
7383 break;
7384 case (int)ScriptBaseClass.PRIM_NAME:
7385 if (remain < 1)
7386 return;
7387 string primName = rules.GetLSLStringItem(idx++);
7388 part.Name = primName;
7389 break;
7390 case (int)ScriptBaseClass.PRIM_DESC:
7391 if (remain < 1)
7392 return;
7393 string primDesc = rules.GetLSLStringItem(idx++);
7394 part.Description = primDesc;
7395 break;
7396 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7397 if (remain < 1)
7398 return;
7399 LSL_Rotation lr = rules.GetQuaternionItem(idx++);
7400 SetRot(part, Rot2Quaternion(lr));
7401 break;
7402 case (int)ScriptBaseClass.PRIM_OMEGA:
7403 if (remain < 3)
7404 return;
7405 LSL_Vector axis = rules.GetVector3Item(idx++);
7406 LSL_Float spinrate = rules.GetLSLFloatItem(idx++);
7407 LSL_Float gain = rules.GetLSLFloatItem(idx++);
7408 TargetOmega(part, axis, (double)spinrate, (double)gain);
7409 break;
7410 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
7411 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
7412 return;
7413 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
7414 LSL_List new_rules = rules.GetSublist(idx, -1);
7415 setLinkPrimParams((int)new_linknumber, new_rules);
7416 return; 7444 return;
7445 }
7446 }
7447 }
7448 finally
7449 {
7450 if (positionChanged)
7451 {
7452 if (part.ParentGroup.RootPart == part)
7453 {
7454 SceneObjectGroup parent = part.ParentGroup;
7455 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
7456 }
7457 else
7458 {
7459 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
7460 SceneObjectGroup parent = part.ParentGroup;
7461 parent.HasGroupChanged = true;
7462 parent.ScheduleGroupForTerseUpdate();
7463 }
7417 } 7464 }
7418 } 7465 }
7419 } 7466 }