diff options
author | Freaky Tech | 2015-03-04 18:30:11 +0100 |
---|---|---|
committer | BlueWall | 2015-03-04 12:45:37 -0500 |
commit | 2d8c1806cae0b4b00718d88dfe1f7a5d767a7307 (patch) | |
tree | 9c89c9caaf70a1f72f01c2bc689dcf252e59f344 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | simplify llStringToBase64 and llBase64ToString (diff) | |
download | opensim-SC_OLD-2d8c1806cae0b4b00718d88dfe1f7a5d767a7307.zip opensim-SC_OLD-2d8c1806cae0b4b00718d88dfe1f7a5d767a7307.tar.gz opensim-SC_OLD-2d8c1806cae0b4b00718d88dfe1f7a5d767a7307.tar.bz2 opensim-SC_OLD-2d8c1806cae0b4b00718d88dfe1f7a5d767a7307.tar.xz |
usability fixes for LSL API
exception based error messages were cryptic for casual users
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1616 |
1 files changed, 1409 insertions, 207 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 31ae64f..d0a0b03 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6456,17 +6456,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6456 | 6456 | ||
6457 | foreach (SceneObjectPart part in parts) | 6457 | foreach (SceneObjectPart part in parts) |
6458 | { | 6458 | { |
6459 | SetParticleSystem(part, rules); | 6459 | SetParticleSystem(part, rules, "llLinkParticleSystem"); |
6460 | } | 6460 | } |
6461 | } | 6461 | } |
6462 | 6462 | ||
6463 | public void llParticleSystem(LSL_List rules) | 6463 | public void llParticleSystem(LSL_List rules) |
6464 | { | 6464 | { |
6465 | m_host.AddScriptLPS(1); | 6465 | m_host.AddScriptLPS(1); |
6466 | SetParticleSystem(m_host, rules); | 6466 | SetParticleSystem(m_host, rules, "llParticleSystem"); |
6467 | } | 6467 | } |
6468 | 6468 | ||
6469 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) | 6469 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules, string originFunc) |
6470 | { | 6470 | { |
6471 | if (rules.Length == 0) | 6471 | if (rules.Length == 0) |
6472 | { | 6472 | { |
@@ -6483,62 +6483,152 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6483 | 6483 | ||
6484 | for (int i = 0; i < rules.Length; i += 2) | 6484 | for (int i = 0; i < rules.Length; i += 2) |
6485 | { | 6485 | { |
6486 | switch (rules.GetLSLIntegerItem(i)) | 6486 | int psystype; |
6487 | try | ||
6488 | { | ||
6489 | psystype = rules.GetLSLIntegerItem(i); | ||
6490 | } | ||
6491 | catch (InvalidCastException) | ||
6492 | { | ||
6493 | Error(originFunc, string.Format("Error running particle system params index #{0}: particle system parameter type must be integer", i)); | ||
6494 | return; | ||
6495 | } | ||
6496 | switch (psystype) | ||
6487 | { | 6497 | { |
6488 | case (int)ScriptBaseClass.PSYS_PART_FLAGS: | 6498 | case (int)ScriptBaseClass.PSYS_PART_FLAGS: |
6489 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); | 6499 | try |
6500 | { | ||
6501 | prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); | ||
6502 | } | ||
6503 | catch(InvalidCastException) | ||
6504 | { | ||
6505 | Error(originFunc, string.Format("Error running rule PSYS_PART_FLAGS: arg #{0} - parameter 1 must be integer", i + 1)); | ||
6506 | return; | ||
6507 | } | ||
6490 | break; | 6508 | break; |
6491 | 6509 | ||
6492 | case (int)ScriptBaseClass.PSYS_PART_START_COLOR: | 6510 | case (int)ScriptBaseClass.PSYS_PART_START_COLOR: |
6493 | tempv = rules.GetVector3Item(i + 1); | 6511 | try |
6512 | { | ||
6513 | tempv = rules.GetVector3Item(i + 1); | ||
6514 | } | ||
6515 | catch(InvalidCastException) | ||
6516 | { | ||
6517 | Error(originFunc, string.Format("Error running rule PSYS_PART_START_COLOR: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6518 | return; | ||
6519 | } | ||
6494 | prules.PartStartColor.R = (float)tempv.x; | 6520 | prules.PartStartColor.R = (float)tempv.x; |
6495 | prules.PartStartColor.G = (float)tempv.y; | 6521 | prules.PartStartColor.G = (float)tempv.y; |
6496 | prules.PartStartColor.B = (float)tempv.z; | 6522 | prules.PartStartColor.B = (float)tempv.z; |
6497 | break; | 6523 | break; |
6498 | 6524 | ||
6499 | case (int)ScriptBaseClass.PSYS_PART_START_ALPHA: | 6525 | case (int)ScriptBaseClass.PSYS_PART_START_ALPHA: |
6500 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6526 | try |
6527 | { | ||
6528 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6529 | } | ||
6530 | catch(InvalidCastException) | ||
6531 | { | ||
6532 | Error(originFunc, string.Format("Error running rule PSYS_PART_START_ALPHA: arg #{0} - parameter 1 must be float", i + 1)); | ||
6533 | return; | ||
6534 | } | ||
6501 | prules.PartStartColor.A = tempf; | 6535 | prules.PartStartColor.A = tempf; |
6502 | break; | 6536 | break; |
6503 | 6537 | ||
6504 | case (int)ScriptBaseClass.PSYS_PART_END_COLOR: | 6538 | case (int)ScriptBaseClass.PSYS_PART_END_COLOR: |
6505 | tempv = rules.GetVector3Item(i + 1); | 6539 | try |
6540 | { | ||
6541 | tempv = rules.GetVector3Item(i + 1); | ||
6542 | } | ||
6543 | catch(InvalidCastException) | ||
6544 | { | ||
6545 | Error(originFunc, string.Format("Error running rule PSYS_PART_END_COLOR: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6546 | return; | ||
6547 | } | ||
6506 | prules.PartEndColor.R = (float)tempv.x; | 6548 | prules.PartEndColor.R = (float)tempv.x; |
6507 | prules.PartEndColor.G = (float)tempv.y; | 6549 | prules.PartEndColor.G = (float)tempv.y; |
6508 | prules.PartEndColor.B = (float)tempv.z; | 6550 | prules.PartEndColor.B = (float)tempv.z; |
6509 | break; | 6551 | break; |
6510 | 6552 | ||
6511 | case (int)ScriptBaseClass.PSYS_PART_END_ALPHA: | 6553 | case (int)ScriptBaseClass.PSYS_PART_END_ALPHA: |
6512 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6554 | try |
6555 | { | ||
6556 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6557 | } | ||
6558 | catch(InvalidCastException) | ||
6559 | { | ||
6560 | Error(originFunc, string.Format("Error running rule PSYS_PART_END_ALPHA: arg #{0} - parameter 1 must be float", i + 1)); | ||
6561 | return; | ||
6562 | } | ||
6513 | prules.PartEndColor.A = tempf; | 6563 | prules.PartEndColor.A = tempf; |
6514 | break; | 6564 | break; |
6515 | 6565 | ||
6516 | case (int)ScriptBaseClass.PSYS_PART_START_SCALE: | 6566 | case (int)ScriptBaseClass.PSYS_PART_START_SCALE: |
6517 | tempv = rules.GetVector3Item(i + 1); | 6567 | try |
6568 | { | ||
6569 | tempv = rules.GetVector3Item(i + 1); | ||
6570 | } | ||
6571 | catch(InvalidCastException) | ||
6572 | { | ||
6573 | Error(originFunc, string.Format("Error running rule PSYS_PART_START_SCALE: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6574 | return; | ||
6575 | } | ||
6518 | prules.PartStartScaleX = validParticleScale((float)tempv.x); | 6576 | prules.PartStartScaleX = validParticleScale((float)tempv.x); |
6519 | prules.PartStartScaleY = validParticleScale((float)tempv.y); | 6577 | prules.PartStartScaleY = validParticleScale((float)tempv.y); |
6520 | break; | 6578 | break; |
6521 | 6579 | ||
6522 | case (int)ScriptBaseClass.PSYS_PART_END_SCALE: | 6580 | case (int)ScriptBaseClass.PSYS_PART_END_SCALE: |
6523 | tempv = rules.GetVector3Item(i + 1); | 6581 | try |
6582 | { | ||
6583 | tempv = rules.GetVector3Item(i + 1); | ||
6584 | } | ||
6585 | catch(InvalidCastException) | ||
6586 | { | ||
6587 | Error(originFunc, string.Format("Error running rule PSYS_PART_END_SCALE: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6588 | return; | ||
6589 | } | ||
6524 | prules.PartEndScaleX = validParticleScale((float)tempv.x); | 6590 | prules.PartEndScaleX = validParticleScale((float)tempv.x); |
6525 | prules.PartEndScaleY = validParticleScale((float)tempv.y); | 6591 | prules.PartEndScaleY = validParticleScale((float)tempv.y); |
6526 | break; | 6592 | break; |
6527 | 6593 | ||
6528 | case (int)ScriptBaseClass.PSYS_PART_MAX_AGE: | 6594 | case (int)ScriptBaseClass.PSYS_PART_MAX_AGE: |
6529 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6595 | try |
6596 | { | ||
6597 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6598 | } | ||
6599 | catch(InvalidCastException) | ||
6600 | { | ||
6601 | Error(originFunc, string.Format("Error running rule PSYS_PART_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1)); | ||
6602 | return; | ||
6603 | } | ||
6530 | prules.PartMaxAge = tempf; | 6604 | prules.PartMaxAge = tempf; |
6531 | break; | 6605 | break; |
6532 | 6606 | ||
6533 | case (int)ScriptBaseClass.PSYS_SRC_ACCEL: | 6607 | case (int)ScriptBaseClass.PSYS_SRC_ACCEL: |
6534 | tempv = rules.GetVector3Item(i + 1); | 6608 | try |
6609 | { | ||
6610 | tempv = rules.GetVector3Item(i + 1); | ||
6611 | } | ||
6612 | catch(InvalidCastException) | ||
6613 | { | ||
6614 | Error(originFunc, string.Format("Error running rule PSYS_SRC_ACCEL: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6615 | return; | ||
6616 | } | ||
6535 | prules.PartAcceleration.X = (float)tempv.x; | 6617 | prules.PartAcceleration.X = (float)tempv.x; |
6536 | prules.PartAcceleration.Y = (float)tempv.y; | 6618 | prules.PartAcceleration.Y = (float)tempv.y; |
6537 | prules.PartAcceleration.Z = (float)tempv.z; | 6619 | prules.PartAcceleration.Z = (float)tempv.z; |
6538 | break; | 6620 | break; |
6539 | 6621 | ||
6540 | case (int)ScriptBaseClass.PSYS_SRC_PATTERN: | 6622 | case (int)ScriptBaseClass.PSYS_SRC_PATTERN: |
6541 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | 6623 | try |
6624 | { | ||
6625 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | ||
6626 | } | ||
6627 | catch(InvalidCastException) | ||
6628 | { | ||
6629 | Error(originFunc, string.Format("Error running rule PSYS_SRC_PATTERN: arg #{0} - parameter 1 must be integer", i + 1)); | ||
6630 | return; | ||
6631 | } | ||
6542 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; | 6632 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; |
6543 | break; | 6633 | break; |
6544 | 6634 | ||
@@ -6547,67 +6637,171 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6547 | // client tells the difference between the two by looking at the 0x02 bit in | 6637 | // client tells the difference between the two by looking at the 0x02 bit in |
6548 | // the PartFlags variable. | 6638 | // the PartFlags variable. |
6549 | case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE: | 6639 | case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE: |
6550 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6640 | try |
6641 | { | ||
6642 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6643 | } | ||
6644 | catch(InvalidCastException) | ||
6645 | { | ||
6646 | Error(originFunc, string.Format("Error running rule PSYS_SRC_INNERANGLE: arg #{0} - parameter 1 must be float", i + 1)); | ||
6647 | return; | ||
6648 | } | ||
6551 | prules.InnerAngle = (float)tempf; | 6649 | prules.InnerAngle = (float)tempf; |
6552 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. | 6650 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. |
6553 | break; | 6651 | break; |
6554 | 6652 | ||
6555 | case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE: | 6653 | case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE: |
6556 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6654 | try |
6655 | { | ||
6656 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6657 | } | ||
6658 | catch(InvalidCastException) | ||
6659 | { | ||
6660 | Error(originFunc, string.Format("Error running rule PSYS_SRC_OUTERANGLE: arg #{0} - parameter 1 must be float", i + 1)); | ||
6661 | return; | ||
6662 | } | ||
6557 | prules.OuterAngle = (float)tempf; | 6663 | prules.OuterAngle = (float)tempf; |
6558 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. | 6664 | prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. |
6559 | break; | 6665 | break; |
6560 | 6666 | ||
6561 | case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE: | 6667 | case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE: |
6562 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | 6668 | try |
6669 | { | ||
6670 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | ||
6671 | } | ||
6672 | catch(InvalidCastException) | ||
6673 | { | ||
6674 | Error(originFunc, string.Format("Error running rule PSYS_PART_BLEND_FUNC_SOURCE: arg #{0} - parameter 1 must be integer", i + 1)); | ||
6675 | return; | ||
6676 | } | ||
6563 | prules.BlendFuncSource = (byte)tmpi; | 6677 | prules.BlendFuncSource = (byte)tmpi; |
6564 | break; | 6678 | break; |
6565 | 6679 | ||
6566 | case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST: | 6680 | case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST: |
6567 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | 6681 | try |
6682 | { | ||
6683 | tmpi = (int)rules.GetLSLIntegerItem(i + 1); | ||
6684 | } | ||
6685 | catch(InvalidCastException) | ||
6686 | { | ||
6687 | Error(originFunc, string.Format("Error running rule PSYS_PART_BLEND_FUNC_DEST: arg #{0} - parameter 1 must be integer", i + 1)); | ||
6688 | return; | ||
6689 | } | ||
6568 | prules.BlendFuncDest = (byte)tmpi; | 6690 | prules.BlendFuncDest = (byte)tmpi; |
6569 | break; | 6691 | break; |
6570 | 6692 | ||
6571 | case (int)ScriptBaseClass.PSYS_PART_START_GLOW: | 6693 | case (int)ScriptBaseClass.PSYS_PART_START_GLOW: |
6572 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6694 | try |
6695 | { | ||
6696 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6697 | } | ||
6698 | catch(InvalidCastException) | ||
6699 | { | ||
6700 | Error(originFunc, string.Format("Error running rule PSYS_PART_START_GLOW: arg #{0} - parameter 1 must be float", i + 1)); | ||
6701 | return; | ||
6702 | } | ||
6573 | prules.PartStartGlow = (float)tempf; | 6703 | prules.PartStartGlow = (float)tempf; |
6574 | break; | 6704 | break; |
6575 | 6705 | ||
6576 | case (int)ScriptBaseClass.PSYS_PART_END_GLOW: | 6706 | case (int)ScriptBaseClass.PSYS_PART_END_GLOW: |
6577 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6707 | try |
6708 | { | ||
6709 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6710 | } | ||
6711 | catch(InvalidCastException) | ||
6712 | { | ||
6713 | Error(originFunc, string.Format("Error running rule PSYS_PART_END_GLOW: arg #{0} - parameter 1 must be float", i + 1)); | ||
6714 | return; | ||
6715 | } | ||
6578 | prules.PartEndGlow = (float)tempf; | 6716 | prules.PartEndGlow = (float)tempf; |
6579 | break; | 6717 | break; |
6580 | 6718 | ||
6581 | case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: | 6719 | case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: |
6582 | prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1)); | 6720 | try |
6721 | { | ||
6722 | prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1)); | ||
6723 | } | ||
6724 | catch(InvalidCastException) | ||
6725 | { | ||
6726 | Error(originFunc, string.Format("Error running rule PSYS_SRC_TEXTURE: arg #{0} - parameter 1 must be string or key", i + 1)); | ||
6727 | return; | ||
6728 | } | ||
6583 | break; | 6729 | break; |
6584 | 6730 | ||
6585 | case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: | 6731 | case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: |
6586 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6732 | try |
6733 | { | ||
6734 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6735 | } | ||
6736 | catch(InvalidCastException) | ||
6737 | { | ||
6738 | Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_RATE: arg #{0} - parameter 1 must be float", i + 1)); | ||
6739 | return; | ||
6740 | } | ||
6587 | prules.BurstRate = (float)tempf; | 6741 | prules.BurstRate = (float)tempf; |
6588 | break; | 6742 | break; |
6589 | 6743 | ||
6590 | case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT: | 6744 | case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT: |
6591 | prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1); | 6745 | try |
6746 | { | ||
6747 | prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1); | ||
6748 | } | ||
6749 | catch(InvalidCastException) | ||
6750 | { | ||
6751 | Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_PART_COUNT: arg #{0} - parameter 1 must be integer", i + 1)); | ||
6752 | return; | ||
6753 | } | ||
6592 | break; | 6754 | break; |
6593 | 6755 | ||
6594 | case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS: | 6756 | case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS: |
6595 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6757 | try |
6758 | { | ||
6759 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6760 | } | ||
6761 | catch(InvalidCastException) | ||
6762 | { | ||
6763 | Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_RADIUS: arg #{0} - parameter 1 must be float", i + 1)); | ||
6764 | return; | ||
6765 | } | ||
6596 | prules.BurstRadius = (float)tempf; | 6766 | prules.BurstRadius = (float)tempf; |
6597 | break; | 6767 | break; |
6598 | 6768 | ||
6599 | case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN: | 6769 | case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN: |
6600 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6770 | try |
6771 | { | ||
6772 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6773 | } | ||
6774 | catch(InvalidCastException) | ||
6775 | { | ||
6776 | Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_SPEED_MIN: arg #{0} - parameter 1 must be float", i + 1)); | ||
6777 | return; | ||
6778 | } | ||
6601 | prules.BurstSpeedMin = (float)tempf; | 6779 | prules.BurstSpeedMin = (float)tempf; |
6602 | break; | 6780 | break; |
6603 | 6781 | ||
6604 | case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX: | 6782 | case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX: |
6605 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6783 | try |
6784 | { | ||
6785 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6786 | } | ||
6787 | catch(InvalidCastException) | ||
6788 | { | ||
6789 | Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_SPEED_MAX: arg #{0} - parameter 1 must be float", i + 1)); | ||
6790 | return; | ||
6791 | } | ||
6606 | prules.BurstSpeedMax = (float)tempf; | 6792 | prules.BurstSpeedMax = (float)tempf; |
6607 | break; | 6793 | break; |
6608 | 6794 | ||
6609 | case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE: | 6795 | case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE: |
6610 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6796 | try |
6797 | { | ||
6798 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6799 | } | ||
6800 | catch(InvalidCastException) | ||
6801 | { | ||
6802 | Error(originFunc, string.Format("Error running rule PSYS_SRC_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1)); | ||
6803 | return; | ||
6804 | } | ||
6611 | prules.MaxAge = (float)tempf; | 6805 | prules.MaxAge = (float)tempf; |
6612 | break; | 6806 | break; |
6613 | 6807 | ||
@@ -6625,20 +6819,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6625 | 6819 | ||
6626 | case (int)ScriptBaseClass.PSYS_SRC_OMEGA: | 6820 | case (int)ScriptBaseClass.PSYS_SRC_OMEGA: |
6627 | // AL: This is an assumption, since it is the only thing that would match. | 6821 | // AL: This is an assumption, since it is the only thing that would match. |
6628 | tempv = rules.GetVector3Item(i + 1); | 6822 | try |
6823 | { | ||
6824 | tempv = rules.GetVector3Item(i + 1); | ||
6825 | } | ||
6826 | catch(InvalidCastException) | ||
6827 | { | ||
6828 | Error(originFunc, string.Format("Error running rule PSYS_SRC_OMEGA: arg #{0} - parameter 1 must be vector", i + 1)); | ||
6829 | return; | ||
6830 | } | ||
6629 | prules.AngularVelocity.X = (float)tempv.x; | 6831 | prules.AngularVelocity.X = (float)tempv.x; |
6630 | prules.AngularVelocity.Y = (float)tempv.y; | 6832 | prules.AngularVelocity.Y = (float)tempv.y; |
6631 | prules.AngularVelocity.Z = (float)tempv.z; | 6833 | prules.AngularVelocity.Z = (float)tempv.z; |
6632 | break; | 6834 | break; |
6633 | 6835 | ||
6634 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: | 6836 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: |
6635 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6837 | try |
6838 | { | ||
6839 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6840 | } | ||
6841 | catch(InvalidCastException) | ||
6842 | { | ||
6843 | Error(originFunc, string.Format("Error running rule PSYS_SRC_ANGLE_BEGIN: arg #{0} - parameter 1 must be float", i + 1)); | ||
6844 | return; | ||
6845 | } | ||
6636 | prules.InnerAngle = (float)tempf; | 6846 | prules.InnerAngle = (float)tempf; |
6637 | prules.PartFlags |= 0x02; // Set new angle format. | 6847 | prules.PartFlags |= 0x02; // Set new angle format. |
6638 | break; | 6848 | break; |
6639 | 6849 | ||
6640 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: | 6850 | case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: |
6641 | tempf = (float)rules.GetLSLFloatItem(i + 1); | 6851 | try |
6852 | { | ||
6853 | tempf = (float)rules.GetLSLFloatItem(i + 1); | ||
6854 | } | ||
6855 | catch (InvalidCastException) | ||
6856 | { | ||
6857 | Error(originFunc, string.Format("Error running rule PSYS_SRC_ANGLE_END: arg #{0} - parameter 1 must be float", i + 1)); | ||
6858 | return; | ||
6859 | } | ||
6642 | prules.OuterAngle = (float)tempf; | 6860 | prules.OuterAngle = (float)tempf; |
6643 | prules.PartFlags |= 0x02; // Set new angle format. | 6861 | prules.PartFlags |= 0x02; // Set new angle format. |
6644 | break; | 6862 | break; |
@@ -7581,7 +7799,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7581 | 7799 | ||
7582 | while (remaining != null && remaining.Length > 2) | 7800 | while (remaining != null && remaining.Length > 2) |
7583 | { | 7801 | { |
7584 | int linknumber = remaining.GetLSLIntegerItem(0); | 7802 | int linknumber; |
7803 | try | ||
7804 | { | ||
7805 | linknumber = remaining.GetLSLIntegerItem(0); | ||
7806 | } | ||
7807 | catch(InvalidCastException) | ||
7808 | { | ||
7809 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_LINK_TARGET: parameter 2 must be integer", rulesParsed)); | ||
7810 | return; | ||
7811 | } | ||
7812 | |||
7585 | rules = remaining.GetSublist(1, -1); | 7813 | rules = remaining.GetSublist(1, -1); |
7586 | entities = GetLinkEntities(linknumber); | 7814 | entities = GetLinkEntities(linknumber); |
7587 | 7815 | ||
@@ -7755,17 +7983,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7755 | 7983 | ||
7756 | switch (code) | 7984 | switch (code) |
7757 | { | 7985 | { |
7758 | case (int)ScriptBaseClass.PRIM_POSITION: | 7986 | case ScriptBaseClass.PRIM_POSITION: |
7759 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 7987 | case ScriptBaseClass.PRIM_POS_LOCAL: |
7760 | if (remain < 1) | 7988 | if (remain < 1) |
7761 | return null; | 7989 | return null; |
7762 | 7990 | ||
7763 | v=rules.GetVector3Item(idx++); | 7991 | try |
7992 | { | ||
7993 | v = rules.GetVector3Item(idx++); | ||
7994 | } | ||
7995 | catch(InvalidCastException) | ||
7996 | { | ||
7997 | if(code == ScriptBaseClass.PRIM_POSITION) | ||
7998 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1)); | ||
7999 | else | ||
8000 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8001 | return null; | ||
8002 | } | ||
7764 | positionChanged = true; | 8003 | positionChanged = true; |
7765 | currentPosition = GetSetPosTarget(part, v, currentPosition); | 8004 | currentPosition = GetSetPosTarget(part, v, currentPosition); |
7766 | 8005 | ||
7767 | break; | 8006 | break; |
7768 | case (int)ScriptBaseClass.PRIM_SIZE: | 8007 | case ScriptBaseClass.PRIM_SIZE: |
7769 | if (remain < 1) | 8008 | if (remain < 1) |
7770 | return null; | 8009 | return null; |
7771 | 8010 | ||
@@ -7773,11 +8012,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7773 | SetScale(part, v); | 8012 | SetScale(part, v); |
7774 | 8013 | ||
7775 | break; | 8014 | break; |
7776 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8015 | case ScriptBaseClass.PRIM_ROTATION: |
7777 | if (remain < 1) | 8016 | if (remain < 1) |
7778 | return null; | 8017 | return null; |
7779 | 8018 | LSL_Rotation q; | |
7780 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | 8019 | try |
8020 | { | ||
8021 | q = rules.GetQuaternionItem(idx++); | ||
8022 | } | ||
8023 | catch(InvalidCastException) | ||
8024 | { | ||
8025 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 1 must be rotation", rulesParsed, idx - idxStart - 1)); | ||
8026 | return null; | ||
8027 | } | ||
7781 | // try to let this work as in SL... | 8028 | // try to let this work as in SL... |
7782 | if (part.ParentID == 0) | 8029 | if (part.ParentID == 0) |
7783 | { | 8030 | { |
@@ -7793,11 +8040,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7793 | 8040 | ||
7794 | break; | 8041 | break; |
7795 | 8042 | ||
7796 | case (int)ScriptBaseClass.PRIM_TYPE: | 8043 | case ScriptBaseClass.PRIM_TYPE: |
7797 | if (remain < 3) | 8044 | if (remain < 3) |
7798 | return null; | 8045 | return null; |
7799 | 8046 | ||
7800 | code = (int)rules.GetLSLIntegerItem(idx++); | 8047 | try |
8048 | { | ||
8049 | code = (int)rules.GetLSLIntegerItem(idx++); | ||
8050 | } | ||
8051 | catch(InvalidCastException) | ||
8052 | { | ||
8053 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8054 | return null; | ||
8055 | } | ||
7801 | 8056 | ||
7802 | remain = rules.Length - idx; | 8057 | remain = rules.Length - idx; |
7803 | float hollow; | 8058 | float hollow; |
@@ -7812,140 +8067,625 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7812 | 8067 | ||
7813 | switch (code) | 8068 | switch (code) |
7814 | { | 8069 | { |
7815 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | 8070 | case ScriptBaseClass.PRIM_TYPE_BOX: |
7816 | if (remain < 6) | 8071 | if (remain < 6) |
7817 | return null; | 8072 | return null; |
7818 | 8073 | ||
7819 | face = (int)rules.GetLSLIntegerItem(idx++); | 8074 | try |
7820 | v = rules.GetVector3Item(idx++); // cut | 8075 | { |
7821 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8076 | face = (int)rules.GetLSLIntegerItem(idx++); |
7822 | twist = rules.GetVector3Item(idx++); | 8077 | } |
7823 | taper_b = rules.GetVector3Item(idx++); | 8078 | catch(InvalidCastException) |
7824 | topshear = rules.GetVector3Item(idx++); | 8079 | { |
8080 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8081 | return null; | ||
8082 | } | ||
8083 | try | ||
8084 | { | ||
8085 | v = rules.GetVector3Item(idx++); // cut | ||
8086 | } | ||
8087 | catch(InvalidCastException) | ||
8088 | { | ||
8089 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8090 | return null; | ||
8091 | } | ||
8092 | try | ||
8093 | { | ||
8094 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8095 | } | ||
8096 | catch(InvalidCastException) | ||
8097 | { | ||
8098 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
8099 | return null; | ||
8100 | } | ||
8101 | try | ||
8102 | { | ||
8103 | twist = rules.GetVector3Item(idx++); | ||
8104 | } | ||
8105 | catch(InvalidCastException) | ||
8106 | { | ||
8107 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 5 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8108 | return null; | ||
8109 | } | ||
8110 | try | ||
8111 | { | ||
8112 | taper_b = rules.GetVector3Item(idx++); | ||
8113 | } | ||
8114 | catch(InvalidCastException) | ||
8115 | { | ||
8116 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8117 | return null; | ||
8118 | } | ||
8119 | try | ||
8120 | { | ||
8121 | topshear = rules.GetVector3Item(idx++); | ||
8122 | } | ||
8123 | catch(InvalidCastException) | ||
8124 | { | ||
8125 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8126 | return null; | ||
8127 | } | ||
7825 | 8128 | ||
7826 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 8129 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7827 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); | 8130 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); |
7828 | break; | 8131 | break; |
7829 | 8132 | ||
7830 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 8133 | case ScriptBaseClass.PRIM_TYPE_CYLINDER: |
7831 | if (remain < 6) | 8134 | if (remain < 6) |
7832 | return null; | 8135 | return null; |
7833 | 8136 | ||
7834 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8137 | try |
7835 | v = rules.GetVector3Item(idx++); // cut | 8138 | { |
7836 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8139 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7837 | twist = rules.GetVector3Item(idx++); | 8140 | } |
7838 | taper_b = rules.GetVector3Item(idx++); | 8141 | catch(InvalidCastException) |
7839 | topshear = rules.GetVector3Item(idx++); | 8142 | { |
8143 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8144 | return null; | ||
8145 | } | ||
8146 | try | ||
8147 | { | ||
8148 | v = rules.GetVector3Item(idx++); // cut | ||
8149 | } | ||
8150 | catch(InvalidCastException) | ||
8151 | { | ||
8152 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8153 | return null; | ||
8154 | } | ||
8155 | try | ||
8156 | { | ||
8157 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8158 | } | ||
8159 | catch(InvalidCastException) | ||
8160 | { | ||
8161 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8162 | return null; | ||
8163 | } | ||
8164 | try | ||
8165 | { | ||
8166 | twist = rules.GetVector3Item(idx++); | ||
8167 | } | ||
8168 | catch(InvalidCastException) | ||
8169 | { | ||
8170 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8171 | return null; | ||
8172 | } | ||
8173 | try | ||
8174 | { | ||
8175 | taper_b = rules.GetVector3Item(idx++); | ||
8176 | } | ||
8177 | catch(InvalidCastException) | ||
8178 | { | ||
8179 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8180 | return null; | ||
8181 | } | ||
8182 | try | ||
8183 | { | ||
8184 | topshear = rules.GetVector3Item(idx++); | ||
8185 | } | ||
8186 | catch(InvalidCastException) | ||
8187 | { | ||
8188 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8189 | return null; | ||
8190 | } | ||
7840 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 8191 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7841 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); | 8192 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); |
7842 | break; | 8193 | break; |
7843 | 8194 | ||
7844 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 8195 | case ScriptBaseClass.PRIM_TYPE_PRISM: |
7845 | if (remain < 6) | 8196 | if (remain < 6) |
7846 | return null; | 8197 | return null; |
7847 | 8198 | ||
7848 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8199 | try |
7849 | v = rules.GetVector3Item(idx++); //cut | 8200 | { |
7850 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8201 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7851 | twist = rules.GetVector3Item(idx++); | 8202 | } |
7852 | taper_b = rules.GetVector3Item(idx++); | 8203 | catch(InvalidCastException) |
7853 | topshear = rules.GetVector3Item(idx++); | 8204 | { |
8205 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8206 | return null; | ||
8207 | } | ||
8208 | try | ||
8209 | { | ||
8210 | v = rules.GetVector3Item(idx++); //cut | ||
8211 | } | ||
8212 | catch(InvalidCastException) | ||
8213 | { | ||
8214 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8215 | return null; | ||
8216 | } | ||
8217 | try | ||
8218 | { | ||
8219 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8220 | } | ||
8221 | catch(InvalidCastException) | ||
8222 | { | ||
8223 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8224 | return null; | ||
8225 | } | ||
8226 | try | ||
8227 | { | ||
8228 | twist = rules.GetVector3Item(idx++); | ||
8229 | } | ||
8230 | catch(InvalidCastException) | ||
8231 | { | ||
8232 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8233 | return null; | ||
8234 | } | ||
8235 | try | ||
8236 | { | ||
8237 | taper_b = rules.GetVector3Item(idx++); | ||
8238 | } | ||
8239 | catch(InvalidCastException) | ||
8240 | { | ||
8241 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8242 | return null; | ||
8243 | } | ||
8244 | try | ||
8245 | { | ||
8246 | topshear = rules.GetVector3Item(idx++); | ||
8247 | } | ||
8248 | catch(InvalidCastException) | ||
8249 | { | ||
8250 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8251 | return null; | ||
8252 | } | ||
7854 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 8253 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, |
7855 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); | 8254 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); |
7856 | break; | 8255 | break; |
7857 | 8256 | ||
7858 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 8257 | case ScriptBaseClass.PRIM_TYPE_SPHERE: |
7859 | if (remain < 5) | 8258 | if (remain < 5) |
7860 | return null; | 8259 | return null; |
7861 | 8260 | ||
7862 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8261 | try |
7863 | v = rules.GetVector3Item(idx++); // cut | 8262 | { |
7864 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8263 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7865 | twist = rules.GetVector3Item(idx++); | 8264 | } |
7866 | taper_b = rules.GetVector3Item(idx++); // dimple | 8265 | catch(InvalidCastException) |
8266 | { | ||
8267 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8268 | return null; | ||
8269 | } | ||
8270 | try | ||
8271 | { | ||
8272 | v = rules.GetVector3Item(idx++); // cut | ||
8273 | } | ||
8274 | catch(InvalidCastException) | ||
8275 | { | ||
8276 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8277 | return null; | ||
8278 | } | ||
8279 | try | ||
8280 | { | ||
8281 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8282 | } | ||
8283 | catch(InvalidCastException) | ||
8284 | { | ||
8285 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8286 | return null; | ||
8287 | } | ||
8288 | try | ||
8289 | { | ||
8290 | twist = rules.GetVector3Item(idx++); | ||
8291 | } | ||
8292 | catch(InvalidCastException) | ||
8293 | { | ||
8294 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8295 | return null; | ||
8296 | } | ||
8297 | try | ||
8298 | { | ||
8299 | taper_b = rules.GetVector3Item(idx++); // dimple | ||
8300 | } | ||
8301 | catch(InvalidCastException) | ||
8302 | { | ||
8303 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8304 | return null; | ||
8305 | } | ||
7867 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, | 8306 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, |
7868 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); | 8307 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); |
7869 | break; | 8308 | break; |
7870 | 8309 | ||
7871 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 8310 | case ScriptBaseClass.PRIM_TYPE_TORUS: |
7872 | if (remain < 11) | 8311 | if (remain < 11) |
7873 | return null; | 8312 | return null; |
7874 | 8313 | ||
7875 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8314 | try |
7876 | v = rules.GetVector3Item(idx++); //cut | 8315 | { |
7877 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8316 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7878 | twist = rules.GetVector3Item(idx++); | 8317 | } |
7879 | holesize = rules.GetVector3Item(idx++); | 8318 | catch(InvalidCastException) |
7880 | topshear = rules.GetVector3Item(idx++); | 8319 | { |
7881 | profilecut = rules.GetVector3Item(idx++); | 8320 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); |
7882 | taper_b = rules.GetVector3Item(idx++); // taper_a | 8321 | return null; |
7883 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 8322 | } |
7884 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 8323 | try |
7885 | skew = (float)rules.GetLSLFloatItem(idx++); | 8324 | { |
8325 | v = rules.GetVector3Item(idx++); //cut | ||
8326 | } | ||
8327 | catch(InvalidCastException) | ||
8328 | { | ||
8329 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8330 | return null; | ||
8331 | } | ||
8332 | try | ||
8333 | { | ||
8334 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8335 | } | ||
8336 | catch(InvalidCastException) | ||
8337 | { | ||
8338 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8339 | return null; | ||
8340 | } | ||
8341 | try | ||
8342 | { | ||
8343 | twist = rules.GetVector3Item(idx++); | ||
8344 | } | ||
8345 | catch(InvalidCastException) | ||
8346 | { | ||
8347 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8348 | return null; | ||
8349 | } | ||
8350 | try | ||
8351 | { | ||
8352 | holesize = rules.GetVector3Item(idx++); | ||
8353 | } | ||
8354 | catch(InvalidCastException) | ||
8355 | { | ||
8356 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8357 | return null; | ||
8358 | } | ||
8359 | try | ||
8360 | { | ||
8361 | topshear = rules.GetVector3Item(idx++); | ||
8362 | } | ||
8363 | catch(InvalidCastException) | ||
8364 | { | ||
8365 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8366 | return null; | ||
8367 | } | ||
8368 | try | ||
8369 | { | ||
8370 | profilecut = rules.GetVector3Item(idx++); | ||
8371 | } | ||
8372 | catch(InvalidCastException) | ||
8373 | { | ||
8374 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8375 | return null; | ||
8376 | } | ||
8377 | try | ||
8378 | { | ||
8379 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
8380 | } | ||
8381 | catch(InvalidCastException) | ||
8382 | { | ||
8383 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8384 | return null; | ||
8385 | } | ||
8386 | try | ||
8387 | { | ||
8388 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
8389 | } | ||
8390 | catch(InvalidCastException) | ||
8391 | { | ||
8392 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1)); | ||
8393 | return null; | ||
8394 | } | ||
8395 | try | ||
8396 | { | ||
8397 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
8398 | } | ||
8399 | catch(InvalidCastException) | ||
8400 | { | ||
8401 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1)); | ||
8402 | return null; | ||
8403 | } | ||
8404 | try | ||
8405 | { | ||
8406 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
8407 | } | ||
8408 | catch(InvalidCastException) | ||
8409 | { | ||
8410 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 13 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8411 | return null; | ||
8412 | } | ||
7886 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 8413 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7887 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); | 8414 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); |
7888 | break; | 8415 | break; |
7889 | 8416 | ||
7890 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 8417 | case ScriptBaseClass.PRIM_TYPE_TUBE: |
7891 | if (remain < 11) | 8418 | if (remain < 11) |
7892 | return null; | 8419 | return null; |
7893 | 8420 | ||
7894 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8421 | try |
7895 | v = rules.GetVector3Item(idx++); //cut | 8422 | { |
7896 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8423 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7897 | twist = rules.GetVector3Item(idx++); | 8424 | } |
7898 | holesize = rules.GetVector3Item(idx++); | 8425 | catch(InvalidCastException) |
7899 | topshear = rules.GetVector3Item(idx++); | 8426 | { |
7900 | profilecut = rules.GetVector3Item(idx++); | 8427 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); |
7901 | taper_b = rules.GetVector3Item(idx++); // taper_a | 8428 | return null; |
7902 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 8429 | } |
7903 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 8430 | try |
7904 | skew = (float)rules.GetLSLFloatItem(idx++); | 8431 | { |
8432 | v = rules.GetVector3Item(idx++); //cut | ||
8433 | } | ||
8434 | catch(InvalidCastException) | ||
8435 | { | ||
8436 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8437 | return null; | ||
8438 | } | ||
8439 | try | ||
8440 | { | ||
8441 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8442 | } | ||
8443 | catch(InvalidCastException) | ||
8444 | { | ||
8445 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8446 | return null; | ||
8447 | } | ||
8448 | try | ||
8449 | { | ||
8450 | twist = rules.GetVector3Item(idx++); | ||
8451 | } | ||
8452 | catch(InvalidCastException) | ||
8453 | { | ||
8454 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8455 | return null; | ||
8456 | } | ||
8457 | try | ||
8458 | { | ||
8459 | holesize = rules.GetVector3Item(idx++); | ||
8460 | } | ||
8461 | catch(InvalidCastException) | ||
8462 | { | ||
8463 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8464 | return null; | ||
8465 | } | ||
8466 | try | ||
8467 | { | ||
8468 | topshear = rules.GetVector3Item(idx++); | ||
8469 | } | ||
8470 | catch(InvalidCastException) | ||
8471 | { | ||
8472 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8473 | return null; | ||
8474 | } | ||
8475 | try | ||
8476 | { | ||
8477 | profilecut = rules.GetVector3Item(idx++); | ||
8478 | } | ||
8479 | catch(InvalidCastException) | ||
8480 | { | ||
8481 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8482 | return null; | ||
8483 | } | ||
8484 | try | ||
8485 | { | ||
8486 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
8487 | } | ||
8488 | catch(InvalidCastException) | ||
8489 | { | ||
8490 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8491 | return null; | ||
8492 | } | ||
8493 | try | ||
8494 | { | ||
8495 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
8496 | } | ||
8497 | catch(InvalidCastException) | ||
8498 | { | ||
8499 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1)); | ||
8500 | return null; | ||
8501 | } | ||
8502 | try | ||
8503 | { | ||
8504 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
8505 | } | ||
8506 | catch(InvalidCastException) | ||
8507 | { | ||
8508 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1)); | ||
8509 | return null; | ||
8510 | } | ||
8511 | try | ||
8512 | { | ||
8513 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
8514 | } | ||
8515 | catch(InvalidCastException) | ||
8516 | { | ||
8517 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1)); | ||
8518 | return null; | ||
8519 | } | ||
7905 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 8520 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7906 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); | 8521 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); |
7907 | break; | 8522 | break; |
7908 | 8523 | ||
7909 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 8524 | case ScriptBaseClass.PRIM_TYPE_RING: |
7910 | if (remain < 11) | 8525 | if (remain < 11) |
7911 | return null; | 8526 | return null; |
7912 | 8527 | ||
7913 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 8528 | try |
7914 | v = rules.GetVector3Item(idx++); //cut | 8529 | { |
7915 | hollow = (float)rules.GetLSLFloatItem(idx++); | 8530 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape |
7916 | twist = rules.GetVector3Item(idx++); | 8531 | } |
7917 | holesize = rules.GetVector3Item(idx++); | 8532 | catch(InvalidCastException) |
7918 | topshear = rules.GetVector3Item(idx++); | 8533 | { |
7919 | profilecut = rules.GetVector3Item(idx++); | 8534 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); |
7920 | taper_b = rules.GetVector3Item(idx++); // taper_a | 8535 | return null; |
7921 | revolutions = (float)rules.GetLSLFloatItem(idx++); | 8536 | } |
7922 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | 8537 | try |
7923 | skew = (float)rules.GetLSLFloatItem(idx++); | 8538 | { |
8539 | v = rules.GetVector3Item(idx++); //cut | ||
8540 | } | ||
8541 | catch(InvalidCastException) | ||
8542 | { | ||
8543 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8544 | return null; | ||
8545 | } | ||
8546 | try | ||
8547 | { | ||
8548 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
8549 | } | ||
8550 | catch(InvalidCastException) | ||
8551 | { | ||
8552 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8553 | return null; | ||
8554 | } | ||
8555 | try | ||
8556 | { | ||
8557 | twist = rules.GetVector3Item(idx++); | ||
8558 | } | ||
8559 | catch(InvalidCastException) | ||
8560 | { | ||
8561 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8562 | return null; | ||
8563 | } | ||
8564 | try | ||
8565 | { | ||
8566 | holesize = rules.GetVector3Item(idx++); | ||
8567 | } | ||
8568 | catch(InvalidCastException) | ||
8569 | { | ||
8570 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8571 | return null; | ||
8572 | } | ||
8573 | try | ||
8574 | { | ||
8575 | topshear = rules.GetVector3Item(idx++); | ||
8576 | } | ||
8577 | catch(InvalidCastException) | ||
8578 | { | ||
8579 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8580 | return null; | ||
8581 | } | ||
8582 | try | ||
8583 | { | ||
8584 | profilecut = rules.GetVector3Item(idx++); | ||
8585 | } | ||
8586 | catch(InvalidCastException) | ||
8587 | { | ||
8588 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8589 | return null; | ||
8590 | } | ||
8591 | try | ||
8592 | { | ||
8593 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
8594 | } | ||
8595 | catch(InvalidCastException) | ||
8596 | { | ||
8597 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8598 | return null; | ||
8599 | } | ||
8600 | try | ||
8601 | { | ||
8602 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
8603 | } | ||
8604 | catch(InvalidCastException) | ||
8605 | { | ||
8606 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1)); | ||
8607 | return null; | ||
8608 | } | ||
8609 | try | ||
8610 | { | ||
8611 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
8612 | } | ||
8613 | catch(InvalidCastException) | ||
8614 | { | ||
8615 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1)); | ||
8616 | return null; | ||
8617 | } | ||
8618 | try | ||
8619 | { | ||
8620 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
8621 | } | ||
8622 | catch(InvalidCastException) | ||
8623 | { | ||
8624 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1)); | ||
8625 | return null; | ||
8626 | } | ||
7924 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | 8627 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, |
7925 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); | 8628 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); |
7926 | break; | 8629 | break; |
7927 | 8630 | ||
7928 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 8631 | case ScriptBaseClass.PRIM_TYPE_SCULPT: |
7929 | if (remain < 2) | 8632 | if (remain < 2) |
7930 | return null; | 8633 | return null; |
7931 | 8634 | ||
7932 | string map = rules.Data[idx++].ToString(); | 8635 | string map = rules.Data[idx++].ToString(); |
7933 | face = (int)rules.GetLSLIntegerItem(idx++); // type | 8636 | try |
8637 | { | ||
8638 | face = (int)rules.GetLSLIntegerItem(idx++); // type | ||
8639 | } | ||
8640 | catch(InvalidCastException) | ||
8641 | { | ||
8642 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SCULPT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8643 | return null; | ||
8644 | } | ||
7934 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); | 8645 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); |
7935 | break; | 8646 | break; |
7936 | } | 8647 | } |
7937 | 8648 | ||
7938 | break; | 8649 | break; |
7939 | 8650 | ||
7940 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 8651 | case ScriptBaseClass.PRIM_TEXTURE: |
7941 | if (remain < 5) | 8652 | if (remain < 5) |
7942 | return null; | 8653 | return null; |
7943 | 8654 | ||
7944 | face=(int)rules.GetLSLIntegerItem(idx++); | 8655 | face=(int)rules.GetLSLIntegerItem(idx++); |
7945 | string tex=rules.Data[idx++].ToString(); | 8656 | string tex; |
7946 | LSL_Vector repeats=rules.GetVector3Item(idx++); | 8657 | LSL_Vector repeats; |
7947 | LSL_Vector offsets=rules.GetVector3Item(idx++); | 8658 | LSL_Vector offsets; |
7948 | double rotation=(double)rules.GetLSLFloatItem(idx++); | 8659 | double rotation; |
8660 | |||
8661 | tex = rules.Data[idx++].ToString(); | ||
8662 | try | ||
8663 | { | ||
8664 | repeats = rules.GetVector3Item(idx++); | ||
8665 | } | ||
8666 | catch(InvalidCastException) | ||
8667 | { | ||
8668 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8669 | return null; | ||
8670 | } | ||
8671 | try | ||
8672 | { | ||
8673 | offsets = rules.GetVector3Item(idx++); | ||
8674 | } | ||
8675 | catch(InvalidCastException) | ||
8676 | { | ||
8677 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8678 | return null; | ||
8679 | } | ||
8680 | try | ||
8681 | { | ||
8682 | rotation = (double)rules.GetLSLFloatItem(idx++); | ||
8683 | } | ||
8684 | catch(InvalidCastException) | ||
8685 | { | ||
8686 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8687 | return null; | ||
8688 | } | ||
7949 | 8689 | ||
7950 | SetTexture(part, tex, face); | 8690 | SetTexture(part, tex, face); |
7951 | ScaleTexture(part, repeats.x, repeats.y, face); | 8691 | ScaleTexture(part, repeats.x, repeats.y, face); |
@@ -7954,114 +8694,328 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7954 | 8694 | ||
7955 | break; | 8695 | break; |
7956 | 8696 | ||
7957 | case (int)ScriptBaseClass.PRIM_COLOR: | 8697 | case ScriptBaseClass.PRIM_COLOR: |
7958 | if (remain < 3) | 8698 | if (remain < 3) |
7959 | return null; | 8699 | return null; |
7960 | 8700 | ||
7961 | face=(int)rules.GetLSLIntegerItem(idx++); | 8701 | LSL_Vector color; |
7962 | LSL_Vector color=rules.GetVector3Item(idx++); | 8702 | double alpha; |
7963 | double alpha=(double)rules.GetLSLFloatItem(idx++); | 8703 | |
8704 | try | ||
8705 | { | ||
8706 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8707 | } | ||
8708 | catch(InvalidCastException) | ||
8709 | { | ||
8710 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8711 | return null; | ||
8712 | } | ||
8713 | try | ||
8714 | { | ||
8715 | color = rules.GetVector3Item(idx++); | ||
8716 | } | ||
8717 | catch(InvalidCastException) | ||
8718 | { | ||
8719 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8720 | return null; | ||
8721 | } | ||
8722 | try | ||
8723 | { | ||
8724 | alpha = (double)rules.GetLSLFloatItem(idx++); | ||
8725 | } | ||
8726 | catch(InvalidCastException) | ||
8727 | { | ||
8728 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
8729 | return null; | ||
8730 | } | ||
7964 | 8731 | ||
7965 | part.SetFaceColorAlpha(face, color, alpha); | 8732 | part.SetFaceColorAlpha(face, color, alpha); |
7966 | 8733 | ||
7967 | break; | 8734 | break; |
7968 | 8735 | ||
7969 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 8736 | case ScriptBaseClass.PRIM_FLEXIBLE: |
7970 | if (remain < 7) | 8737 | if (remain < 7) |
7971 | return null; | 8738 | return null; |
7972 | 8739 | bool flexi; | |
7973 | bool flexi = rules.GetLSLIntegerItem(idx++); | 8740 | int softness; |
7974 | int softness = rules.GetLSLIntegerItem(idx++); | 8741 | float gravity; |
7975 | float gravity = (float)rules.GetLSLFloatItem(idx++); | 8742 | float friction; |
7976 | float friction = (float)rules.GetLSLFloatItem(idx++); | 8743 | float wind; |
7977 | float wind = (float)rules.GetLSLFloatItem(idx++); | 8744 | float tension; |
7978 | float tension = (float)rules.GetLSLFloatItem(idx++); | 8745 | LSL_Vector force; |
7979 | LSL_Vector force = rules.GetVector3Item(idx++); | 8746 | |
8747 | try | ||
8748 | { | ||
8749 | flexi = rules.GetLSLIntegerItem(idx++); | ||
8750 | } | ||
8751 | catch(InvalidCastException) | ||
8752 | { | ||
8753 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8754 | return null; | ||
8755 | } | ||
8756 | try | ||
8757 | { | ||
8758 | softness = rules.GetLSLIntegerItem(idx++); | ||
8759 | } | ||
8760 | catch(InvalidCastException) | ||
8761 | { | ||
8762 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8763 | return null; | ||
8764 | } | ||
8765 | try | ||
8766 | { | ||
8767 | gravity = (float)rules.GetLSLFloatItem(idx++); | ||
8768 | } | ||
8769 | catch(InvalidCastException) | ||
8770 | { | ||
8771 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
8772 | return null; | ||
8773 | } | ||
8774 | try | ||
8775 | { | ||
8776 | friction = (float)rules.GetLSLFloatItem(idx++); | ||
8777 | } | ||
8778 | catch(InvalidCastException) | ||
8779 | { | ||
8780 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8781 | return null; | ||
8782 | } | ||
8783 | try | ||
8784 | { | ||
8785 | wind = (float)rules.GetLSLFloatItem(idx++); | ||
8786 | } | ||
8787 | catch(InvalidCastException) | ||
8788 | { | ||
8789 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1)); | ||
8790 | return null; | ||
8791 | } | ||
8792 | try | ||
8793 | { | ||
8794 | tension = (float)rules.GetLSLFloatItem(idx++); | ||
8795 | } | ||
8796 | catch(InvalidCastException) | ||
8797 | { | ||
8798 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 7 must be float", rulesParsed, idx - idxStart - 1)); | ||
8799 | return null; | ||
8800 | } | ||
8801 | try | ||
8802 | { | ||
8803 | force = rules.GetVector3Item(idx++); | ||
8804 | } | ||
8805 | catch(InvalidCastException) | ||
8806 | { | ||
8807 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8808 | return null; | ||
8809 | } | ||
7980 | 8810 | ||
7981 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); | 8811 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); |
7982 | 8812 | ||
7983 | break; | 8813 | break; |
7984 | 8814 | ||
7985 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 8815 | case ScriptBaseClass.PRIM_POINT_LIGHT: |
7986 | if (remain < 5) | 8816 | if (remain < 5) |
7987 | return null; | 8817 | return null; |
7988 | bool light = rules.GetLSLIntegerItem(idx++); | 8818 | bool light; |
7989 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); | 8819 | LSL_Vector lightcolor; |
7990 | float intensity = (float)rules.GetLSLFloatItem(idx++); | 8820 | float intensity; |
7991 | float radius = (float)rules.GetLSLFloatItem(idx++); | 8821 | float radius; |
7992 | float falloff = (float)rules.GetLSLFloatItem(idx++); | 8822 | float falloff; |
8823 | |||
8824 | try | ||
8825 | { | ||
8826 | light = rules.GetLSLIntegerItem(idx++); | ||
8827 | } | ||
8828 | catch(InvalidCastException) | ||
8829 | { | ||
8830 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8831 | return null; | ||
8832 | } | ||
8833 | try | ||
8834 | { | ||
8835 | lightcolor = rules.GetVector3Item(idx++); | ||
8836 | } | ||
8837 | catch(InvalidCastException) | ||
8838 | { | ||
8839 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1)); | ||
8840 | return null; | ||
8841 | } | ||
8842 | try | ||
8843 | { | ||
8844 | intensity = (float)rules.GetLSLFloatItem(idx++); | ||
8845 | } | ||
8846 | catch(InvalidCastException) | ||
8847 | { | ||
8848 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
8849 | return null; | ||
8850 | } | ||
8851 | try | ||
8852 | { | ||
8853 | radius = (float)rules.GetLSLFloatItem(idx++); | ||
8854 | } | ||
8855 | catch(InvalidCastException) | ||
8856 | { | ||
8857 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1)); | ||
8858 | return null; | ||
8859 | } | ||
8860 | try | ||
8861 | { | ||
8862 | falloff = (float)rules.GetLSLFloatItem(idx++); | ||
8863 | } | ||
8864 | catch(InvalidCastException) | ||
8865 | { | ||
8866 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1)); | ||
8867 | return null; | ||
8868 | } | ||
7993 | 8869 | ||
7994 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); | 8870 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); |
7995 | 8871 | ||
7996 | break; | 8872 | break; |
7997 | 8873 | ||
7998 | case (int)ScriptBaseClass.PRIM_GLOW: | 8874 | case ScriptBaseClass.PRIM_GLOW: |
7999 | if (remain < 2) | 8875 | if (remain < 2) |
8000 | return null; | 8876 | return null; |
8001 | face = rules.GetLSLIntegerItem(idx++); | 8877 | |
8002 | float glow = (float)rules.GetLSLFloatItem(idx++); | 8878 | float glow; |
8879 | |||
8880 | try | ||
8881 | { | ||
8882 | face = rules.GetLSLIntegerItem(idx++); | ||
8883 | } | ||
8884 | catch(InvalidCastException) | ||
8885 | { | ||
8886 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8887 | return null; | ||
8888 | } | ||
8889 | try | ||
8890 | { | ||
8891 | glow = (float)rules.GetLSLFloatItem(idx++); | ||
8892 | } | ||
8893 | catch(InvalidCastException) | ||
8894 | { | ||
8895 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1)); | ||
8896 | return null; | ||
8897 | } | ||
8003 | 8898 | ||
8004 | SetGlow(part, face, glow); | 8899 | SetGlow(part, face, glow); |
8005 | 8900 | ||
8006 | break; | 8901 | break; |
8007 | 8902 | ||
8008 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 8903 | case ScriptBaseClass.PRIM_BUMP_SHINY: |
8009 | if (remain < 3) | 8904 | if (remain < 3) |
8010 | return null; | 8905 | return null; |
8011 | face = (int)rules.GetLSLIntegerItem(idx++); | 8906 | |
8012 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 8907 | int shiny; |
8013 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); | 8908 | Bumpiness bump; |
8909 | |||
8910 | try | ||
8911 | { | ||
8912 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
8913 | } | ||
8914 | catch(InvalidCastException) | ||
8915 | { | ||
8916 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8917 | return null; | ||
8918 | } | ||
8919 | try | ||
8920 | { | ||
8921 | shiny = (int)rules.GetLSLIntegerItem(idx++); | ||
8922 | } | ||
8923 | catch(InvalidCastException) | ||
8924 | { | ||
8925 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8926 | return null; | ||
8927 | } | ||
8928 | try | ||
8929 | { | ||
8930 | bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); | ||
8931 | } | ||
8932 | catch(InvalidCastException) | ||
8933 | { | ||
8934 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8935 | return null; | ||
8936 | } | ||
8014 | 8937 | ||
8015 | SetShiny(part, face, shiny, bump); | 8938 | SetShiny(part, face, shiny, bump); |
8016 | 8939 | ||
8017 | break; | 8940 | break; |
8018 | 8941 | ||
8019 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 8942 | case ScriptBaseClass.PRIM_FULLBRIGHT: |
8020 | if (remain < 2) | 8943 | if (remain < 2) |
8021 | return null; | 8944 | return null; |
8022 | face = rules.GetLSLIntegerItem(idx++); | 8945 | bool st; |
8023 | bool st = rules.GetLSLIntegerItem(idx++); | ||
8024 | SetFullBright(part, face , st); | ||
8025 | break; | ||
8026 | |||
8027 | case (int)ScriptBaseClass.PRIM_MATERIAL: | ||
8028 | if (remain < 1) | ||
8029 | return null; | ||
8030 | int mat = rules.GetLSLIntegerItem(idx++); | ||
8031 | if (mat < 0 || mat > 7) | ||
8032 | return null; | ||
8033 | 8946 | ||
8034 | part.Material = Convert.ToByte(mat); | 8947 | try |
8035 | break; | 8948 | { |
8949 | face = rules.GetLSLIntegerItem(idx++); | ||
8950 | } | ||
8951 | catch(InvalidCastException) | ||
8952 | { | ||
8953 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8954 | return null; | ||
8955 | } | ||
8956 | try | ||
8957 | { | ||
8958 | st = rules.GetLSLIntegerItem(idx++); | ||
8959 | } | ||
8960 | catch(InvalidCastException) | ||
8961 | { | ||
8962 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8963 | return null; | ||
8964 | } | ||
8965 | SetFullBright(part, face , st); | ||
8966 | break; | ||
8036 | 8967 | ||
8037 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 8968 | case ScriptBaseClass.PRIM_MATERIAL: |
8038 | if (remain < 1) | 8969 | if (remain < 1) |
8039 | return null; | 8970 | return null; |
8971 | int mat; | ||
8040 | 8972 | ||
8041 | string ph = rules.Data[idx++].ToString(); | 8973 | try |
8042 | part.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | 8974 | { |
8975 | mat = rules.GetLSLIntegerItem(idx++); | ||
8976 | } | ||
8977 | catch(InvalidCastException) | ||
8978 | { | ||
8979 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_MATERIAL: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
8980 | return null; | ||
8981 | } | ||
8982 | if (mat < 0 || mat > 7) | ||
8983 | return null; | ||
8043 | 8984 | ||
8044 | break; | 8985 | part.Material = Convert.ToByte(mat); |
8986 | break; | ||
8045 | 8987 | ||
8046 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 8988 | case ScriptBaseClass.PRIM_PHANTOM: |
8047 | if (remain < 1) | 8989 | if (remain < 1) |
8048 | return null; | 8990 | return null; |
8049 | string phy = rules.Data[idx++].ToString(); | ||
8050 | bool physics; | ||
8051 | 8991 | ||
8052 | if (phy.Equals("1")) | 8992 | string ph = rules.Data[idx++].ToString(); |
8053 | physics = true; | 8993 | part.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); |
8054 | else | ||
8055 | physics = false; | ||
8056 | 8994 | ||
8057 | part.ScriptSetPhysicsStatus(physics); | 8995 | break; |
8058 | break; | ||
8059 | 8996 | ||
8060 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | 8997 | case ScriptBaseClass.PRIM_PHYSICS: |
8998 | if (remain < 1) | ||
8999 | return null; | ||
9000 | string phy = rules.Data[idx++].ToString(); | ||
9001 | part.ScriptSetPhysicsStatus(phy.Equals("1")); | ||
9002 | break; | ||
9003 | |||
9004 | case ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
8061 | if (remain < 1) | 9005 | if (remain < 1) |
8062 | return null; | 9006 | return null; |
8063 | 9007 | ||
8064 | int shape_type = rules.GetLSLIntegerItem(idx++); | 9008 | int shape_type; |
9009 | |||
9010 | try | ||
9011 | { | ||
9012 | shape_type = rules.GetLSLIntegerItem(idx++); | ||
9013 | } | ||
9014 | catch(InvalidCastException) | ||
9015 | { | ||
9016 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_PHYSICS_SHAPE_TYPE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
9017 | return null; | ||
9018 | } | ||
8065 | 9019 | ||
8066 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | 9020 | ExtraPhysicsData physdata = new ExtraPhysicsData(); |
8067 | physdata.Density = part.Density; | 9021 | physdata.Density = part.Density; |
@@ -8073,7 +9027,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8073 | 9027 | ||
8074 | break; | 9028 | break; |
8075 | 9029 | ||
8076 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 9030 | case ScriptBaseClass.PRIM_TEMP_ON_REZ: |
8077 | if (remain < 1) | 9031 | if (remain < 1) |
8078 | return null; | 9032 | return null; |
8079 | string temp = rules.Data[idx++].ToString(); | 9033 | string temp = rules.Data[idx++].ToString(); |
@@ -8082,60 +9036,177 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8082 | 9036 | ||
8083 | break; | 9037 | break; |
8084 | 9038 | ||
8085 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 9039 | case ScriptBaseClass.PRIM_TEXGEN: |
8086 | if (remain < 2) | 9040 | if (remain < 2) |
8087 | return null; | 9041 | return null; |
8088 | //face,type | 9042 | //face,type |
8089 | face = rules.GetLSLIntegerItem(idx++); | 9043 | int style; |
8090 | int style = rules.GetLSLIntegerItem(idx++); | 9044 | |
9045 | try | ||
9046 | { | ||
9047 | face = rules.GetLSLIntegerItem(idx++); | ||
9048 | } | ||
9049 | catch(InvalidCastException) | ||
9050 | { | ||
9051 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1)); | ||
9052 | return null; | ||
9053 | } | ||
9054 | try | ||
9055 | { | ||
9056 | style = rules.GetLSLIntegerItem(idx++); | ||
9057 | } | ||
9058 | catch(InvalidCastException) | ||
9059 | { | ||
9060 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1)); | ||
9061 | return null; | ||
9062 | } | ||
8091 | SetTexGen(part, face, style); | 9063 | SetTexGen(part, face, style); |
8092 | break; | 9064 | break; |
8093 | case (int)ScriptBaseClass.PRIM_TEXT: | 9065 | case ScriptBaseClass.PRIM_TEXT: |
8094 | if (remain < 3) | 9066 | if (remain < 3) |
8095 | return null; | 9067 | return null; |
8096 | string primText = rules.GetLSLStringItem(idx++); | 9068 | string primText; |
8097 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 9069 | LSL_Vector primTextColor; |
8098 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 9070 | LSL_Float primTextAlpha; |
9071 | |||
9072 | try | ||
9073 | { | ||
9074 | primText = rules.GetLSLStringItem(idx++); | ||
9075 | } | ||
9076 | catch(InvalidCastException) | ||
9077 | { | ||
9078 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); | ||
9079 | return null; | ||
9080 | } | ||
9081 | try | ||
9082 | { | ||
9083 | primTextColor = rules.GetVector3Item(idx++); | ||
9084 | } | ||
9085 | catch(InvalidCastException) | ||
9086 | { | ||
9087 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1)); | ||
9088 | return null; | ||
9089 | } | ||
9090 | try | ||
9091 | { | ||
9092 | primTextAlpha = rules.GetLSLFloatItem(idx++); | ||
9093 | } | ||
9094 | catch(InvalidCastException) | ||
9095 | { | ||
9096 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
9097 | return null; | ||
9098 | } | ||
8099 | Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); | 9099 | Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); |
8100 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | 9100 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); |
8101 | 9101 | ||
8102 | break; | 9102 | break; |
8103 | case (int)ScriptBaseClass.PRIM_NAME: | 9103 | |
9104 | case ScriptBaseClass.PRIM_NAME: | ||
8104 | if (remain < 1) | 9105 | if (remain < 1) |
8105 | return null; | 9106 | return null; |
8106 | string primName = rules.GetLSLStringItem(idx++); | 9107 | try |
8107 | part.Name = primName; | 9108 | { |
9109 | string primName = rules.GetLSLStringItem(idx++); | ||
9110 | part.Name = primName; | ||
9111 | } | ||
9112 | catch(InvalidCastException) | ||
9113 | { | ||
9114 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NAME: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); | ||
9115 | return null; | ||
9116 | } | ||
8108 | break; | 9117 | break; |
8109 | case (int)ScriptBaseClass.PRIM_DESC: | 9118 | case ScriptBaseClass.PRIM_DESC: |
8110 | if (remain < 1) | 9119 | if (remain < 1) |
8111 | return null; | 9120 | return null; |
8112 | string primDesc = rules.GetLSLStringItem(idx++); | 9121 | try |
8113 | part.Description = primDesc; | 9122 | { |
9123 | string primDesc = rules.GetLSLStringItem(idx++); | ||
9124 | part.Description = primDesc; | ||
9125 | } | ||
9126 | catch(InvalidCastException) | ||
9127 | { | ||
9128 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_DESC: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1)); | ||
9129 | return null; | ||
9130 | } | ||
8114 | break; | 9131 | break; |
8115 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9132 | case ScriptBaseClass.PRIM_ROT_LOCAL: |
8116 | if (remain < 1) | 9133 | if (remain < 1) |
8117 | return null; | 9134 | return null; |
8118 | SetRot(part, rules.GetQuaternionItem(idx++)); | 9135 | LSL_Rotation rot; |
9136 | try | ||
9137 | { | ||
9138 | rot = rules.GetQuaternionItem(idx++); | ||
9139 | } | ||
9140 | catch(InvalidCastException) | ||
9141 | { | ||
9142 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1)); | ||
9143 | return null; | ||
9144 | } | ||
9145 | SetRot(part, rot); | ||
8119 | break; | 9146 | break; |
8120 | case (int)ScriptBaseClass.PRIM_OMEGA: | 9147 | |
9148 | case ScriptBaseClass.PRIM_OMEGA: | ||
8121 | if (remain < 3) | 9149 | if (remain < 3) |
8122 | return null; | 9150 | return null; |
8123 | LSL_Vector axis = rules.GetVector3Item(idx++); | 9151 | LSL_Vector axis; |
8124 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | 9152 | LSL_Float spinrate; |
8125 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 9153 | LSL_Float gain; |
9154 | |||
9155 | try | ||
9156 | { | ||
9157 | axis = rules.GetVector3Item(idx++); | ||
9158 | } | ||
9159 | catch(InvalidCastException) | ||
9160 | { | ||
9161 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); | ||
9162 | return null; | ||
9163 | } | ||
9164 | try | ||
9165 | { | ||
9166 | spinrate = rules.GetLSLFloatItem(idx++); | ||
9167 | } | ||
9168 | catch(InvalidCastException) | ||
9169 | { | ||
9170 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1)); | ||
9171 | return null; | ||
9172 | } | ||
9173 | try | ||
9174 | { | ||
9175 | gain = rules.GetLSLFloatItem(idx++); | ||
9176 | } | ||
9177 | catch(InvalidCastException) | ||
9178 | { | ||
9179 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1)); | ||
9180 | return null; | ||
9181 | } | ||
8126 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 9182 | TargetOmega(part, axis, (double)spinrate, (double)gain); |
8127 | break; | 9183 | break; |
8128 | case (int)ScriptBaseClass.PRIM_SLICE: | 9184 | |
9185 | case ScriptBaseClass.PRIM_SLICE: | ||
8129 | if (remain < 1) | 9186 | if (remain < 1) |
8130 | return null; | 9187 | return null; |
8131 | LSL_Vector slice = rules.GetVector3Item(idx++); | 9188 | LSL_Vector slice; |
9189 | try | ||
9190 | { | ||
9191 | slice = rules.GetVector3Item(idx++); | ||
9192 | } | ||
9193 | catch(InvalidCastException) | ||
9194 | { | ||
9195 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SLICE: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); | ||
9196 | return null; | ||
9197 | } | ||
8132 | part.UpdateSlice((float)slice.x, (float)slice.y); | 9198 | part.UpdateSlice((float)slice.x, (float)slice.y); |
8133 | break; | 9199 | break; |
8134 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 9200 | |
9201 | case ScriptBaseClass.PRIM_LINK_TARGET: | ||
8135 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | 9202 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. |
8136 | return null; | 9203 | return null; |
8137 | 9204 | ||
8138 | return rules.GetSublist(idx, -1); | 9205 | return rules.GetSublist(idx, -1); |
9206 | |||
9207 | default: | ||
9208 | Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - unsupported parameter", rulesParsed, idx - idxStart)); | ||
9209 | return null; | ||
8139 | } | 9210 | } |
8140 | } | 9211 | } |
8141 | } | 9212 | } |
@@ -8182,19 +9253,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8182 | 9253 | ||
8183 | switch (code) | 9254 | switch (code) |
8184 | { | 9255 | { |
8185 | case (int)ScriptBaseClass.PRIM_POSITION: | 9256 | case ScriptBaseClass.PRIM_POSITION: |
8186 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9257 | case ScriptBaseClass.PRIM_POS_LOCAL: |
8187 | if (remain < 1) | 9258 | if (remain < 1) |
8188 | return null; | 9259 | return null; |
8189 | 9260 | ||
8190 | sp.OffsetPosition = rules.GetVector3Item(idx++); | 9261 | try |
9262 | { | ||
9263 | sp.OffsetPosition = rules.GetVector3Item(idx++); | ||
9264 | } | ||
9265 | catch(InvalidCastException) | ||
9266 | { | ||
9267 | if (code == ScriptBaseClass.PRIM_POSITION) | ||
9268 | { | ||
9269 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); | ||
9270 | } | ||
9271 | else | ||
9272 | { | ||
9273 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1)); | ||
9274 | } | ||
9275 | return null; | ||
9276 | } | ||
8191 | break; | 9277 | break; |
8192 | 9278 | ||
8193 | case (int)ScriptBaseClass.PRIM_ROTATION: | 9279 | case ScriptBaseClass.PRIM_ROTATION: |
8194 | if (remain < 1) | 9280 | if (remain < 1) |
8195 | return null; | 9281 | return null; |
8196 | 9282 | ||
8197 | Quaternion inRot = rules.GetQuaternionItem(idx++); | 9283 | Quaternion inRot; |
9284 | |||
9285 | try | ||
9286 | { | ||
9287 | inRot = rules.GetQuaternionItem(idx++); | ||
9288 | } | ||
9289 | catch(InvalidCastException) | ||
9290 | { | ||
9291 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1)); | ||
9292 | return null; | ||
9293 | } | ||
8198 | 9294 | ||
8199 | SceneObjectPart parentPart = sp.ParentPart; | 9295 | SceneObjectPart parentPart = sp.ParentPart; |
8200 | 9296 | ||
@@ -8203,13 +9299,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8203 | 9299 | ||
8204 | break; | 9300 | break; |
8205 | 9301 | ||
8206 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9302 | case ScriptBaseClass.PRIM_ROT_LOCAL: |
8207 | if (remain < 1) | 9303 | if (remain < 1) |
8208 | return null; | 9304 | return null; |
8209 | 9305 | ||
8210 | sp.Rotation = rules.GetQuaternionItem(idx++); | 9306 | try |
9307 | { | ||
9308 | sp.Rotation = rules.GetQuaternionItem(idx++); | ||
9309 | } | ||
9310 | catch(InvalidCastException) | ||
9311 | { | ||
9312 | Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1)); | ||
9313 | return null; | ||
9314 | } | ||
8211 | 9315 | ||
8212 | break; | 9316 | break; |
9317 | |||
9318 | case ScriptBaseClass.PRIM_TYPE: | ||
9319 | Error(originFunc, "PRIM_TYPE disallowed on agent"); | ||
9320 | return null; | ||
9321 | |||
9322 | case ScriptBaseClass.PRIM_OMEGA: | ||
9323 | Error(originFunc, "PRIM_OMEGA disallowed on agent"); | ||
9324 | return null; | ||
9325 | |||
9326 | case ScriptBaseClass.PRIM_LINK_TARGET: | ||
9327 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
9328 | return null; | ||
9329 | |||
9330 | return rules.GetSublist(idx, -1); | ||
9331 | |||
9332 | default: | ||
9333 | Error(originFunc, | ||
9334 | string.Format("Error running rule #{0} on agent: arg #{1} - disallowed on agent", rulesParsed, idx - idxStart)); | ||
9335 | return null; | ||
8213 | } | 9336 | } |
8214 | } | 9337 | } |
8215 | } | 9338 | } |
@@ -8744,6 +9867,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8744 | res.Add(GetPartRot(part)); | 9867 | res.Add(GetPartRot(part)); |
8745 | break; | 9868 | break; |
8746 | 9869 | ||
9870 | case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: | ||
9871 | res.Add(new LSL_Integer((int)part.PhysicsShapeType)); | ||
9872 | break; | ||
9873 | |||
8747 | case (int)ScriptBaseClass.PRIM_TYPE: | 9874 | case (int)ScriptBaseClass.PRIM_TYPE: |
8748 | // implementing box | 9875 | // implementing box |
8749 | PrimitiveBaseShape Shape = part.Shape; | 9876 | PrimitiveBaseShape Shape = part.Shape; |
@@ -10797,19 +11924,84 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10797 | 11924 | ||
10798 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); | 11925 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); |
10799 | object[] data = rules.Data; | 11926 | object[] data = rules.Data; |
10800 | for (int i = 0; i < data.Length; ++i) { | 11927 | for (int i = 0; i < data.Length; ++i) |
10801 | int type = Convert.ToInt32(data[i++].ToString()); | 11928 | { |
11929 | int type; | ||
11930 | try | ||
11931 | { | ||
11932 | type = Convert.ToInt32(data[i++].ToString()); | ||
11933 | } | ||
11934 | catch | ||
11935 | { | ||
11936 | Error("llSetCameraParams", string.Format("Invalid camera param type {0}", data[i - 1])); | ||
11937 | return; | ||
11938 | } | ||
10802 | if (i >= data.Length) break; // odd number of entries => ignore the last | 11939 | if (i >= data.Length) break; // odd number of entries => ignore the last |
10803 | 11940 | ||
10804 | // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) | 11941 | // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) |
10805 | switch (type) { | 11942 | switch (type) |
11943 | { | ||
10806 | case ScriptBaseClass.CAMERA_FOCUS: | 11944 | case ScriptBaseClass.CAMERA_FOCUS: |
10807 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | 11945 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: |
10808 | case ScriptBaseClass.CAMERA_POSITION: | 11946 | case ScriptBaseClass.CAMERA_POSITION: |
10809 | LSL_Vector v = (LSL_Vector)data[i]; | 11947 | LSL_Vector v = (LSL_Vector)data[i]; |
10810 | parameters.Add(type + 1, (float)v.x); | 11948 | try |
10811 | parameters.Add(type + 2, (float)v.y); | 11949 | { |
10812 | parameters.Add(type + 3, (float)v.z); | 11950 | parameters.Add(type + 1, (float)v.x); |
11951 | } | ||
11952 | catch | ||
11953 | { | ||
11954 | switch(type) | ||
11955 | { | ||
11956 | case ScriptBaseClass.CAMERA_FOCUS: | ||
11957 | Error("llSetCameraParams", "CAMERA_FOCUS: Parameter x is invalid"); | ||
11958 | return; | ||
11959 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | ||
11960 | Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter x is invalid"); | ||
11961 | return; | ||
11962 | case ScriptBaseClass.CAMERA_POSITION: | ||
11963 | Error("llSetCameraParams", "CAMERA_POSITION: Parameter x is invalid"); | ||
11964 | return; | ||
11965 | } | ||
11966 | } | ||
11967 | try | ||
11968 | { | ||
11969 | parameters.Add(type + 2, (float)v.y); | ||
11970 | } | ||
11971 | catch | ||
11972 | { | ||
11973 | switch(type) | ||
11974 | { | ||
11975 | case ScriptBaseClass.CAMERA_FOCUS: | ||
11976 | Error("llSetCameraParams", "CAMERA_FOCUS: Parameter y is invalid"); | ||
11977 | return; | ||
11978 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | ||
11979 | Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter y is invalid"); | ||
11980 | return; | ||
11981 | case ScriptBaseClass.CAMERA_POSITION: | ||
11982 | Error("llSetCameraParams", "CAMERA_POSITION: Parameter y is invalid"); | ||
11983 | return; | ||
11984 | } | ||
11985 | } | ||
11986 | try | ||
11987 | { | ||
11988 | parameters.Add(type + 3, (float)v.z); | ||
11989 | } | ||
11990 | catch | ||
11991 | { | ||
11992 | switch(type) | ||
11993 | { | ||
11994 | case ScriptBaseClass.CAMERA_FOCUS: | ||
11995 | Error("llSetCameraParams", "CAMERA_FOCUS: Parameter z is invalid"); | ||
11996 | return; | ||
11997 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | ||
11998 | Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter z is invalid"); | ||
11999 | return; | ||
12000 | case ScriptBaseClass.CAMERA_POSITION: | ||
12001 | Error("llSetCameraParams", "CAMERA_POSITION: Parameter z is invalid"); | ||
12002 | return; | ||
12003 | } | ||
12004 | } | ||
10813 | break; | 12005 | break; |
10814 | default: | 12006 | default: |
10815 | // TODO: clean that up as soon as the implicit casts are in | 12007 | // TODO: clean that up as soon as the implicit casts are in |
@@ -10817,7 +12009,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10817 | parameters.Add(type, (float)((LSL_Float)data[i]).value); | 12009 | parameters.Add(type, (float)((LSL_Float)data[i]).value); |
10818 | else if (data[i] is LSL_Integer) | 12010 | else if (data[i] is LSL_Integer) |
10819 | parameters.Add(type, (float)((LSL_Integer)data[i]).value); | 12011 | parameters.Add(type, (float)((LSL_Integer)data[i]).value); |
10820 | else parameters.Add(type, Convert.ToSingle(data[i])); | 12012 | else |
12013 | { | ||
12014 | try | ||
12015 | { | ||
12016 | parameters.Add(type, Convert.ToSingle(data[i])); | ||
12017 | } | ||
12018 | catch | ||
12019 | { | ||
12020 | Error("llSetCameraParams", string.Format("{0}: Parameter is invalid", type)); | ||
12021 | } | ||
12022 | } | ||
10821 | break; | 12023 | break; |
10822 | } | 12024 | } |
10823 | } | 12025 | } |