aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs87
1 files changed, 47 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 d340ef2..a690e3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6608,7 +6608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6608 return Util.SHA1Hash(src).ToLower(); 6608 return Util.SHA1Hash(src).ToLower();
6609 } 6609 }
6610 6610
6611 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) 6611 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
6612 { 6612 {
6613 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6613 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6614 6614
@@ -6619,7 +6619,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6619 { 6619 {
6620 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; 6620 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
6621 } 6621 }
6622 shapeBlock.ProfileCurve = (byte)holeshape; 6622 shapeBlock.PathCurve = pathcurve;
6623 shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
6624 shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
6623 if (cut.x < 0f) 6625 if (cut.x < 0f)
6624 { 6626 {
6625 cut.x = 0f; 6627 cut.x = 0f;
@@ -6651,9 +6653,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6651 { 6653 {
6652 hollow = 0f; 6654 hollow = 0f;
6653 } 6655 }
6654 if (hollow > 0.95) 6656 // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
6657 // Box or Tube) and the hole shape is a square, hollow is limited to
6658 // a max of 70%. The viewer performs its own check on this value but
6659 // we need to do it here also so llGetPrimitiveParams can have access
6660 // to the correct value.
6661 if (profileshape != (byte)ProfileCurve.Square &&
6662 holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
6655 { 6663 {
6656 hollow = 0.95f; 6664 if (hollow > 0.70f)
6665 {
6666 hollow = 0.70f;
6667 }
6668 }
6669 // Otherwise, hollow is limited to 95%.
6670 else
6671 {
6672 if (hollow > 0.95f)
6673 {
6674 hollow = 0.95f;
6675 }
6657 } 6676 }
6658 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 6677 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
6659 if (twist.x < -1.0f) 6678 if (twist.x < -1.0f)
@@ -6677,20 +6696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6677 6696
6678 shapeBlock.ObjectLocalID = part.LocalId; 6697 shapeBlock.ObjectLocalID = part.LocalId;
6679 6698
6680 // retain pathcurve
6681 shapeBlock.PathCurve = part.Shape.PathCurve;
6682
6683 part.Shape.SculptEntry = false; 6699 part.Shape.SculptEntry = false;
6684 return shapeBlock; 6700 return shapeBlock;
6685 } 6701 }
6686 6702
6687 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) 6703 // Prim type box, cylinder and prism.
6704 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
6688 { 6705 {
6689 ObjectShapePacket.ObjectDataBlock shapeBlock; 6706 ObjectShapePacket.ObjectDataBlock shapeBlock;
6690 6707
6691 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6708 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6692
6693 shapeBlock.ProfileCurve += fudge;
6694 6709
6695 if (taper_b.x < 0f) 6710 if (taper_b.x < 0f)
6696 { 6711 {
@@ -6733,18 +6748,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6733 part.UpdateShape(shapeBlock); 6748 part.UpdateShape(shapeBlock);
6734 } 6749 }
6735 6750
6736 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) 6751 // Prim type sphere.
6752 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
6737 { 6753 {
6738 ObjectShapePacket.ObjectDataBlock shapeBlock; 6754 ObjectShapePacket.ObjectDataBlock shapeBlock;
6739 6755
6740 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6756 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6741 6757
6742 // profile/path swapped for a sphere 6758 // profile/path swapped for a sphere
6743 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 6759 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
6744 shapeBlock.PathEnd = shapeBlock.ProfileEnd; 6760 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
6745 6761
6746 shapeBlock.ProfileCurve += fudge;
6747
6748 shapeBlock.PathScaleX = 100; 6762 shapeBlock.PathScaleX = 100;
6749 shapeBlock.PathScaleY = 100; 6763 shapeBlock.PathScaleY = 100;
6750 6764
@@ -6775,13 +6789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6775 part.UpdateShape(shapeBlock); 6789 part.UpdateShape(shapeBlock);
6776 } 6790 }
6777 6791
6778 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 6792 // Prim type torus, tube and ring.
6793 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
6779 { 6794 {
6780 ObjectShapePacket.ObjectDataBlock shapeBlock; 6795 ObjectShapePacket.ObjectDataBlock shapeBlock;
6781 6796
6782 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6797 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6783
6784 shapeBlock.ProfileCurve += fudge;
6785 6798
6786 // profile/path swapped for a torrus, tube, ring 6799 // profile/path swapped for a torrus, tube, ring
6787 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 6800 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@@ -6901,7 +6914,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6901 part.UpdateShape(shapeBlock); 6914 part.UpdateShape(shapeBlock);
6902 } 6915 }
6903 6916
6904 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) 6917 // Prim type sculpt.
6918 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
6905 { 6919 {
6906 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6920 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6907 UUID sculptId; 6921 UUID sculptId;
@@ -6914,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6914 if (sculptId == UUID.Zero) 6928 if (sculptId == UUID.Zero)
6915 return; 6929 return;
6916 6930
6931 shapeBlock.PathCurve = pathcurve;
6917 shapeBlock.ObjectLocalID = part.LocalId; 6932 shapeBlock.ObjectLocalID = part.LocalId;
6918 shapeBlock.PathScaleX = 100; 6933 shapeBlock.PathScaleX = 100;
6919 shapeBlock.PathScaleY = 150; 6934 shapeBlock.PathScaleY = 150;
@@ -6927,9 +6942,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6927 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 6942 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
6928 } 6943 }
6929 6944
6930 // retain pathcurve
6931 shapeBlock.PathCurve = part.Shape.PathCurve;
6932
6933 part.Shape.SetSculptProperties((byte)type, sculptId); 6945 part.Shape.SetSculptProperties((byte)type, sculptId);
6934 part.Shape.SculptEntry = true; 6946 part.Shape.SculptEntry = true;
6935 part.UpdateShape(shapeBlock); 6947 part.UpdateShape(shapeBlock);
@@ -7053,8 +7065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7053 taper_b = rules.GetVector3Item(idx++); 7065 taper_b = rules.GetVector3Item(idx++);
7054 topshear = rules.GetVector3Item(idx++); 7066 topshear = rules.GetVector3Item(idx++);
7055 7067
7056 part.Shape.PathCurve = (byte)Extrusion.Straight; 7068 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7057 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); 7069 (byte)ProfileShape.Square, (byte)Extrusion.Straight);
7058 break; 7070 break;
7059 7071
7060 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 7072 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@@ -7067,9 +7079,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7067 twist = rules.GetVector3Item(idx++); 7079 twist = rules.GetVector3Item(idx++);
7068 taper_b = rules.GetVector3Item(idx++); 7080 taper_b = rules.GetVector3Item(idx++);
7069 topshear = rules.GetVector3Item(idx++); 7081 topshear = rules.GetVector3Item(idx++);
7070 part.Shape.ProfileShape = ProfileShape.Circle; 7082 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7071 part.Shape.PathCurve = (byte)Extrusion.Straight; 7083 (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
7072 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
7073 break; 7084 break;
7074 7085
7075 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 7086 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@@ -7082,8 +7093,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7082 twist = rules.GetVector3Item(idx++); 7093 twist = rules.GetVector3Item(idx++);
7083 taper_b = rules.GetVector3Item(idx++); 7094 taper_b = rules.GetVector3Item(idx++);
7084 topshear = rules.GetVector3Item(idx++); 7095 topshear = rules.GetVector3Item(idx++);
7085 part.Shape.PathCurve = (byte)Extrusion.Straight; 7096 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7086 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); 7097 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
7087 break; 7098 break;
7088 7099
7089 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 7100 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@@ -7095,8 +7106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7095 hollow = (float)rules.GetLSLFloatItem(idx++); 7106 hollow = (float)rules.GetLSLFloatItem(idx++);
7096 twist = rules.GetVector3Item(idx++); 7107 twist = rules.GetVector3Item(idx++);
7097 taper_b = rules.GetVector3Item(idx++); // dimple 7108 taper_b = rules.GetVector3Item(idx++); // dimple
7098 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7109 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
7099 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); 7110 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
7100 break; 7111 break;
7101 7112
7102 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 7113 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@@ -7114,9 +7125,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7114 revolutions = (float)rules.GetLSLFloatItem(idx++); 7125 revolutions = (float)rules.GetLSLFloatItem(idx++);
7115 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7126 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7116 skew = (float)rules.GetLSLFloatItem(idx++); 7127 skew = (float)rules.GetLSLFloatItem(idx++);
7117 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7118 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7128 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7119 revolutions, radiusoffset, skew, 0); 7129 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
7120 break; 7130 break;
7121 7131
7122 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 7132 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@@ -7134,9 +7144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7134 revolutions = (float)rules.GetLSLFloatItem(idx++); 7144 revolutions = (float)rules.GetLSLFloatItem(idx++);
7135 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7145 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7136 skew = (float)rules.GetLSLFloatItem(idx++); 7146 skew = (float)rules.GetLSLFloatItem(idx++);
7137 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7138 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7147 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7139 revolutions, radiusoffset, skew, 1); 7148 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
7140 break; 7149 break;
7141 7150
7142 case (int)ScriptBaseClass.PRIM_TYPE_RING: 7151 case (int)ScriptBaseClass.PRIM_TYPE_RING:
@@ -7154,9 +7163,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7154 revolutions = (float)rules.GetLSLFloatItem(idx++); 7163 revolutions = (float)rules.GetLSLFloatItem(idx++);
7155 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7164 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7156 skew = (float)rules.GetLSLFloatItem(idx++); 7165 skew = (float)rules.GetLSLFloatItem(idx++);
7157 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7158 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7166 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7159 revolutions, radiusoffset, skew, 3); 7167 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
7160 break; 7168 break;
7161 7169
7162 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 7170 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@@ -7165,8 +7173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7165 7173
7166 string map = rules.Data[idx++].ToString(); 7174 string map = rules.Data[idx++].ToString();
7167 face = (int)rules.GetLSLIntegerItem(idx++); // type 7175 face = (int)rules.GetLSLIntegerItem(idx++); // type
7168 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7176 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
7169 SetPrimitiveShapeParams(part, map, face);
7170 break; 7177 break;
7171 } 7178 }
7172 7179