diff options
author | Melanie | 2011-11-02 12:34:57 +0000 |
---|---|---|
committer | Melanie | 2011-11-02 12:34:57 +0000 |
commit | afae9eafbe30511471a901895c91f6f9add109b4 (patch) | |
tree | 435459dcaddd6b8ad3462ea0ba61d23c50028bcc /OpenSim/Region | |
parent | Merge branch 'master' into bigmerge (diff) | |
parent | Restore the recursive calling of PRIM_LINK_TARGET because the version I made (diff) | |
download | opensim-SC-afae9eafbe30511471a901895c91f6f9add109b4.zip opensim-SC-afae9eafbe30511471a901895c91f6f9add109b4.tar.gz opensim-SC-afae9eafbe30511471a901895c91f6f9add109b4.tar.bz2 opensim-SC-afae9eafbe30511471a901895c91f6f9add109b4.tar.xz |
Merge branch 'master' into bigmerge
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 672 |
1 files changed, 350 insertions, 322 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ebe276b..652fa7e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2168,7 +2168,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2168 | return fromPos; | 2168 | return fromPos; |
2169 | 2169 | ||
2170 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) | 2170 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) |
2171 | 2171 | ||
2172 | 2172 | ||
2173 | float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); | 2173 | float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); |
2174 | bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); | 2174 | bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); |
@@ -7504,6 +7504,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7504 | { | 7504 | { |
7505 | m_host.AddScriptLPS(1); | 7505 | m_host.AddScriptLPS(1); |
7506 | 7506 | ||
7507 | setLinkPrimParams(linknumber, rules); | ||
7508 | } | ||
7509 | |||
7510 | private void setLinkPrimParams(int linknumber, LSL_List rules) | ||
7511 | { | ||
7507 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 7512 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
7508 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); | 7513 | List<ScenePresence> avatars = GetLinkAvatars(linknumber); |
7509 | if (parts.Count>0) | 7514 | if (parts.Count>0) |
@@ -7581,380 +7586,403 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7581 | bool positionChanged = false; | 7586 | bool positionChanged = false; |
7582 | LSL_Vector currentPosition = GetPartLocalPos(part); | 7587 | LSL_Vector currentPosition = GetPartLocalPos(part); |
7583 | 7588 | ||
7584 | while (idx < rules.Length) | 7589 | try |
7585 | { | 7590 | { |
7586 | int code = rules.GetLSLIntegerItem(idx++); | 7591 | while (idx < rules.Length) |
7587 | |||
7588 | int remain = rules.Length - idx; | ||
7589 | |||
7590 | int face; | ||
7591 | LSL_Vector v; | ||
7592 | |||
7593 | switch (code) | ||
7594 | { | 7592 | { |
7595 | case (int)ScriptBaseClass.PRIM_POSITION: | 7593 | int code = rules.GetLSLIntegerItem(idx++); |
7596 | if (remain < 1) | ||
7597 | return; | ||
7598 | 7594 | ||
7599 | v=rules.GetVector3Item(idx++); | 7595 | int remain = rules.Length - idx; |
7600 | positionChanged = true; | ||
7601 | currentPosition = GetSetPosTarget(part, v, currentPosition); | ||
7602 | 7596 | ||
7603 | break; | 7597 | int face; |
7604 | case (int)ScriptBaseClass.PRIM_SIZE: | 7598 | LSL_Vector v; |
7605 | if (remain < 1) | ||
7606 | return; | ||
7607 | |||
7608 | v=rules.GetVector3Item(idx++); | ||
7609 | SetScale(part, v); | ||
7610 | 7599 | ||
7611 | break; | 7600 | switch (code) |
7612 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7601 | { |
7613 | if (remain < 1) | 7602 | case (int)ScriptBaseClass.PRIM_POSITION: |
7614 | return; | 7603 | if (remain < 1) |
7615 | 7604 | return; | |
7616 | LSL_Rotation q = rules.GetQuaternionItem(idx++); | ||
7617 | // try to let this work as in SL... | ||
7618 | if (part.ParentID == 0) | ||
7619 | { | ||
7620 | // special case: If we are root, rotate complete SOG to new rotation | ||
7621 | SetRot(part, Rot2Quaternion(q)); | ||
7622 | } | ||
7623 | else | ||
7624 | { | ||
7625 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | ||
7626 | SceneObjectPart rootPart = part.ParentGroup.RootPart; | ||
7627 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | ||
7628 | } | ||
7629 | |||
7630 | break; | ||
7631 | |||
7632 | case (int)ScriptBaseClass.PRIM_TYPE: | ||
7633 | if (remain < 3) | ||
7634 | return; | ||
7635 | 7605 | ||
7636 | code = (int)rules.GetLSLIntegerItem(idx++); | 7606 | v=rules.GetVector3Item(idx++); |
7607 | positionChanged = true; | ||
7608 | currentPosition = GetSetPosTarget(part, v, currentPosition); | ||
7637 | 7609 | ||
7638 | remain = rules.Length - idx; | 7610 | break; |
7639 | float hollow; | 7611 | case (int)ScriptBaseClass.PRIM_SIZE: |
7640 | LSL_Vector twist; | 7612 | if (remain < 1) |
7641 | LSL_Vector taper_b; | 7613 | return; |
7642 | LSL_Vector topshear; | ||
7643 | float revolutions; | ||
7644 | float radiusoffset; | ||
7645 | float skew; | ||
7646 | LSL_Vector holesize; | ||
7647 | LSL_Vector profilecut; | ||
7648 | 7614 | ||
7649 | switch (code) | 7615 | v=rules.GetVector3Item(idx++); |
7650 | { | 7616 | SetScale(part, v); |
7651 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | ||
7652 | if (remain < 6) | ||
7653 | return; | ||
7654 | |||
7655 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
7656 | v = rules.GetVector3Item(idx++); // cut | ||
7657 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7658 | twist = rules.GetVector3Item(idx++); | ||
7659 | taper_b = rules.GetVector3Item(idx++); | ||
7660 | topshear = rules.GetVector3Item(idx++); | ||
7661 | |||
7662 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | ||
7663 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); | ||
7664 | break; | ||
7665 | 7617 | ||
7666 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 7618 | break; |
7667 | if (remain < 6) | 7619 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7668 | return; | 7620 | if (remain < 1) |
7669 | 7621 | return; | |
7670 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7671 | v = rules.GetVector3Item(idx++); // cut | ||
7672 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7673 | twist = rules.GetVector3Item(idx++); | ||
7674 | taper_b = rules.GetVector3Item(idx++); | ||
7675 | topshear = rules.GetVector3Item(idx++); | ||
7676 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | ||
7677 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); | ||
7678 | break; | ||
7679 | 7622 | ||
7680 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 7623 | LSL_Rotation q = rules.GetQuaternionItem(idx++); |
7681 | if (remain < 6) | 7624 | // try to let this work as in SL... |
7682 | return; | 7625 | if (part.ParentID == 0) |
7683 | 7626 | { | |
7684 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7627 | // special case: If we are root, rotate complete SOG to new rotation |
7685 | v = rules.GetVector3Item(idx++); //cut | 7628 | SetRot(part, Rot2Quaternion(q)); |
7686 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7629 | } |
7687 | twist = rules.GetVector3Item(idx++); | 7630 | else |
7688 | taper_b = rules.GetVector3Item(idx++); | 7631 | { |
7689 | topshear = rules.GetVector3Item(idx++); | 7632 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
7690 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | 7633 | SceneObjectPart rootPart = part.ParentGroup.RootPart; |
7691 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); | 7634 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7692 | break; | 7635 | } |
7693 | 7636 | ||
7694 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | 7637 | break; |
7695 | if (remain < 5) | ||
7696 | return; | ||
7697 | |||
7698 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7699 | v = rules.GetVector3Item(idx++); // cut | ||
7700 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7701 | twist = rules.GetVector3Item(idx++); | ||
7702 | taper_b = rules.GetVector3Item(idx++); // dimple | ||
7703 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, | ||
7704 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); | ||
7705 | break; | ||
7706 | 7638 | ||
7707 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 7639 | case (int)ScriptBaseClass.PRIM_TYPE: |
7708 | if (remain < 11) | 7640 | if (remain < 3) |
7709 | return; | 7641 | return; |
7710 | |||
7711 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7712 | v = rules.GetVector3Item(idx++); //cut | ||
7713 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7714 | twist = rules.GetVector3Item(idx++); | ||
7715 | holesize = rules.GetVector3Item(idx++); | ||
7716 | topshear = rules.GetVector3Item(idx++); | ||
7717 | profilecut = rules.GetVector3Item(idx++); | ||
7718 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7719 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7720 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7721 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7722 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7723 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); | ||
7724 | break; | ||
7725 | 7642 | ||
7726 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 7643 | code = (int)rules.GetLSLIntegerItem(idx++); |
7727 | if (remain < 11) | ||
7728 | return; | ||
7729 | |||
7730 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7731 | v = rules.GetVector3Item(idx++); //cut | ||
7732 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7733 | twist = rules.GetVector3Item(idx++); | ||
7734 | holesize = rules.GetVector3Item(idx++); | ||
7735 | topshear = rules.GetVector3Item(idx++); | ||
7736 | profilecut = rules.GetVector3Item(idx++); | ||
7737 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7738 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7739 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7740 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7741 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7742 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); | ||
7743 | break; | ||
7744 | 7644 | ||
7745 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 7645 | remain = rules.Length - idx; |
7746 | if (remain < 11) | 7646 | float hollow; |
7747 | return; | 7647 | LSL_Vector twist; |
7748 | 7648 | LSL_Vector taper_b; | |
7749 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | 7649 | LSL_Vector topshear; |
7750 | v = rules.GetVector3Item(idx++); //cut | 7650 | float revolutions; |
7751 | hollow = (float)rules.GetLSLFloatItem(idx++); | 7651 | float radiusoffset; |
7752 | twist = rules.GetVector3Item(idx++); | 7652 | float skew; |
7753 | holesize = rules.GetVector3Item(idx++); | 7653 | LSL_Vector holesize; |
7754 | topshear = rules.GetVector3Item(idx++); | 7654 | LSL_Vector profilecut; |
7755 | profilecut = rules.GetVector3Item(idx++); | ||
7756 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7757 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7758 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7759 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7760 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7761 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); | ||
7762 | break; | ||
7763 | 7655 | ||
7764 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 7656 | switch (code) |
7765 | if (remain < 2) | 7657 | { |
7766 | return; | 7658 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
7659 | if (remain < 6) | ||
7660 | return; | ||
7661 | |||
7662 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
7663 | v = rules.GetVector3Item(idx++); // cut | ||
7664 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7665 | twist = rules.GetVector3Item(idx++); | ||
7666 | taper_b = rules.GetVector3Item(idx++); | ||
7667 | topshear = rules.GetVector3Item(idx++); | ||
7668 | |||
7669 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | ||
7670 | (byte)ProfileShape.Square, (byte)Extrusion.Straight); | ||
7671 | break; | ||
7672 | |||
7673 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | ||
7674 | if (remain < 6) | ||
7675 | return; | ||
7676 | |||
7677 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7678 | v = rules.GetVector3Item(idx++); // cut | ||
7679 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7680 | twist = rules.GetVector3Item(idx++); | ||
7681 | taper_b = rules.GetVector3Item(idx++); | ||
7682 | topshear = rules.GetVector3Item(idx++); | ||
7683 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | ||
7684 | (byte)ProfileShape.Circle, (byte)Extrusion.Straight); | ||
7685 | break; | ||
7686 | |||
7687 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | ||
7688 | if (remain < 6) | ||
7689 | return; | ||
7690 | |||
7691 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7692 | v = rules.GetVector3Item(idx++); //cut | ||
7693 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7694 | twist = rules.GetVector3Item(idx++); | ||
7695 | taper_b = rules.GetVector3Item(idx++); | ||
7696 | topshear = rules.GetVector3Item(idx++); | ||
7697 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, | ||
7698 | (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); | ||
7699 | break; | ||
7700 | |||
7701 | case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: | ||
7702 | if (remain < 5) | ||
7703 | return; | ||
7704 | |||
7705 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7706 | v = rules.GetVector3Item(idx++); // cut | ||
7707 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7708 | twist = rules.GetVector3Item(idx++); | ||
7709 | taper_b = rules.GetVector3Item(idx++); // dimple | ||
7710 | SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, | ||
7711 | (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); | ||
7712 | break; | ||
7713 | |||
7714 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | ||
7715 | if (remain < 11) | ||
7716 | return; | ||
7717 | |||
7718 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7719 | v = rules.GetVector3Item(idx++); //cut | ||
7720 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7721 | twist = rules.GetVector3Item(idx++); | ||
7722 | holesize = rules.GetVector3Item(idx++); | ||
7723 | topshear = rules.GetVector3Item(idx++); | ||
7724 | profilecut = rules.GetVector3Item(idx++); | ||
7725 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7726 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7727 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7728 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7729 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7730 | revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); | ||
7731 | break; | ||
7732 | |||
7733 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | ||
7734 | if (remain < 11) | ||
7735 | return; | ||
7736 | |||
7737 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7738 | v = rules.GetVector3Item(idx++); //cut | ||
7739 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7740 | twist = rules.GetVector3Item(idx++); | ||
7741 | holesize = rules.GetVector3Item(idx++); | ||
7742 | topshear = rules.GetVector3Item(idx++); | ||
7743 | profilecut = rules.GetVector3Item(idx++); | ||
7744 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7745 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7746 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7747 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7748 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7749 | revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); | ||
7750 | break; | ||
7751 | |||
7752 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | ||
7753 | if (remain < 11) | ||
7754 | return; | ||
7755 | |||
7756 | face = (int)rules.GetLSLIntegerItem(idx++); // holeshape | ||
7757 | v = rules.GetVector3Item(idx++); //cut | ||
7758 | hollow = (float)rules.GetLSLFloatItem(idx++); | ||
7759 | twist = rules.GetVector3Item(idx++); | ||
7760 | holesize = rules.GetVector3Item(idx++); | ||
7761 | topshear = rules.GetVector3Item(idx++); | ||
7762 | profilecut = rules.GetVector3Item(idx++); | ||
7763 | taper_b = rules.GetVector3Item(idx++); // taper_a | ||
7764 | revolutions = (float)rules.GetLSLFloatItem(idx++); | ||
7765 | radiusoffset = (float)rules.GetLSLFloatItem(idx++); | ||
7766 | skew = (float)rules.GetLSLFloatItem(idx++); | ||
7767 | SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, | ||
7768 | revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); | ||
7769 | break; | ||
7770 | |||
7771 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | ||
7772 | if (remain < 2) | ||
7773 | return; | ||
7774 | |||
7775 | string map = rules.Data[idx++].ToString(); | ||
7776 | face = (int)rules.GetLSLIntegerItem(idx++); // type | ||
7777 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); | ||
7778 | break; | ||
7779 | } | ||
7767 | 7780 | ||
7768 | string map = rules.Data[idx++].ToString(); | 7781 | break; |
7769 | face = (int)rules.GetLSLIntegerItem(idx++); // type | ||
7770 | SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); | ||
7771 | break; | ||
7772 | } | ||
7773 | 7782 | ||
7774 | break; | 7783 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
7784 | if (remain < 5) | ||
7785 | return; | ||
7775 | 7786 | ||
7776 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 7787 | face=(int)rules.GetLSLIntegerItem(idx++); |
7777 | if (remain < 5) | 7788 | string tex=rules.Data[idx++].ToString(); |
7778 | return; | 7789 | LSL_Vector repeats=rules.GetVector3Item(idx++); |
7790 | LSL_Vector offsets=rules.GetVector3Item(idx++); | ||
7791 | double rotation=(double)rules.GetLSLFloatItem(idx++); | ||
7779 | 7792 | ||
7780 | face=(int)rules.GetLSLIntegerItem(idx++); | 7793 | SetTexture(part, tex, face); |
7781 | string tex=rules.Data[idx++].ToString(); | 7794 | ScaleTexture(part, repeats.x, repeats.y, face); |
7782 | LSL_Vector repeats=rules.GetVector3Item(idx++); | 7795 | OffsetTexture(part, offsets.x, offsets.y, face); |
7783 | LSL_Vector offsets=rules.GetVector3Item(idx++); | 7796 | RotateTexture(part, rotation, face); |
7784 | double rotation=(double)rules.GetLSLFloatItem(idx++); | ||
7785 | 7797 | ||
7786 | SetTexture(part, tex, face); | 7798 | break; |
7787 | ScaleTexture(part, repeats.x, repeats.y, face); | ||
7788 | OffsetTexture(part, offsets.x, offsets.y, face); | ||
7789 | RotateTexture(part, rotation, face); | ||
7790 | 7799 | ||
7791 | break; | 7800 | case (int)ScriptBaseClass.PRIM_COLOR: |
7801 | if (remain < 3) | ||
7802 | return; | ||
7792 | 7803 | ||
7793 | case (int)ScriptBaseClass.PRIM_COLOR: | 7804 | face=(int)rules.GetLSLIntegerItem(idx++); |
7794 | if (remain < 3) | 7805 | LSL_Vector color=rules.GetVector3Item(idx++); |
7795 | return; | 7806 | double alpha=(double)rules.GetLSLFloatItem(idx++); |
7796 | 7807 | ||
7797 | face=(int)rules.GetLSLIntegerItem(idx++); | 7808 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
7798 | LSL_Vector color=rules.GetVector3Item(idx++); | 7809 | SetAlpha(part, alpha, face); |
7799 | double alpha=(double)rules.GetLSLFloatItem(idx++); | ||
7800 | 7810 | ||
7801 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); | 7811 | break; |
7802 | SetAlpha(part, alpha, face); | ||
7803 | 7812 | ||
7804 | break; | 7813 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7814 | if (remain < 7) | ||
7815 | return; | ||
7805 | 7816 | ||
7806 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 7817 | bool flexi = rules.GetLSLIntegerItem(idx++); |
7807 | if (remain < 7) | 7818 | int softness = rules.GetLSLIntegerItem(idx++); |
7808 | return; | 7819 | float gravity = (float)rules.GetLSLFloatItem(idx++); |
7820 | float friction = (float)rules.GetLSLFloatItem(idx++); | ||
7821 | float wind = (float)rules.GetLSLFloatItem(idx++); | ||
7822 | float tension = (float)rules.GetLSLFloatItem(idx++); | ||
7823 | LSL_Vector force = rules.GetVector3Item(idx++); | ||
7809 | 7824 | ||
7810 | bool flexi = rules.GetLSLIntegerItem(idx++); | 7825 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); |
7811 | int softness = rules.GetLSLIntegerItem(idx++); | ||
7812 | float gravity = (float)rules.GetLSLFloatItem(idx++); | ||
7813 | float friction = (float)rules.GetLSLFloatItem(idx++); | ||
7814 | float wind = (float)rules.GetLSLFloatItem(idx++); | ||
7815 | float tension = (float)rules.GetLSLFloatItem(idx++); | ||
7816 | LSL_Vector force = rules.GetVector3Item(idx++); | ||
7817 | 7826 | ||
7818 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); | 7827 | break; |
7819 | 7828 | ||
7820 | break; | 7829 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
7830 | if (remain < 5) | ||
7831 | return; | ||
7832 | bool light = rules.GetLSLIntegerItem(idx++); | ||
7833 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); | ||
7834 | float intensity = (float)rules.GetLSLFloatItem(idx++); | ||
7835 | float radius = (float)rules.GetLSLFloatItem(idx++); | ||
7836 | float falloff = (float)rules.GetLSLFloatItem(idx++); | ||
7821 | 7837 | ||
7822 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 7838 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); |
7823 | if (remain < 5) | ||
7824 | return; | ||
7825 | bool light = rules.GetLSLIntegerItem(idx++); | ||
7826 | LSL_Vector lightcolor = rules.GetVector3Item(idx++); | ||
7827 | float intensity = (float)rules.GetLSLFloatItem(idx++); | ||
7828 | float radius = (float)rules.GetLSLFloatItem(idx++); | ||
7829 | float falloff = (float)rules.GetLSLFloatItem(idx++); | ||
7830 | 7839 | ||
7831 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); | 7840 | break; |
7832 | 7841 | ||
7833 | break; | 7842 | case (int)ScriptBaseClass.PRIM_GLOW: |
7843 | if (remain < 2) | ||
7844 | return; | ||
7845 | face = rules.GetLSLIntegerItem(idx++); | ||
7846 | float glow = (float)rules.GetLSLFloatItem(idx++); | ||
7834 | 7847 | ||
7835 | case (int)ScriptBaseClass.PRIM_GLOW: | 7848 | SetGlow(part, face, glow); |
7836 | if (remain < 2) | ||
7837 | return; | ||
7838 | face = rules.GetLSLIntegerItem(idx++); | ||
7839 | float glow = (float)rules.GetLSLFloatItem(idx++); | ||
7840 | 7849 | ||
7841 | SetGlow(part, face, glow); | 7850 | break; |
7842 | 7851 | ||
7843 | break; | 7852 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
7853 | if (remain < 3) | ||
7854 | return; | ||
7855 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
7856 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | ||
7857 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | ||
7844 | 7858 | ||
7845 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 7859 | SetShiny(part, face, shiny, bump); |
7846 | if (remain < 3) | ||
7847 | return; | ||
7848 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
7849 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | ||
7850 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | ||
7851 | 7860 | ||
7852 | SetShiny(part, face, shiny, bump); | 7861 | break; |
7853 | 7862 | ||
7854 | break; | 7863 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7864 | if (remain < 2) | ||
7865 | return; | ||
7866 | face = rules.GetLSLIntegerItem(idx++); | ||
7867 | bool st = rules.GetLSLIntegerItem(idx++); | ||
7868 | SetFullBright(part, face , st); | ||
7869 | break; | ||
7855 | 7870 | ||
7856 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 7871 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
7857 | if (remain < 2) | 7872 | if (remain < 1) |
7858 | return; | 7873 | return; |
7859 | face = rules.GetLSLIntegerItem(idx++); | 7874 | int mat = rules.GetLSLIntegerItem(idx++); |
7860 | bool st = rules.GetLSLIntegerItem(idx++); | 7875 | if (mat < 0 || mat > 7) |
7861 | SetFullBright(part, face , st); | 7876 | return; |
7862 | break; | ||
7863 | 7877 | ||
7864 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 7878 | part.Material = Convert.ToByte(mat); |
7865 | if (remain < 1) | 7879 | break; |
7866 | return; | ||
7867 | int mat = rules.GetLSLIntegerItem(idx++); | ||
7868 | if (mat < 0 || mat > 7) | ||
7869 | return; | ||
7870 | 7880 | ||
7871 | part.Material = Convert.ToByte(mat); | 7881 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
7872 | break; | 7882 | if (remain < 1) |
7883 | return; | ||
7873 | 7884 | ||
7874 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 7885 | string ph = rules.Data[idx++].ToString(); |
7875 | if (remain < 1) | 7886 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); |
7876 | return; | ||
7877 | 7887 | ||
7878 | string ph = rules.Data[idx++].ToString(); | 7888 | break; |
7879 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | ||
7880 | 7889 | ||
7881 | break; | 7890 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
7891 | if (remain < 1) | ||
7892 | return; | ||
7893 | string phy = rules.Data[idx++].ToString(); | ||
7894 | bool physics; | ||
7882 | 7895 | ||
7883 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 7896 | if (phy.Equals("1")) |
7884 | if (remain < 1) | 7897 | physics = true; |
7885 | return; | 7898 | else |
7886 | string phy = rules.Data[idx++].ToString(); | 7899 | physics = false; |
7887 | bool physics; | ||
7888 | 7900 | ||
7889 | if (phy.Equals("1")) | 7901 | part.ScriptSetPhysicsStatus(physics); |
7890 | physics = true; | 7902 | break; |
7891 | else | ||
7892 | physics = false; | ||
7893 | 7903 | ||
7894 | part.ScriptSetPhysicsStatus(physics); | 7904 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
7895 | break; | 7905 | if (remain < 1) |
7906 | return; | ||
7907 | string temp = rules.Data[idx++].ToString(); | ||
7896 | 7908 | ||
7897 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 7909 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); |
7898 | if (remain < 1) | ||
7899 | return; | ||
7900 | string temp = rules.Data[idx++].ToString(); | ||
7901 | 7910 | ||
7902 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | 7911 | break; |
7903 | 7912 | ||
7904 | break; | 7913 | case (int)ScriptBaseClass.PRIM_TEXGEN: |
7914 | if (remain < 2) | ||
7915 | return; | ||
7916 | //face,type | ||
7917 | face = rules.GetLSLIntegerItem(idx++); | ||
7918 | int style = rules.GetLSLIntegerItem(idx++); | ||
7919 | SetTexGen(part, face, style); | ||
7920 | break; | ||
7921 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
7922 | if (remain < 3) | ||
7923 | return; | ||
7924 | string primText = rules.GetLSLStringItem(idx++); | ||
7925 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | ||
7926 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | ||
7927 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | ||
7928 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | ||
7929 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | ||
7930 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | ||
7905 | 7931 | ||
7906 | case (int)ScriptBaseClass.PRIM_TEXGEN: | 7932 | break; |
7907 | if (remain < 2) | 7933 | case (int)ScriptBaseClass.PRIM_NAME: |
7908 | return; | 7934 | if (remain < 1) |
7909 | //face,type | 7935 | return; |
7910 | face = rules.GetLSLIntegerItem(idx++); | 7936 | string primName = rules.GetLSLStringItem(idx++); |
7911 | int style = rules.GetLSLIntegerItem(idx++); | 7937 | part.Name = primName; |
7912 | SetTexGen(part, face, style); | 7938 | break; |
7913 | break; | 7939 | case (int)ScriptBaseClass.PRIM_DESC: |
7914 | case (int)ScriptBaseClass.PRIM_TEXT: | 7940 | if (remain < 1) |
7915 | if (remain < 3) | 7941 | return; |
7916 | return; | 7942 | string primDesc = rules.GetLSLStringItem(idx++); |
7917 | string primText = rules.GetLSLStringItem(idx++); | 7943 | part.Description = primDesc; |
7918 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | 7944 | break; |
7919 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | 7945 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
7920 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | 7946 | if (remain < 1) |
7921 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | 7947 | return; |
7922 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | 7948 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); |
7923 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | 7949 | SetRot(part, Rot2Quaternion(lr)); |
7950 | break; | ||
7951 | case (int)ScriptBaseClass.PRIM_OMEGA: | ||
7952 | if (remain < 3) | ||
7953 | return; | ||
7954 | LSL_Vector axis = rules.GetVector3Item(idx++); | ||
7955 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | ||
7956 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | ||
7957 | TargetOmega(part, axis, (double)spinrate, (double)gain); | ||
7958 | break; | ||
7959 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | ||
7960 | if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. | ||
7961 | return; | ||
7962 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | ||
7963 | LSL_List new_rules = rules.GetSublist(idx, -1); | ||
7964 | setLinkPrimParams((int)new_linknumber, new_rules); | ||
7924 | 7965 | ||
7925 | break; | ||
7926 | case (int)ScriptBaseClass.PRIM_NAME: | ||
7927 | if (remain < 1) | ||
7928 | return; | ||
7929 | string primName = rules.GetLSLStringItem(idx++); | ||
7930 | part.Name = primName; | ||
7931 | break; | ||
7932 | case (int)ScriptBaseClass.PRIM_DESC: | ||
7933 | if (remain < 1) | ||
7934 | return; | ||
7935 | string primDesc = rules.GetLSLStringItem(idx++); | ||
7936 | part.Description = primDesc; | ||
7937 | break; | ||
7938 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | ||
7939 | if (remain < 1) | ||
7940 | return; | 7966 | return; |
7941 | LSL_Rotation lr = rules.GetQuaternionItem(idx++); | 7967 | } |
7942 | SetRot(part, Rot2Quaternion(lr)); | 7968 | } |
7943 | break; | 7969 | } |
7944 | case (int)ScriptBaseClass.PRIM_OMEGA: | 7970 | finally |
7945 | if (remain < 3) | 7971 | { |
7946 | return; | 7972 | if (positionChanged) |
7947 | LSL_Vector axis = rules.GetVector3Item(idx++); | 7973 | { |
7948 | LSL_Float spinrate = rules.GetLSLFloatItem(idx++); | 7974 | if (part.ParentGroup.RootPart == part) |
7949 | LSL_Float gain = rules.GetLSLFloatItem(idx++); | 7975 | { |
7950 | TargetOmega(part, axis, (double)spinrate, (double)gain); | 7976 | SceneObjectGroup parent = part.ParentGroup; |
7951 | break; | 7977 | parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); |
7952 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 7978 | } |
7953 | if (remain < 1) | 7979 | else |
7954 | return; | 7980 | { |
7955 | LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); | 7981 | part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); |
7956 | part = part.ParentGroup.GetLinkNumPart((int)new_linknumber); | 7982 | SceneObjectGroup parent = part.ParentGroup; |
7957 | break; | 7983 | parent.HasGroupChanged = true; |
7984 | parent.ScheduleGroupForTerseUpdate(); | ||
7985 | } | ||
7958 | } | 7986 | } |
7959 | } | 7987 | } |
7960 | 7988 | ||