aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs366
1 files changed, 183 insertions, 183 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7b52ea3..2bdb485 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7817,189 +7817,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7817 return new Vector3((float)x, (float)y, (float)z); 7817 return new Vector3((float)x, (float)y, (float)z);
7818 } 7818 }
7819 7819
7820 protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules)
7821 {
7822 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
7823
7824 int idx = 0;
7825
7826 bool positionChanged = false;
7827 Vector3 finalPos = Vector3.Zero;
7828
7829 try
7830 {
7831 while (idx < rules.Length)
7832 {
7833 int code = rules.GetLSLIntegerItem(idx++);
7834
7835 int remain = rules.Length - idx;
7836
7837 switch (code)
7838 {
7839 case (int)ScriptBaseClass.PRIM_POSITION:
7840 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
7841 {
7842 if (remain < 1)
7843 return null;
7844
7845 LSL_Vector v;
7846 v = rules.GetVector3Item(idx++);
7847
7848 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
7849 if (part == null)
7850 break;
7851
7852 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
7853 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
7854 if (part.LinkNum > 1)
7855 {
7856 localRot = GetPartLocalRot(part);
7857 localPos = GetPartLocalPos(part);
7858 }
7859
7860 v -= localPos;
7861 v /= localRot;
7862
7863 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
7864
7865 v = v + 2 * sitOffset;
7866
7867 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
7868 av.SendAvatarDataToAllAgents();
7869
7870 }
7871 break;
7872
7873 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7874 case (int)ScriptBaseClass.PRIM_ROTATION:
7875 {
7876 if (remain < 1)
7877 return null;
7878
7879 LSL_Rotation r;
7880 r = rules.GetQuaternionItem(idx++);
7881
7882 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
7883 if (part == null)
7884 break;
7885
7886 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
7887 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
7888
7889 if (part.LinkNum > 1)
7890 localRot = GetPartLocalRot(part);
7891
7892 r = r * llGetRootRotation() / localRot;
7893 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
7894 av.SendAvatarDataToAllAgents();
7895 }
7896 break;
7897
7898 // parse rest doing nothing but number of parameters error check
7899 case (int)ScriptBaseClass.PRIM_SIZE:
7900 case (int)ScriptBaseClass.PRIM_MATERIAL:
7901 case (int)ScriptBaseClass.PRIM_PHANTOM:
7902 case (int)ScriptBaseClass.PRIM_PHYSICS:
7903 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
7904 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7905 case (int)ScriptBaseClass.PRIM_NAME:
7906 case (int)ScriptBaseClass.PRIM_DESC:
7907 if (remain < 1)
7908 return null;
7909 idx++;
7910 break;
7911
7912 case (int)ScriptBaseClass.PRIM_GLOW:
7913 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7914 case (int)ScriptBaseClass.PRIM_TEXGEN:
7915 if (remain < 2)
7916 return null;
7917 idx += 2;
7918 break;
7919
7920 case (int)ScriptBaseClass.PRIM_TYPE:
7921 if (remain < 3)
7922 return null;
7923 code = (int)rules.GetLSLIntegerItem(idx++);
7924 remain = rules.Length - idx;
7925 switch (code)
7926 {
7927 case (int)ScriptBaseClass.PRIM_TYPE_BOX:
7928 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
7929 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
7930 if (remain < 6)
7931 return null;
7932 idx += 6;
7933 break;
7934
7935 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
7936 if (remain < 5)
7937 return null;
7938 idx += 5;
7939 break;
7940
7941 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
7942 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
7943 case (int)ScriptBaseClass.PRIM_TYPE_RING:
7944 if (remain < 11)
7945 return null;
7946 idx += 11;
7947 break;
7948
7949 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
7950 if (remain < 2)
7951 return null;
7952 idx += 2;
7953 break;
7954 }
7955 break;
7956
7957 case (int)ScriptBaseClass.PRIM_COLOR:
7958 case (int)ScriptBaseClass.PRIM_TEXT:
7959 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
7960 case (int)ScriptBaseClass.PRIM_OMEGA:
7961 if (remain < 3)
7962 return null;
7963 idx += 3;
7964 break;
7965
7966 case (int)ScriptBaseClass.PRIM_TEXTURE:
7967 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
7968 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
7969 if (remain < 5)
7970 return null;
7971 idx += 5;
7972 break;
7973
7974 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
7975 if (remain < 7)
7976 return null;
7977
7978 idx += 7;
7979 break;
7980
7981 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
7982 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
7983 return null;
7984
7985 return rules.GetSublist(idx, -1);
7986 }
7987 }
7988 }
7989
7990 finally
7991 {
7992 if (positionChanged)
7993 {
7994 av.OffsetPosition = finalPos;
7995// av.SendAvatarDataToAllAgents();
7996 av.SendTerseUpdateToAllClients();
7997 positionChanged = false;
7998 }
7999 }
8000 return null;
8001 }
8002
8003 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules) 7820 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules)
8004 { 7821 {
8005 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7822 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -13152,5 +12969,188 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13152 m_Notecards.Remove(key); 12969 m_Notecards.Remove(key);
13153 } 12970 }
13154 } 12971 }
12972
12973 protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules)
12974 {
12975 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
12976
12977 int idx = 0;
12978
12979 bool positionChanged = false;
12980 Vector3 finalPos = Vector3.Zero;
12981
12982 try
12983 {
12984 while (idx < rules.Length)
12985 {
12986 int code = rules.GetLSLIntegerItem(idx++);
12987
12988 int remain = rules.Length - idx;
12989
12990 switch (code)
12991 {
12992 case (int)ScriptBaseClass.PRIM_POSITION:
12993 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
12994 {
12995 if (remain < 1)
12996 return null;
12997
12998 LSL_Vector v;
12999 v = rules.GetVector3Item(idx++);
13000
13001 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
13002 if (part == null)
13003 break;
13004
13005 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
13006 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
13007 if (part.LinkNum > 1)
13008 {
13009 localRot = GetPartLocalRot(part);
13010 localPos = GetPartLocalPos(part);
13011 }
13012
13013 v -= localPos;
13014 v /= localRot;
13015
13016 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
13017
13018 v = v + 2 * sitOffset;
13019
13020 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
13021 av.SendAvatarDataToAllAgents();
13022
13023 }
13024 break;
13025
13026 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
13027 case (int)ScriptBaseClass.PRIM_ROTATION:
13028 {
13029 if (remain < 1)
13030 return null;
13031
13032 LSL_Rotation r;
13033 r = rules.GetQuaternionItem(idx++);
13034
13035 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
13036 if (part == null)
13037 break;
13038
13039 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
13040 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
13041
13042 if (part.LinkNum > 1)
13043 localRot = GetPartLocalRot(part);
13044
13045 r = r * llGetRootRotation() / localRot;
13046 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
13047 av.SendAvatarDataToAllAgents();
13048 }
13049 break;
13050
13051 // parse rest doing nothing but number of parameters error check
13052 case (int)ScriptBaseClass.PRIM_SIZE:
13053 case (int)ScriptBaseClass.PRIM_MATERIAL:
13054 case (int)ScriptBaseClass.PRIM_PHANTOM:
13055 case (int)ScriptBaseClass.PRIM_PHYSICS:
13056 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
13057 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
13058 case (int)ScriptBaseClass.PRIM_NAME:
13059 case (int)ScriptBaseClass.PRIM_DESC:
13060 if (remain < 1)
13061 return null;
13062 idx++;
13063 break;
13064
13065 case (int)ScriptBaseClass.PRIM_GLOW:
13066 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
13067 case (int)ScriptBaseClass.PRIM_TEXGEN:
13068 if (remain < 2)
13069 return null;
13070 idx += 2;
13071 break;
13072
13073 case (int)ScriptBaseClass.PRIM_TYPE:
13074 if (remain < 3)
13075 return null;
13076 code = (int)rules.GetLSLIntegerItem(idx++);
13077 remain = rules.Length - idx;
13078 switch (code)
13079 {
13080 case (int)ScriptBaseClass.PRIM_TYPE_BOX:
13081 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
13082 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
13083 if (remain < 6)
13084 return null;
13085 idx += 6;
13086 break;
13087
13088 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
13089 if (remain < 5)
13090 return null;
13091 idx += 5;
13092 break;
13093
13094 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
13095 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
13096 case (int)ScriptBaseClass.PRIM_TYPE_RING:
13097 if (remain < 11)
13098 return null;
13099 idx += 11;
13100 break;
13101
13102 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
13103 if (remain < 2)
13104 return null;
13105 idx += 2;
13106 break;
13107 }
13108 break;
13109
13110 case (int)ScriptBaseClass.PRIM_COLOR:
13111 case (int)ScriptBaseClass.PRIM_TEXT:
13112 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
13113 case (int)ScriptBaseClass.PRIM_OMEGA:
13114 if (remain < 3)
13115 return null;
13116 idx += 3;
13117 break;
13118
13119 case (int)ScriptBaseClass.PRIM_TEXTURE:
13120 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
13121 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
13122 if (remain < 5)
13123 return null;
13124 idx += 5;
13125 break;
13126
13127 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
13128 if (remain < 7)
13129 return null;
13130
13131 idx += 7;
13132 break;
13133
13134 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
13135 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
13136 return null;
13137
13138 return rules.GetSublist(idx, -1);
13139 }
13140 }
13141 }
13142
13143 finally
13144 {
13145 if (positionChanged)
13146 {
13147 av.OffsetPosition = finalPos;
13148// av.SendAvatarDataToAllAgents();
13149 av.SendTerseUpdateToAllClients();
13150 positionChanged = false;
13151 }
13152 }
13153 return null;
13154 }
13155 } 13155 }
13156} 13156}