aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-08-25 18:32:59 +0100
committerMelanie2012-08-25 18:32:59 +0100
commit681066050c2f7019d1b425c86f7985d7650d8226 (patch)
treeb95b6187dddd8ac05784bb50f16eb8cd445fbb47
parentTemprary restructure to avoid conflicts (diff)
downloadopensim-SC-681066050c2f7019d1b425c86f7985d7650d8226.zip
opensim-SC-681066050c2f7019d1b425c86f7985d7650d8226.tar.gz
opensim-SC-681066050c2f7019d1b425c86f7985d7650d8226.tar.bz2
opensim-SC-681066050c2f7019d1b425c86f7985d7650d8226.tar.xz
Also move the other avatar based overload out of harms way
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs522
1 files changed, 261 insertions, 261 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2bdb485..64f145b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8670,267 +8670,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8670 return res; 8670 return res;
8671 } 8671 }
8672 8672
8673 public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules)
8674 {
8675 // avatars case
8676 // replies as SL wiki
8677
8678 LSL_List res = new LSL_List();
8679// SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed
8680 SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone??
8681
8682 int idx = 0;
8683 while (idx < rules.Length)
8684 {
8685 int code = (int)rules.GetLSLIntegerItem(idx++);
8686 int remain = rules.Length - idx;
8687
8688 switch (code)
8689 {
8690 case (int)ScriptBaseClass.PRIM_MATERIAL:
8691 res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh));
8692 break;
8693
8694 case (int)ScriptBaseClass.PRIM_PHYSICS:
8695 res.Add(new LSL_Integer(0));
8696 break;
8697
8698 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
8699 res.Add(new LSL_Integer(0));
8700 break;
8701
8702 case (int)ScriptBaseClass.PRIM_PHANTOM:
8703 res.Add(new LSL_Integer(0));
8704 break;
8705
8706 case (int)ScriptBaseClass.PRIM_POSITION:
8707
8708 Vector3 pos = avatar.OffsetPosition;
8709
8710 Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f);
8711 pos -= sitOffset;
8712
8713 if( sitPart != null)
8714 pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation();
8715
8716 res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z));
8717 break;
8718
8719 case (int)ScriptBaseClass.PRIM_SIZE:
8720 // as in llGetAgentSize above
8721 res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight));
8722 break;
8723
8724 case (int)ScriptBaseClass.PRIM_ROTATION:
8725 Quaternion rot = avatar.Rotation;
8726 if (sitPart != null)
8727 {
8728 rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation
8729 }
8730
8731 res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W));
8732 break;
8733
8734 case (int)ScriptBaseClass.PRIM_TYPE:
8735 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
8736 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
8737 res.Add(new LSL_Vector(0f,1.0f,0f));
8738 res.Add(new LSL_Float(0.0f));
8739 res.Add(new LSL_Vector(0, 0, 0));
8740 res.Add(new LSL_Vector(1.0f,1.0f,0f));
8741 res.Add(new LSL_Vector(0, 0, 0));
8742 break;
8743
8744 case (int)ScriptBaseClass.PRIM_TEXTURE:
8745 if (remain < 1)
8746 return res;
8747
8748 int face = (int)rules.GetLSLIntegerItem(idx++);
8749 if (face == ScriptBaseClass.ALL_SIDES)
8750 {
8751 for (face = 0; face < 21; face++)
8752 {
8753 res.Add(new LSL_String(""));
8754 res.Add(new LSL_Vector(0,0,0));
8755 res.Add(new LSL_Vector(0,0,0));
8756 res.Add(new LSL_Float(0.0));
8757 }
8758 }
8759 else
8760 {
8761 if (face >= 0 && face < 21)
8762 {
8763 res.Add(new LSL_String(""));
8764 res.Add(new LSL_Vector(0,0,0));
8765 res.Add(new LSL_Vector(0,0,0));
8766 res.Add(new LSL_Float(0.0));
8767 }
8768 }
8769 break;
8770
8771 case (int)ScriptBaseClass.PRIM_COLOR:
8772 if (remain < 1)
8773 return res;
8774
8775 face = (int)rules.GetLSLIntegerItem(idx++);
8776
8777 if (face == ScriptBaseClass.ALL_SIDES)
8778 {
8779 for (face = 0; face < 21; face++)
8780 {
8781 res.Add(new LSL_Vector(0,0,0));
8782 res.Add(new LSL_Float(0));
8783 }
8784 }
8785 else
8786 {
8787 res.Add(new LSL_Vector(0,0,0));
8788 res.Add(new LSL_Float(0));
8789 }
8790 break;
8791
8792 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
8793 if (remain < 1)
8794 return res;
8795 face = (int)rules.GetLSLIntegerItem(idx++);
8796
8797 if (face == ScriptBaseClass.ALL_SIDES)
8798 {
8799 for (face = 0; face < 21; face++)
8800 {
8801 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE));
8802 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE));
8803 }
8804 }
8805 else
8806 {
8807 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE));
8808 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE));
8809 }
8810 break;
8811
8812 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
8813 if (remain < 1)
8814 return res;
8815 face = (int)rules.GetLSLIntegerItem(idx++);
8816
8817 if (face == ScriptBaseClass.ALL_SIDES)
8818 {
8819 for (face = 0; face < 21; face++)
8820 {
8821 res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
8822 }
8823 }
8824 else
8825 {
8826 res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
8827 }
8828 break;
8829
8830 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
8831 res.Add(new LSL_Integer(0));
8832 res.Add(new LSL_Integer(0));// softness
8833 res.Add(new LSL_Float(0.0f)); // gravity
8834 res.Add(new LSL_Float(0.0f)); // friction
8835 res.Add(new LSL_Float(0.0f)); // wind
8836 res.Add(new LSL_Float(0.0f)); // tension
8837 res.Add(new LSL_Vector(0f,0f,0f));
8838 break;
8839
8840 case (int)ScriptBaseClass.PRIM_TEXGEN:
8841 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
8842 if (remain < 1)
8843 return res;
8844 face = (int)rules.GetLSLIntegerItem(idx++);
8845
8846 if (face == ScriptBaseClass.ALL_SIDES)
8847 {
8848 for (face = 0; face < 21; face++)
8849 {
8850 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
8851 }
8852 }
8853 else
8854 {
8855 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
8856 }
8857 break;
8858
8859 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
8860 res.Add(new LSL_Integer(0));
8861 res.Add(new LSL_Vector(0f,0f,0f));
8862 res.Add(new LSL_Float(0f)); // intensity
8863 res.Add(new LSL_Float(0f)); // radius
8864 res.Add(new LSL_Float(0f)); // falloff
8865 break;
8866
8867 case (int)ScriptBaseClass.PRIM_GLOW:
8868 if (remain < 1)
8869 return res;
8870 face = (int)rules.GetLSLIntegerItem(idx++);
8871
8872 if (face == ScriptBaseClass.ALL_SIDES)
8873 {
8874 for (face = 0; face < 21; face++)
8875 {
8876 res.Add(new LSL_Float(0f));
8877 }
8878 }
8879 else
8880 {
8881 res.Add(new LSL_Float(0f));
8882 }
8883 break;
8884
8885 case (int)ScriptBaseClass.PRIM_TEXT:
8886 res.Add(new LSL_String(""));
8887 res.Add(new LSL_Vector(0f,0f,0f));
8888 res.Add(new LSL_Float(1.0f));
8889 break;
8890
8891 case (int)ScriptBaseClass.PRIM_NAME:
8892 res.Add(new LSL_String(avatar.Name));
8893 break;
8894
8895 case (int)ScriptBaseClass.PRIM_DESC:
8896 res.Add(new LSL_String(""));
8897 break;
8898
8899 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8900 Quaternion lrot = avatar.Rotation;
8901
8902 if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
8903 {
8904 lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset
8905 }
8906 res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
8907 break;
8908
8909 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8910 Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part
8911 Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f);
8912 lpos -= lsitOffset;
8913
8914 if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
8915 {
8916 lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim
8917 }
8918 res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
8919 break;
8920
8921 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8922 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8923 return res;
8924 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
8925 LSL_List new_rules = rules.GetSublist(idx, -1);
8926
8927 res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules);
8928 return res;
8929 }
8930 }
8931 return res;
8932 }
8933
8934 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) 8673 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules)
8935 { 8674 {
8936 LSL_List res = new LSL_List(); 8675 LSL_List res = new LSL_List();
@@ -13152,5 +12891,266 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13152 } 12891 }
13153 return null; 12892 return null;
13154 } 12893 }
12894
12895 public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules)
12896 {
12897 // avatars case
12898 // replies as SL wiki
12899
12900 LSL_List res = new LSL_List();
12901// SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed
12902 SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone??
12903
12904 int idx = 0;
12905 while (idx < rules.Length)
12906 {
12907 int code = (int)rules.GetLSLIntegerItem(idx++);
12908 int remain = rules.Length - idx;
12909
12910 switch (code)
12911 {
12912 case (int)ScriptBaseClass.PRIM_MATERIAL:
12913 res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh));
12914 break;
12915
12916 case (int)ScriptBaseClass.PRIM_PHYSICS:
12917 res.Add(new LSL_Integer(0));
12918 break;
12919
12920 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
12921 res.Add(new LSL_Integer(0));
12922 break;
12923
12924 case (int)ScriptBaseClass.PRIM_PHANTOM:
12925 res.Add(new LSL_Integer(0));
12926 break;
12927
12928 case (int)ScriptBaseClass.PRIM_POSITION:
12929
12930 Vector3 pos = avatar.OffsetPosition;
12931
12932 Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f);
12933 pos -= sitOffset;
12934
12935 if( sitPart != null)
12936 pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation();
12937
12938 res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z));
12939 break;
12940
12941 case (int)ScriptBaseClass.PRIM_SIZE:
12942 // as in llGetAgentSize above
12943 res.Add(new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight));
12944 break;
12945
12946 case (int)ScriptBaseClass.PRIM_ROTATION:
12947 Quaternion rot = avatar.Rotation;
12948 if (sitPart != null)
12949 {
12950 rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation
12951 }
12952
12953 res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W));
12954 break;
12955
12956 case (int)ScriptBaseClass.PRIM_TYPE:
12957 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
12958 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
12959 res.Add(new LSL_Vector(0f,1.0f,0f));
12960 res.Add(new LSL_Float(0.0f));
12961 res.Add(new LSL_Vector(0, 0, 0));
12962 res.Add(new LSL_Vector(1.0f,1.0f,0f));
12963 res.Add(new LSL_Vector(0, 0, 0));
12964 break;
12965
12966 case (int)ScriptBaseClass.PRIM_TEXTURE:
12967 if (remain < 1)
12968 return res;
12969
12970 int face = (int)rules.GetLSLIntegerItem(idx++);
12971 if (face == ScriptBaseClass.ALL_SIDES)
12972 {
12973 for (face = 0; face < 21; face++)
12974 {
12975 res.Add(new LSL_String(""));
12976 res.Add(new LSL_Vector(0,0,0));
12977 res.Add(new LSL_Vector(0,0,0));
12978 res.Add(new LSL_Float(0.0));
12979 }
12980 }
12981 else
12982 {
12983 if (face >= 0 && face < 21)
12984 {
12985 res.Add(new LSL_String(""));
12986 res.Add(new LSL_Vector(0,0,0));
12987 res.Add(new LSL_Vector(0,0,0));
12988 res.Add(new LSL_Float(0.0));
12989 }
12990 }
12991 break;
12992
12993 case (int)ScriptBaseClass.PRIM_COLOR:
12994 if (remain < 1)
12995 return res;
12996
12997 face = (int)rules.GetLSLIntegerItem(idx++);
12998
12999 if (face == ScriptBaseClass.ALL_SIDES)
13000 {
13001 for (face = 0; face < 21; face++)
13002 {
13003 res.Add(new LSL_Vector(0,0,0));
13004 res.Add(new LSL_Float(0));
13005 }
13006 }
13007 else
13008 {
13009 res.Add(new LSL_Vector(0,0,0));
13010 res.Add(new LSL_Float(0));
13011 }
13012 break;
13013
13014 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
13015 if (remain < 1)
13016 return res;
13017 face = (int)rules.GetLSLIntegerItem(idx++);
13018
13019 if (face == ScriptBaseClass.ALL_SIDES)
13020 {
13021 for (face = 0; face < 21; face++)
13022 {
13023 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE));
13024 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE));
13025 }
13026 }
13027 else
13028 {
13029 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_SHINY_NONE));
13030 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_BUMP_NONE));
13031 }
13032 break;
13033
13034 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
13035 if (remain < 1)
13036 return res;
13037 face = (int)rules.GetLSLIntegerItem(idx++);
13038
13039 if (face == ScriptBaseClass.ALL_SIDES)
13040 {
13041 for (face = 0; face < 21; face++)
13042 {
13043 res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
13044 }
13045 }
13046 else
13047 {
13048 res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
13049 }
13050 break;
13051
13052 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
13053 res.Add(new LSL_Integer(0));
13054 res.Add(new LSL_Integer(0));// softness
13055 res.Add(new LSL_Float(0.0f)); // gravity
13056 res.Add(new LSL_Float(0.0f)); // friction
13057 res.Add(new LSL_Float(0.0f)); // wind
13058 res.Add(new LSL_Float(0.0f)); // tension
13059 res.Add(new LSL_Vector(0f,0f,0f));
13060 break;
13061
13062 case (int)ScriptBaseClass.PRIM_TEXGEN:
13063 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
13064 if (remain < 1)
13065 return res;
13066 face = (int)rules.GetLSLIntegerItem(idx++);
13067
13068 if (face == ScriptBaseClass.ALL_SIDES)
13069 {
13070 for (face = 0; face < 21; face++)
13071 {
13072 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
13073 }
13074 }
13075 else
13076 {
13077 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
13078 }
13079 break;
13080
13081 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
13082 res.Add(new LSL_Integer(0));
13083 res.Add(new LSL_Vector(0f,0f,0f));
13084 res.Add(new LSL_Float(0f)); // intensity
13085 res.Add(new LSL_Float(0f)); // radius
13086 res.Add(new LSL_Float(0f)); // falloff
13087 break;
13088
13089 case (int)ScriptBaseClass.PRIM_GLOW:
13090 if (remain < 1)
13091 return res;
13092 face = (int)rules.GetLSLIntegerItem(idx++);
13093
13094 if (face == ScriptBaseClass.ALL_SIDES)
13095 {
13096 for (face = 0; face < 21; face++)
13097 {
13098 res.Add(new LSL_Float(0f));
13099 }
13100 }
13101 else
13102 {
13103 res.Add(new LSL_Float(0f));
13104 }
13105 break;
13106
13107 case (int)ScriptBaseClass.PRIM_TEXT:
13108 res.Add(new LSL_String(""));
13109 res.Add(new LSL_Vector(0f,0f,0f));
13110 res.Add(new LSL_Float(1.0f));
13111 break;
13112
13113 case (int)ScriptBaseClass.PRIM_NAME:
13114 res.Add(new LSL_String(avatar.Name));
13115 break;
13116
13117 case (int)ScriptBaseClass.PRIM_DESC:
13118 res.Add(new LSL_String(""));
13119 break;
13120
13121 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
13122 Quaternion lrot = avatar.Rotation;
13123
13124 if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
13125 {
13126 lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset
13127 }
13128 res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
13129 break;
13130
13131 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
13132 Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part
13133 Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f);
13134 lpos -= lsitOffset;
13135
13136 if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
13137 {
13138 lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim
13139 }
13140 res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
13141 break;
13142
13143 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
13144 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
13145 return res;
13146 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
13147 LSL_List new_rules = rules.GetSublist(idx, -1);
13148
13149 res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules);
13150 return res;
13151 }
13152 }
13153 return res;
13154 }
13155 } 13155 }
13156} 13156}