aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs214
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs1
3 files changed, 191 insertions, 29 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
index 06e4bea..eb2bcb0 100644
--- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
@@ -285,6 +285,11 @@ namespace OpenSim.Region.ScriptEngine.Common
285 m_LSL_Functions.llShout(channelID, text); 285 m_LSL_Functions.llShout(channelID, text);
286 } 286 }
287 287
288 public void llRegionSay(int channelID, string text)
289 {
290 m_LSL_Functions.llRegionSay(channelID, text);
291 }
292
288 public int llListen(int channelID, string name, string ID, string msg) 293 public int llListen(int channelID, string name, string ID, string msg)
289 { 294 {
290 return m_LSL_Functions.llListen(channelID, name, ID, msg); 295 return m_LSL_Functions.llListen(channelID, name, ID, msg);
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 2b09bea..1a3b6ce 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -404,6 +404,20 @@ namespace OpenSim.Region.ScriptEngine.Common
404 wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Shout, channelID, m_host.Name, text); 404 wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Shout, channelID, m_host.Name, text);
405 } 405 }
406 406
407 public void llRegionSay(int channelID, string text)
408 {
409 if(channelID == 0)
410 {
411 LSLError("Cannot use llRegionSay() on channel 0");
412 return;
413 }
414
415 m_host.AddScriptLPS(1);
416
417 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
418 wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Broadcast, channelID, m_host.Name, text);
419 }
420
407 public int llListen(int channelID, string name, string ID, string msg) 421 public int llListen(int channelID, string name, string ID, string msg)
408 { 422 {
409 m_host.AddScriptLPS(1); 423 m_host.AddScriptLPS(1);
@@ -817,13 +831,18 @@ namespace OpenSim.Region.ScriptEngine.Common
817 public void llSetScale(LSL_Types.Vector3 scale) 831 public void llSetScale(LSL_Types.Vector3 scale)
818 { 832 {
819 m_host.AddScriptLPS(1); 833 m_host.AddScriptLPS(1);
834 SetScale(m_host, scale);
835 }
836
837 private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale)
838 {
820 // TODO: this needs to trigger a persistance save as well 839 // TODO: this needs to trigger a persistance save as well
821 LLVector3 tmp = m_host.Scale; 840 LLVector3 tmp = part.Scale;
822 tmp.X = (float)scale.x; 841 tmp.X = (float)scale.x;
823 tmp.Y = (float)scale.y; 842 tmp.Y = (float)scale.y;
824 tmp.Z = (float)scale.z; 843 tmp.Z = (float)scale.z;
825 m_host.Scale = tmp; 844 part.Scale = tmp;
826 m_host.SendFullUpdateToAllClients(); 845 part.SendFullUpdateToAllClients();
827 return; 846 return;
828 } 847 }
829 848
@@ -836,7 +855,13 @@ namespace OpenSim.Region.ScriptEngine.Common
836 public void llSetColor(LSL_Types.Vector3 color, int face) 855 public void llSetColor(LSL_Types.Vector3 color, int face)
837 { 856 {
838 m_host.AddScriptLPS(1); 857 m_host.AddScriptLPS(1);
839 LLObject.TextureEntry tex = m_host.Shape.Textures; 858
859 SetColor(m_host, color, face);
860 }
861
862 private void SetColor(SceneObjectPart part, LSL_Types.Vector3 color, int face)
863 {
864 LLObject.TextureEntry tex = part.Shape.Textures;
840 LLColor texcolor; 865 LLColor texcolor;
841 if (face > -1) 866 if (face > -1)
842 { 867 {
@@ -845,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Common
845 texcolor.G = (float)Math.Abs(color.y - 1); 870 texcolor.G = (float)Math.Abs(color.y - 1);
846 texcolor.B = (float)Math.Abs(color.z - 1); 871 texcolor.B = (float)Math.Abs(color.z - 1);
847 tex.FaceTextures[face].RGBA = texcolor; 872 tex.FaceTextures[face].RGBA = texcolor;
848 m_host.UpdateTexture(tex); 873 part.UpdateTexture(tex);
849 return; 874 return;
850 } 875 }
851 else if (face == -1) 876 else if (face == -1)
@@ -866,7 +891,7 @@ namespace OpenSim.Region.ScriptEngine.Common
866 texcolor.B = (float)Math.Abs(color.z - 1); 891 texcolor.B = (float)Math.Abs(color.z - 1);
867 tex.DefaultTexture.RGBA = texcolor; 892 tex.DefaultTexture.RGBA = texcolor;
868 } 893 }
869 m_host.UpdateTexture(tex); 894 part.UpdateTexture(tex);
870 return; 895 return;
871 } 896 }
872 else 897 else
@@ -893,14 +918,20 @@ namespace OpenSim.Region.ScriptEngine.Common
893 public void llSetAlpha(double alpha, int face) 918 public void llSetAlpha(double alpha, int face)
894 { 919 {
895 m_host.AddScriptLPS(1); 920 m_host.AddScriptLPS(1);
896 LLObject.TextureEntry tex = m_host.Shape.Textures; 921
922 SetAlpha(m_host, alpha, face);
923 }
924
925 private void SetAlpha(SceneObjectPart part, double alpha, int face)
926 {
927 LLObject.TextureEntry tex = part.Shape.Textures;
897 LLColor texcolor; 928 LLColor texcolor;
898 if (face > -1) 929 if (face > -1)
899 { 930 {
900 texcolor = tex.CreateFace((uint)face).RGBA; 931 texcolor = tex.CreateFace((uint)face).RGBA;
901 texcolor.A = (float)Math.Abs(alpha - 1); 932 texcolor.A = (float)Math.Abs(alpha - 1);
902 tex.FaceTextures[face].RGBA = texcolor; 933 tex.FaceTextures[face].RGBA = texcolor;
903 m_host.UpdateTexture(tex); 934 part.UpdateTexture(tex);
904 return; 935 return;
905 } 936 }
906 else if (face == -1) 937 else if (face == -1)
@@ -917,7 +948,7 @@ namespace OpenSim.Region.ScriptEngine.Common
917 texcolor = tex.DefaultTexture.RGBA; 948 texcolor = tex.DefaultTexture.RGBA;
918 texcolor.A = (float)Math.Abs(alpha - 1); 949 texcolor.A = (float)Math.Abs(alpha - 1);
919 tex.DefaultTexture.RGBA = texcolor; 950 tex.DefaultTexture.RGBA = texcolor;
920 m_host.UpdateTexture(tex); 951 part.UpdateTexture(tex);
921 return; 952 return;
922 } 953 }
923 else 954 else
@@ -958,7 +989,11 @@ namespace OpenSim.Region.ScriptEngine.Common
958 public void llSetTexture(string texture, int face) 989 public void llSetTexture(string texture, int face)
959 { 990 {
960 m_host.AddScriptLPS(1); 991 m_host.AddScriptLPS(1);
992 SetTexture(m_host, texture, face);
993 }
961 994
995 private void SetTexture(SceneObjectPart part, string texture, int face)
996 {
962 LLUUID textureID=new LLUUID(); 997 LLUUID textureID=new LLUUID();
963 998
964 if(!LLUUID.TryParse(texture, out textureID)) 999 if(!LLUUID.TryParse(texture, out textureID))
@@ -969,14 +1004,14 @@ namespace OpenSim.Region.ScriptEngine.Common
969 if(textureID == LLUUID.Zero) 1004 if(textureID == LLUUID.Zero)
970 return; 1005 return;
971 1006
972 LLObject.TextureEntry tex = m_host.Shape.Textures; 1007 LLObject.TextureEntry tex = part.Shape.Textures;
973 1008
974 if (face > -1) 1009 if (face > -1)
975 { 1010 {
976 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); 1011 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
977 texface.TextureID = textureID; 1012 texface.TextureID = textureID;
978 tex.FaceTextures[face] = texface; 1013 tex.FaceTextures[face] = texface;
979 m_host.UpdateTexture(tex); 1014 part.UpdateTexture(tex);
980 return; 1015 return;
981 } 1016 }
982 else if (face == -1) 1017 else if (face == -1)
@@ -989,7 +1024,7 @@ namespace OpenSim.Region.ScriptEngine.Common
989 } 1024 }
990 } 1025 }
991 tex.DefaultTexture.TextureID = textureID; 1026 tex.DefaultTexture.TextureID = textureID;
992 m_host.UpdateTexture(tex); 1027 part.UpdateTexture(tex);
993 return; 1028 return;
994 } 1029 }
995 else 1030 else
@@ -1001,14 +1036,20 @@ namespace OpenSim.Region.ScriptEngine.Common
1001 public void llScaleTexture(double u, double v, int face) 1036 public void llScaleTexture(double u, double v, int face)
1002 { 1037 {
1003 m_host.AddScriptLPS(1); 1038 m_host.AddScriptLPS(1);
1004 LLObject.TextureEntry tex = m_host.Shape.Textures; 1039
1040 ScaleTexture(m_host, u, v, face);
1041 }
1042
1043 private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
1044 {
1045 LLObject.TextureEntry tex = part.Shape.Textures;
1005 if (face > -1) 1046 if (face > -1)
1006 { 1047 {
1007 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); 1048 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
1008 texface.RepeatU = (float)u; 1049 texface.RepeatU = (float)u;
1009 texface.RepeatV = (float)v; 1050 texface.RepeatV = (float)v;
1010 tex.FaceTextures[face] = texface; 1051 tex.FaceTextures[face] = texface;
1011 m_host.UpdateTexture(tex); 1052 part.UpdateTexture(tex);
1012 return; 1053 return;
1013 } 1054 }
1014 if (face == -1) 1055 if (face == -1)
@@ -1023,7 +1064,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1023 } 1064 }
1024 tex.DefaultTexture.RepeatU = (float)u; 1065 tex.DefaultTexture.RepeatU = (float)u;
1025 tex.DefaultTexture.RepeatV = (float)v; 1066 tex.DefaultTexture.RepeatV = (float)v;
1026 m_host.UpdateTexture(tex); 1067 part.UpdateTexture(tex);
1027 return; 1068 return;
1028 } 1069 }
1029 else 1070 else
@@ -1035,14 +1076,19 @@ namespace OpenSim.Region.ScriptEngine.Common
1035 public void llOffsetTexture(double u, double v, int face) 1076 public void llOffsetTexture(double u, double v, int face)
1036 { 1077 {
1037 m_host.AddScriptLPS(1); 1078 m_host.AddScriptLPS(1);
1038 LLObject.TextureEntry tex = m_host.Shape.Textures; 1079 OffsetTexture(m_host, u, v, face);
1080 }
1081
1082 private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
1083 {
1084 LLObject.TextureEntry tex = part.Shape.Textures;
1039 if (face > -1) 1085 if (face > -1)
1040 { 1086 {
1041 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); 1087 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
1042 texface.OffsetU = (float)u; 1088 texface.OffsetU = (float)u;
1043 texface.OffsetV = (float)v; 1089 texface.OffsetV = (float)v;
1044 tex.FaceTextures[face] = texface; 1090 tex.FaceTextures[face] = texface;
1045 m_host.UpdateTexture(tex); 1091 part.UpdateTexture(tex);
1046 return; 1092 return;
1047 } 1093 }
1048 if (face == -1) 1094 if (face == -1)
@@ -1057,7 +1103,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1057 } 1103 }
1058 tex.DefaultTexture.OffsetU = (float)u; 1104 tex.DefaultTexture.OffsetU = (float)u;
1059 tex.DefaultTexture.OffsetV = (float)v; 1105 tex.DefaultTexture.OffsetV = (float)v;
1060 m_host.UpdateTexture(tex); 1106 part.UpdateTexture(tex);
1061 return; 1107 return;
1062 } 1108 }
1063 else 1109 else
@@ -1069,13 +1115,18 @@ namespace OpenSim.Region.ScriptEngine.Common
1069 public void llRotateTexture(double rotation, int face) 1115 public void llRotateTexture(double rotation, int face)
1070 { 1116 {
1071 m_host.AddScriptLPS(1); 1117 m_host.AddScriptLPS(1);
1072 LLObject.TextureEntry tex = m_host.Shape.Textures; 1118 RotateTexture(m_host, rotation, face);
1119 }
1120
1121 private void RotateTexture(SceneObjectPart part, double rotation, int face)
1122 {
1123 LLObject.TextureEntry tex = part.Shape.Textures;
1073 if (face > -1) 1124 if (face > -1)
1074 { 1125 {
1075 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); 1126 LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
1076 texface.Rotation = (float)rotation; 1127 texface.Rotation = (float)rotation;
1077 tex.FaceTextures[face] = texface; 1128 tex.FaceTextures[face] = texface;
1078 m_host.UpdateTexture(tex); 1129 part.UpdateTexture(tex);
1079 return; 1130 return;
1080 } 1131 }
1081 if (face == -1) 1132 if (face == -1)
@@ -1088,7 +1139,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1088 } 1139 }
1089 } 1140 }
1090 tex.DefaultTexture.Rotation = (float)rotation; 1141 tex.DefaultTexture.Rotation = (float)rotation;
1091 m_host.UpdateTexture(tex); 1142 part.UpdateTexture(tex);
1092 return; 1143 return;
1093 } 1144 }
1094 else 1145 else
@@ -1121,13 +1172,19 @@ namespace OpenSim.Region.ScriptEngine.Common
1121 public void llSetPos(LSL_Types.Vector3 pos) 1172 public void llSetPos(LSL_Types.Vector3 pos)
1122 { 1173 {
1123 m_host.AddScriptLPS(1); 1174 m_host.AddScriptLPS(1);
1124 if (m_host.ParentID != 0) 1175
1176 SetPos(m_host, pos);
1177 }
1178
1179 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos)
1180 {
1181 if (part.ParentID != 0)
1125 { 1182 {
1126 m_host.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1183 part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z));
1127 } 1184 }
1128 else 1185 else
1129 { 1186 {
1130 m_host.UpdateGroupPosition(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1187 part.UpdateGroupPosition(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z));
1131 } 1188 }
1132 } 1189 }
1133 1190
@@ -1159,9 +1216,15 @@ namespace OpenSim.Region.ScriptEngine.Common
1159 public void llSetRot(LSL_Types.Quaternion rot) 1216 public void llSetRot(LSL_Types.Quaternion rot)
1160 { 1217 {
1161 m_host.AddScriptLPS(1); 1218 m_host.AddScriptLPS(1);
1162 m_host.UpdateRotation(new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s)); 1219
1220 SetRot(m_host, rot);
1221 }
1222
1223 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot)
1224 {
1225 part.UpdateRotation(new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s));
1163 // Update rotation does not move the object in the physics scene if it's a linkset. 1226 // Update rotation does not move the object in the physics scene if it's a linkset.
1164 m_host.ParentGroup.AbsolutePosition = m_host.ParentGroup.AbsolutePosition; 1227 part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
1165 } 1228 }
1166 1229
1167 public LSL_Types.Quaternion llGetRot() 1230 public LSL_Types.Quaternion llGetRot()
@@ -4159,14 +4222,107 @@ namespace OpenSim.Region.ScriptEngine.Common
4159 4222
4160 public void llSetPrimitiveParams(LSL_Types.list rules) 4223 public void llSetPrimitiveParams(LSL_Types.list rules)
4161 { 4224 {
4162 m_host.AddScriptLPS(1); 4225 llSetLinkPrimitiveParams(m_host.LinkNum+1, rules);
4163 NotImplemented("llSetPrimitiveParams");
4164 } 4226 }
4165 4227
4166 public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) 4228 public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules)
4167 { 4229 {
4168 m_host.AddScriptLPS(1); 4230 m_host.AddScriptLPS(1);
4169 NotImplemented("llSetLinkPrimitiveParams"); 4231
4232 SceneObjectPart part=null;
4233
4234 if(m_host.LinkNum+1 != linknumber)
4235 {
4236 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
4237 {
4238 if ((partInst.LinkNum + 1) == linknumber)
4239 {
4240 part=partInst;
4241 break;
4242 }
4243 }
4244 }
4245 else
4246 {
4247 part=m_host;
4248 }
4249
4250 if(part == null)
4251 return;
4252
4253
4254 int idx=0;
4255
4256 while(idx < rules.Length)
4257 {
4258 int code=Convert.ToInt32(rules.Data[idx++]);
4259
4260 int remain=rules.Length-idx;
4261
4262 int face;
4263 LSL_Types.Vector3 v;
4264
4265 switch(code)
4266 {
4267 case 6: // PRIM_POSITION
4268 if(remain < 1)
4269 return;
4270
4271 v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4272 SetPos(part, v);
4273
4274 break;
4275
4276 case 8: // PRIM_ROTATION
4277 if(remain < 1)
4278 return;
4279
4280 LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString());
4281 SetRot(part, q);
4282
4283 break;
4284
4285 case 17: // PRIM_TEXTURE
4286 if(remain < 5)
4287 return;
4288
4289 face=Convert.ToInt32(rules.Data[idx++]);
4290 string tex=rules.Data[idx++].ToString();
4291 LSL_Types.Vector3 repeats=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4292 LSL_Types.Vector3 offsets=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4293 double rotation=Convert.ToDouble(rules.Data[idx++]);
4294
4295 SetTexture(part, tex, face);
4296 ScaleTexture(part, repeats.x, repeats.y, face);
4297 OffsetTexture(part, offsets.x, offsets.y, face);
4298 RotateTexture(part, rotation, face);
4299
4300 break;
4301
4302 case 18: // PRIM_COLOR
4303 if(remain < 3)
4304 return;
4305
4306 face=Convert.ToInt32(rules.Data[idx++]);
4307 LSL_Types.Vector3 color=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4308 double alpha=Convert.ToDouble(rules.Data[idx++]);
4309
4310 SetColor(part, color, face);
4311 SetAlpha(part, alpha, face);
4312
4313 break;
4314
4315 case 7: // PRIM_SIZE
4316 if(remain < 1)
4317 return;
4318
4319 v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4320 SetScale(part, v);
4321
4322 break;
4323
4324 }
4325 }
4170 } 4326 }
4171 4327
4172 public string llStringToBase64(string str) 4328 public string llStringToBase64(string str)
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index 43ca5fd..2f58437 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Common
63 //void llSay(int channelID, string text); 63 //void llSay(int channelID, string text);
64 void llSay(int channelID, string text); 64 void llSay(int channelID, string text);
65 void llShout(int channelID, string text); 65 void llShout(int channelID, string text);
66 void llRegionSay(int channelID, string text);
66 int llListen(int channelID, string name, string ID, string msg); 67 int llListen(int channelID, string name, string ID, string msg);
67 void llListenControl(int number, int active); 68 void llListenControl(int number, int active);
68 void llListenRemove(int number); 69 void llListenRemove(int number);