aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-25 11:58:55 +0000
committerMelanie Thielker2008-08-25 11:58:55 +0000
commitcf7020d73c238312e0d640fdf5fe795862f030f3 (patch)
treee37cb3c998aa84660314507d60bbeef9c460101d /OpenSim/Region/ScriptEngine/Shared
parent* Fix to OGP Region to Region teleports. Yay. (diff)
downloadopensim-SC_OLD-cf7020d73c238312e0d640fdf5fe795862f030f3.zip
opensim-SC_OLD-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.gz
opensim-SC_OLD-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.bz2
opensim-SC_OLD-cf7020d73c238312e0d640fdf5fe795862f030f3.tar.xz
Mantis #2044
Thank you, salahzar, for a patch that corrects the behavior of PRIM_TYPE in llGetPrimitiveParams() and improves LSL conformance in llGetNumberOfSides();
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs101
1 files changed, 92 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c461d3d..26a52f2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3370,12 +3370,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3370 3370
3371 } 3371 }
3372 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces 3372 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
3373 private void hasCutHollowDimpleProfileCut(PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, 3373 private void hasCutHollowDimpleProfileCut(int primType,PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
3374 out bool hasDimple, out bool hasProfileCut) 3374 out bool hasDimple, out bool hasProfileCut)
3375 { 3375 {
3376 hasCut = (shape.PathBegin > 0) || (shape.PathEnd < 1); 3376 if (primType == ScriptBaseClass.PRIM_TYPE_BOX
3377 ||
3378 primType == ScriptBaseClass.PRIM_TYPE_CYLINDER
3379 ||
3380 primType == ScriptBaseClass.PRIM_TYPE_PRISM)
3381
3382 hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
3383 else
3384 hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
3385
3377 hasHollow = shape.ProfileHollow > 0; 3386 hasHollow = shape.ProfileHollow > 0;
3378 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd < 1); // taken from llSetPrimitiveParms 3387 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
3379 hasProfileCut = hasDimple; // is it the same thing? 3388 hasProfileCut = hasDimple; // is it the same thing?
3380 3389
3381 } 3390 }
@@ -3389,9 +3398,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3389 bool hasDimple; 3398 bool hasDimple;
3390 bool hasProfileCut; 3399 bool hasProfileCut;
3391 3400
3392 hasCutHollowDimpleProfileCut(m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); 3401 int primType = getScriptPrimType(m_host.Shape);
3402 hasCutHollowDimpleProfileCut(primType, m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
3393 3403
3394 switch (getScriptPrimType(m_host.Shape)) 3404 switch (primType)
3395 { 3405 {
3396 case ScriptBaseClass.PRIM_TYPE_BOX: 3406 case ScriptBaseClass.PRIM_TYPE_BOX:
3397 ret = 6; 3407 ret = 6;
@@ -3412,7 +3422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3412 ret = 1; 3422 ret = 1;
3413 if (hasCut) ret += 2; 3423 if (hasCut) ret += 2;
3414 if (hasDimple) ret += 2; 3424 if (hasDimple) ret += 2;
3415 if (hasHollow) ret += 1; // actually lsl adds 4!!!!!! is that a great mistake? 3425 if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1)
3416 break; 3426 break;
3417 case ScriptBaseClass.PRIM_TYPE_TORUS: 3427 case ScriptBaseClass.PRIM_TYPE_TORUS:
3418 ret = 1; 3428 ret = 1;
@@ -6013,15 +6023,88 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6013 break; 6023 break;
6014 6024
6015 case (int)ScriptBaseClass.PRIM_TYPE: 6025 case (int)ScriptBaseClass.PRIM_TYPE:
6016 // TODO-------------- 6026 // implementing box
6017 res.Add(new LSL_Types.LSLInteger(0)); 6027 PrimitiveBaseShape Shape = m_host.Shape;
6028 int primType = getScriptPrimType(m_host.Shape);
6029 res.Add(new LSL_Types.LSLInteger(primType));
6030 switch (primType)
6031 {
6032 case ScriptBaseClass.PRIM_TYPE_BOX:
6033 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
6034 case ScriptBaseClass.PRIM_TYPE_PRISM:
6035
6036 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6037 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6038 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6039 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6040 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6041 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6042 break;
6043
6044 case ScriptBaseClass.PRIM_TYPE_SPHERE:
6045 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6046 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6047 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6048 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6049 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6050
6051 break;
6052
6053
6054
6055 case ScriptBaseClass.PRIM_TYPE_SCULPT:
6056 res.Add(Shape.SculptTexture.ToString());
6057 res.Add(new LSL_Types.LSLInteger(Shape.SculptType));
6058
6059 break;
6060 case ScriptBaseClass.PRIM_TYPE_RING:
6061 case ScriptBaseClass.PRIM_TYPE_TUBE:
6062 case ScriptBaseClass.PRIM_TYPE_TORUS:
6063 // holeshape
6064 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6065
6066 // cut
6067 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6068
6069 // hollow
6070 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6071
6072 // twist
6073 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6074
6075 // vector holesize
6076 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6077
6078 // vector topshear
6079 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6080
6081 // vector profilecut
6082 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6083
6084
6085 // vector tapera
6086 res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
6087
6088 // float revolutions,
6089 res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :(
6090
6091 // float radiusoffset,
6092 res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0));
6093
6094 // float skew
6095 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0));
6096 break;
6097
6098
6099
6100 }
6018 break; 6101 break;
6019 6102
6020 case (int)ScriptBaseClass.PRIM_TEXTURE: 6103 case (int)ScriptBaseClass.PRIM_TEXTURE:
6021 if (remain < 1) 6104 if (remain < 1)
6022 return res; 6105 return res;
6023 6106
6024 int face=Convert.ToInt32(rules.Data[idx++]); 6107 int face = Convert.ToInt32("" + rules.Data[idx++]);
6025 if (face == -1) 6108 if (face == -1)
6026 face = 0; 6109 face = 0;
6027 6110