aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-01 23:35:52 +0000
committerMelanie Thielker2008-09-01 23:35:52 +0000
commit0e7bac07f65dc88057c33e366aa573471283476b (patch)
tree52fa60cd3385aa0f605126e574cc2880c008d350 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentThis is an attempt to fix the handling of constants in LSL. (diff)
downloadopensim-SC-0e7bac07f65dc88057c33e366aa573471283476b.zip
opensim-SC-0e7bac07f65dc88057c33e366aa573471283476b.tar.gz
opensim-SC-0e7bac07f65dc88057c33e366aa573471283476b.tar.bz2
opensim-SC-0e7bac07f65dc88057c33e366aa573471283476b.tar.xz
Thank you, Ewe Loon, for a patch that fixes various aspects of
llSetPrimitiveParams and llSetLinkPrimitiveParams
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs96
1 files changed, 48 insertions, 48 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a8c74ac..574760a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5177,7 +5177,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5177 return Util.Md5Hash(src + ":" + nonce.ToString()); 5177 return Util.Md5Hash(src + ":" + nonce.ToString());
5178 } 5178 }
5179 5179
5180 private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) 5180 private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist)
5181 { 5181 {
5182 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 5182 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
5183 5183
@@ -5220,38 +5220,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5220 hollow = 0.95f; 5220 hollow = 0.95f;
5221 } 5221 }
5222 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 5222 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
5223 if (twist.x < -0.5f) 5223 if (twist.x < -1.0f)
5224 { 5224 {
5225 twist.x = -0.5f; 5225 twist.x = -1.0f;
5226 } 5226 }
5227 if (twist.x > 0.5f) 5227 if (twist.x > 1.0f)
5228 { 5228 {
5229 twist.x = 0.5f; 5229 twist.x = 1.0f;
5230 } 5230 }
5231 if (twist.y < -0.5f) 5231 if (twist.y < -1.0f)
5232 { 5232 {
5233 twist.y = -0.5f; 5233 twist.y = -1.0f;
5234 } 5234 }
5235 if (twist.y > 0.5f) 5235 if (twist.y > 1.0f)
5236 { 5236 {
5237 twist.y = 0.5f; 5237 twist.y = 1.0f;
5238 } 5238 }
5239 shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); 5239 shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
5240 shapeBlock.PathTwist = (sbyte)(200 * twist.y); 5240 shapeBlock.PathTwist = (sbyte)(100 * twist.y);
5241 5241
5242 shapeBlock.ObjectLocalID = m_host.LocalId; 5242 shapeBlock.ObjectLocalID = part.LocalId;
5243 5243
5244 // retain pathcurve 5244 // retain pathcurve
5245 shapeBlock.PathCurve = m_host.Shape.PathCurve; 5245 shapeBlock.PathCurve = part.Shape.PathCurve;
5246 5246
5247 return shapeBlock; 5247 return shapeBlock;
5248 } 5248 }
5249 5249
5250 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) 5250 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge)
5251 { 5251 {
5252 ObjectShapePacket.ObjectDataBlock shapeBlock; 5252 ObjectShapePacket.ObjectDataBlock shapeBlock;
5253 5253
5254 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5254 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5255 5255
5256 shapeBlock.ProfileCurve += fudge; 5256 shapeBlock.ProfileCurve += fudge;
5257 5257
@@ -5271,8 +5271,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5271 { 5271 {
5272 taper_b.y = 2f; 5272 taper_b.y = 2f;
5273 } 5273 }
5274 shapeBlock.PathScaleX = (byte)(100 * taper_b.x); 5274 shapeBlock.PathScaleX = (byte)(100 * (2.0 - taper_b.x));
5275 shapeBlock.PathScaleY = (byte)(100 * taper_b.y); 5275 shapeBlock.PathScaleY = (byte)(100 * (2.0 - taper_b.y));
5276 if (topshear.x < -0.5f) 5276 if (topshear.x < -0.5f)
5277 { 5277 {
5278 topshear.x = -0.5f; 5278 topshear.x = -0.5f;
@@ -5292,14 +5292,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5292 shapeBlock.PathShearX = (byte)(100 * topshear.x); 5292 shapeBlock.PathShearX = (byte)(100 * topshear.x);
5293 shapeBlock.PathShearY = (byte)(100 * topshear.y); 5293 shapeBlock.PathShearY = (byte)(100 * topshear.y);
5294 5294
5295 m_host.UpdateShape(shapeBlock); 5295 part.UpdateShape(shapeBlock);
5296 } 5296 }
5297 5297
5298 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) 5298 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge)
5299 { 5299 {
5300 ObjectShapePacket.ObjectDataBlock shapeBlock; 5300 ObjectShapePacket.ObjectDataBlock shapeBlock;
5301 5301
5302 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5302 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5303 5303
5304 // profile/path swapped for a sphere 5304 // profile/path swapped for a sphere
5305 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 5305 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@@ -5333,14 +5333,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5333 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); 5333 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
5334 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); 5334 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
5335 5335
5336 m_host.UpdateShape(shapeBlock); 5336 part.UpdateShape(shapeBlock);
5337 } 5337 }
5338 5338
5339 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 5339 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
5340 { 5340 {
5341 ObjectShapePacket.ObjectDataBlock shapeBlock; 5341 ObjectShapePacket.ObjectDataBlock shapeBlock;
5342 5342
5343 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5343 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5344 5344
5345 shapeBlock.ProfileCurve += fudge; 5345 shapeBlock.ProfileCurve += fudge;
5346 5346
@@ -5432,7 +5432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5432 { 5432 {
5433 revolutions = 4f; 5433 revolutions = 4f;
5434 } 5434 }
5435 shapeBlock.PathRevolutions = (byte)(100 * revolutions); 5435 shapeBlock.PathRevolutions = (byte)(66.666667 * (revolutions - 1.0));
5436 // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 5436 // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1
5437 if (radiusoffset < 0f) 5437 if (radiusoffset < 0f)
5438 { 5438 {
@@ -5453,10 +5453,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5453 } 5453 }
5454 shapeBlock.PathSkew = (sbyte)(100 * skew); 5454 shapeBlock.PathSkew = (sbyte)(100 * skew);
5455 5455
5456 m_host.UpdateShape(shapeBlock); 5456 part.UpdateShape(shapeBlock);
5457 } 5457 }
5458 5458
5459 private void SetPrimitiveShapeParams(string map, int type) 5459 private void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
5460 { 5460 {
5461 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 5461 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
5462 LLUUID sculptId; 5462 LLUUID sculptId;
@@ -5467,7 +5467,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5467 return; 5467 return;
5468 } 5468 }
5469 5469
5470 shapeBlock.ObjectLocalID = m_host.LocalId; 5470 shapeBlock.ObjectLocalID = part.LocalId;
5471 shapeBlock.PathScaleX = 100; 5471 shapeBlock.PathScaleX = 100;
5472 shapeBlock.PathScaleY = 150; 5472 shapeBlock.PathScaleY = 150;
5473 5473
@@ -5481,11 +5481,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5481 } 5481 }
5482 5482
5483 // retain pathcurve 5483 // retain pathcurve
5484 shapeBlock.PathCurve = m_host.Shape.PathCurve; 5484 shapeBlock.PathCurve = part.Shape.PathCurve;
5485 5485
5486 m_host.Shape.SetSculptData((byte)type, sculptId); 5486 part.Shape.SetSculptData((byte)type, sculptId);
5487 m_host.Shape.SculptEntry = true; 5487 part.Shape.SculptEntry = true;
5488 m_host.UpdateShape(shapeBlock); 5488 part.UpdateShape(shapeBlock);
5489 } 5489 }
5490 5490
5491 public void llSetPrimitiveParams(LSL_Types.list rules) 5491 public void llSetPrimitiveParams(LSL_Types.list rules)
@@ -5572,8 +5572,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5572 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5572 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5573 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5573 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5574 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5574 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5575 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5575 part.Shape.PathCurve = (byte)Extrusion.Straight;
5576 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); 5576 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1);
5577 break; 5577 break;
5578 5578
5579 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 5579 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@@ -5586,9 +5586,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5586 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5586 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5587 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5587 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5588 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5588 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5589 m_host.Shape.ProfileShape = ProfileShape.Circle; 5589 part.Shape.ProfileShape = ProfileShape.Circle;
5590 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5590 part.Shape.PathCurve = (byte)Extrusion.Straight;
5591 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); 5591 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
5592 break; 5592 break;
5593 5593
5594 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 5594 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@@ -5601,8 +5601,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5601 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5601 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5602 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5602 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5603 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5603 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5604 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5604 part.Shape.PathCurve = (byte)Extrusion.Straight;
5605 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 3); 5605 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3);
5606 break; 5606 break;
5607 5607
5608 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 5608 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@@ -5614,8 +5614,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5614 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 5614 hollow = (float)Convert.ToDouble(rules.Data[idx++]);
5615 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5615 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5616 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple 5616 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple
5617 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5617 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5618 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); 5618 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5);
5619 break; 5619 break;
5620 5620
5621 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 5621 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@@ -5633,8 +5633,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5633 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5633 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5634 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5634 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5635 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5635 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5636 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5636 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5637 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); 5637 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0);
5638 break; 5638 break;
5639 5639
5640 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 5640 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@@ -5652,8 +5652,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5652 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5652 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5653 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5653 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5654 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5654 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5655 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5655 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5656 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); 5656 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1);
5657 break; 5657 break;
5658 5658
5659 case (int)ScriptBaseClass.PRIM_TYPE_RING: 5659 case (int)ScriptBaseClass.PRIM_TYPE_RING:
@@ -5671,8 +5671,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5671 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5671 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5672 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5672 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5673 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5673 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5674 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5674 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5675 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); 5675 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3);
5676 break; 5676 break;
5677 5677
5678 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 5678 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@@ -5681,8 +5681,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5681 5681
5682 string map = rules.Data[idx++].ToString(); 5682 string map = rules.Data[idx++].ToString();
5683 face = Convert.ToInt32(rules.Data[idx++].ToString()); // type 5683 face = Convert.ToInt32(rules.Data[idx++].ToString()); // type
5684 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5684 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5685 SetPrimitiveShapeParams(map, face); 5685 SetPrimitiveShapeParams(part, map, face);
5686 break; 5686 break;
5687 } 5687 }
5688 5688