diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
26 files changed, 370 insertions, 374 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 25c0d9a..9195063 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -361,23 +361,23 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
361 | a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting | 361 | a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting |
362 | vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. | 362 | vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. |
363 | */ | 363 | */ |
364 | 364 | ||
365 | /* How we arrived at this llEuler2Rot | 365 | /* How we arrived at this llEuler2Rot |
366 | * | 366 | * |
367 | * Experiment in SL to determine conventions: | 367 | * Experiment in SL to determine conventions: |
368 | * llEuler2Rot(<PI,0,0>)=<1,0,0,0> | 368 | * llEuler2Rot(<PI,0,0>)=<1,0,0,0> |
369 | * llEuler2Rot(<0,PI,0>)=<0,1,0,0> | 369 | * llEuler2Rot(<0,PI,0>)=<0,1,0,0> |
370 | * llEuler2Rot(<0,0,PI>)=<0,0,1,0> | 370 | * llEuler2Rot(<0,0,PI>)=<0,0,1,0> |
371 | * | 371 | * |
372 | * Important facts about Quaternions | 372 | * Important facts about Quaternions |
373 | * - multiplication is non-commutative (a*b != b*a) | 373 | * - multiplication is non-commutative (a*b != b*a) |
374 | * - http://en.wikipedia.org/wiki/Quaternion#Basis_multiplication | 374 | * - http://en.wikipedia.org/wiki/Quaternion#Basis_multiplication |
375 | * | 375 | * |
376 | * Above SL experiment gives (c1,c2,c3,s1,s2,s3 as defined in our llEuler2Rot): | 376 | * Above SL experiment gives (c1,c2,c3,s1,s2,s3 as defined in our llEuler2Rot): |
377 | * Qx = c1+i*s1 | 377 | * Qx = c1+i*s1 |
378 | * Qy = c2+j*s2; | 378 | * Qy = c2+j*s2; |
379 | * Qz = c3+k*s3; | 379 | * Qz = c3+k*s3; |
380 | * | 380 | * |
381 | * Rotations applied in order (from above) Z, Y, X | 381 | * Rotations applied in order (from above) Z, Y, X |
382 | * Q = (Qz * Qy) * Qx | 382 | * Q = (Qz * Qy) * Qx |
383 | * ((c1+i*s1)*(c2+j*s2))*(c3+k*s3) | 383 | * ((c1+i*s1)*(c2+j*s2))*(c3+k*s3) |
@@ -389,23 +389,23 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
389 | * y=j*(c1*s2*c3-s1*c2*s3) | 389 | * y=j*(c1*s2*c3-s1*c2*s3) |
390 | * z=k*(s1*s2*c3+c1*c2*s3) | 390 | * z=k*(s1*s2*c3+c1*c2*s3) |
391 | * s= c1*c2*c3-s1*s2*s3 | 391 | * s= c1*c2*c3-s1*s2*s3 |
392 | * | 392 | * |
393 | * This implementation agrees with the functions found here: | 393 | * This implementation agrees with the functions found here: |
394 | * http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions | 394 | * http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions |
395 | * And with the results in SL. | 395 | * And with the results in SL. |
396 | * | 396 | * |
397 | * It's also possible to calculate llEuler2Rot by direct multiplication of | 397 | * It's also possible to calculate llEuler2Rot by direct multiplication of |
398 | * the Qz, Qy, and Qx vectors (as above - and done in the "accurate" function | 398 | * the Qz, Qy, and Qx vectors (as above - and done in the "accurate" function |
399 | * from the wiki). | 399 | * from the wiki). |
400 | * Apparently in some cases this is better from a numerical precision perspective? | 400 | * Apparently in some cases this is better from a numerical precision perspective? |
401 | */ | 401 | */ |
402 | 402 | ||
403 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | 403 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) |
404 | { | 404 | { |
405 | m_host.AddScriptLPS(1); | 405 | m_host.AddScriptLPS(1); |
406 | 406 | ||
407 | double x,y,z,s; | 407 | double x,y,z,s; |
408 | 408 | ||
409 | double c1 = Math.Cos(v.x/2.0); | 409 | double c1 = Math.Cos(v.x/2.0); |
410 | double c2 = Math.Cos(v.y/2.0); | 410 | double c2 = Math.Cos(v.y/2.0); |
411 | double c3 = Math.Cos(v.z/2.0); | 411 | double c3 = Math.Cos(v.z/2.0); |
@@ -417,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
417 | y = c1*s2*c3-s1*c2*s3; | 417 | y = c1*s2*c3-s1*c2*s3; |
418 | z = s1*s2*c3+c1*c2*s3; | 418 | z = s1*s2*c3+c1*c2*s3; |
419 | s = c1*c2*c3-s1*s2*s3; | 419 | s = c1*c2*c3-s1*s2*s3; |
420 | 420 | ||
421 | return new LSL_Types.Quaternion(x, y, z, s); | 421 | return new LSL_Types.Quaternion(x, y, z, s); |
422 | } | 422 | } |
423 | 423 | ||
@@ -427,7 +427,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
427 | double x,y,z,s; | 427 | double x,y,z,s; |
428 | int f=0; | 428 | int f=0; |
429 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> | 429 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> |
430 | // Computing quaternion x,y,z,s values | 430 | // Computing quaternion x,y,z,s values |
431 | x = ((fwd.x - left.y - up.z + 1) / 4); | 431 | x = ((fwd.x - left.y - up.z + 1) / 4); |
432 | x *= x; | 432 | x *= x; |
433 | x = Math.Sqrt(Math.Sqrt(x)); | 433 | x = Math.Sqrt(Math.Sqrt(x)); |
@@ -441,7 +441,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
441 | s *= s; | 441 | s *= s; |
442 | s = Math.Sqrt(Math.Sqrt(s)); | 442 | s = Math.Sqrt(Math.Sqrt(s)); |
443 | 443 | ||
444 | // Set f for signs detection | 444 | // Set f for signs detection |
445 | if (fwd.y+left.x >= 0){f+=1;} | 445 | if (fwd.y+left.x >= 0){f+=1;} |
446 | if (fwd.z+up.x >= 0){f+=2;} | 446 | if (fwd.z+up.x >= 0){f+=2;} |
447 | if (left.z-up.y >= 0){f+=4;} | 447 | if (left.z-up.y >= 0){f+=4;} |
@@ -510,7 +510,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
510 | x = 2 * (r.x * r.y - r.z * r.s); | 510 | x = 2 * (r.x * r.y - r.z * r.s); |
511 | y = -r.x * r.x + r.y * r.y - r.z * r.z + r.s * r.s; | 511 | y = -r.x * r.x + r.y * r.y - r.z * r.z + r.s * r.s; |
512 | z = 2 * (r.x * r.s + r.y * r.z); | 512 | z = 2 * (r.x * r.s + r.y * r.z); |
513 | return (new LSL_Types.Vector3(x, y, z)); | 513 | return (new LSL_Types.Vector3(x, y, z)); |
514 | } | 514 | } |
515 | 515 | ||
516 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) | 516 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) |
@@ -536,7 +536,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
536 | z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; | 536 | z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; |
537 | return (new LSL_Types.Vector3(x, y, z)); | 537 | return (new LSL_Types.Vector3(x, y, z)); |
538 | } | 538 | } |
539 | 539 | ||
540 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | 540 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) |
541 | { | 541 | { |
542 | //A and B should both be normalized | 542 | //A and B should both be normalized |
@@ -1215,7 +1215,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1215 | 1215 | ||
1216 | /// <summary> | 1216 | /// <summary> |
1217 | /// Set flexi parameters of a part. | 1217 | /// Set flexi parameters of a part. |
1218 | /// | 1218 | /// |
1219 | /// FIXME: Much of this code should probably be within the part itself. | 1219 | /// FIXME: Much of this code should probably be within the part itself. |
1220 | /// </summary> | 1220 | /// </summary> |
1221 | /// <param name="part"></param> | 1221 | /// <param name="part"></param> |
@@ -1226,7 +1226,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1226 | /// <param name="wind"></param> | 1226 | /// <param name="wind"></param> |
1227 | /// <param name="tension"></param> | 1227 | /// <param name="tension"></param> |
1228 | /// <param name="Force"></param> | 1228 | /// <param name="Force"></param> |
1229 | private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, | 1229 | private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, |
1230 | float wind, float tension, LSL_Types.Vector3 Force) | 1230 | float wind, float tension, LSL_Types.Vector3 Force) |
1231 | { | 1231 | { |
1232 | if (part == null) | 1232 | if (part == null) |
@@ -1239,7 +1239,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1239 | { | 1239 | { |
1240 | needs_fakedelete = true; | 1240 | needs_fakedelete = true; |
1241 | } | 1241 | } |
1242 | part.Shape.FlexiEntry = true; // this setting flexi true isn't working, but the below parameters do | 1242 | part.Shape.FlexiEntry = true; // this setting flexi true isn't working, but the below parameters do |
1243 | // work once the prim is already flexi | 1243 | // work once the prim is already flexi |
1244 | part.Shape.FlexiSoftness = softness; | 1244 | part.Shape.FlexiSoftness = softness; |
1245 | part.Shape.FlexiGravity = gravity; | 1245 | part.Shape.FlexiGravity = gravity; |
@@ -1265,7 +1265,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1265 | if (needs_fakedelete) | 1265 | if (needs_fakedelete) |
1266 | { | 1266 | { |
1267 | if (part.ParentGroup != null) | 1267 | if (part.ParentGroup != null) |
1268 | { | 1268 | { |
1269 | part.ParentGroup.FakeDeleteGroup(); | 1269 | part.ParentGroup.FakeDeleteGroup(); |
1270 | } | 1270 | } |
1271 | } | 1271 | } |
@@ -1276,7 +1276,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1276 | 1276 | ||
1277 | /// <summary> | 1277 | /// <summary> |
1278 | /// Set a light point on a part | 1278 | /// Set a light point on a part |
1279 | /// | 1279 | /// |
1280 | /// FIXME: Much of this code should probably be in SceneObjectGroup | 1280 | /// FIXME: Much of this code should probably be in SceneObjectGroup |
1281 | /// </summary> | 1281 | /// </summary> |
1282 | /// <param name="part"></param> | 1282 | /// <param name="part"></param> |
@@ -1781,7 +1781,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1781 | m_host.SoundGain = volume; | 1781 | m_host.SoundGain = volume; |
1782 | m_host.SoundFlags = 1; // looping | 1782 | m_host.SoundFlags = 1; // looping |
1783 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | 1783 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? |
1784 | 1784 | ||
1785 | m_host.ScheduleFullUpdate(); | 1785 | m_host.ScheduleFullUpdate(); |
1786 | m_host.SendFullUpdateToAllClients(); | 1786 | m_host.SendFullUpdateToAllClients(); |
1787 | } | 1787 | } |
@@ -2908,13 +2908,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2908 | bool found = false; | 2908 | bool found = false; |
2909 | LLUUID destId = LLUUID.Zero; | 2909 | LLUUID destId = LLUUID.Zero; |
2910 | LLUUID objId = LLUUID.Zero; | 2910 | LLUUID objId = LLUUID.Zero; |
2911 | 2911 | ||
2912 | if (!LLUUID.TryParse(destination, out destId)) | 2912 | if (!LLUUID.TryParse(destination, out destId)) |
2913 | { | 2913 | { |
2914 | llSay(0, "Could not parse key " + destination); | 2914 | llSay(0, "Could not parse key " + destination); |
2915 | return; | 2915 | return; |
2916 | } | 2916 | } |
2917 | 2917 | ||
2918 | // move the first object found with this inventory name | 2918 | // move the first object found with this inventory name |
2919 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 2919 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
2920 | { | 2920 | { |
@@ -2931,7 +2931,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2931 | llSay(0, String.Format("Could not find object '{0}'", inventory)); | 2931 | llSay(0, String.Format("Could not find object '{0}'", inventory)); |
2932 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); | 2932 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); |
2933 | } | 2933 | } |
2934 | 2934 | ||
2935 | // check if destination is an avatar | 2935 | // check if destination is an avatar |
2936 | if (World.GetScenePresence(destId) != null) | 2936 | if (World.GetScenePresence(destId) != null) |
2937 | { | 2937 | { |
@@ -2993,7 +2993,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2993 | { | 2993 | { |
2994 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.m_Dataserver.RegisterRequest( | 2994 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.m_Dataserver.RegisterRequest( |
2995 | m_localID, m_itemID, item.AssetID.ToString()); | 2995 | m_localID, m_itemID, item.AssetID.ToString()); |
2996 | 2996 | ||
2997 | LLVector3 region = new LLVector3( | 2997 | LLVector3 region = new LLVector3( |
2998 | World.RegionInfo.RegionLocX * Constants.RegionSize, | 2998 | World.RegionInfo.RegionLocX * Constants.RegionSize, |
2999 | World.RegionInfo.RegionLocY * Constants.RegionSize, | 2999 | World.RegionInfo.RegionLocY * Constants.RegionSize, |
@@ -4155,13 +4155,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4155 | if (LLUUID.TryParse(id,out key)) | 4155 | if (LLUUID.TryParse(id,out key)) |
4156 | { | 4156 | { |
4157 | ScenePresence presence = World.GetScenePresence(key); | 4157 | ScenePresence presence = World.GetScenePresence(key); |
4158 | 4158 | ||
4159 | if (presence != null) | 4159 | if (presence != null) |
4160 | { | 4160 | { |
4161 | return presence.ControllingClient.Name; | 4161 | return presence.ControllingClient.Name; |
4162 | //return presence.Name; | 4162 | //return presence.Name; |
4163 | } | 4163 | } |
4164 | 4164 | ||
4165 | if (World.GetSceneObjectPart(key) != null) | 4165 | if (World.GetSceneObjectPart(key) != null) |
4166 | { | 4166 | { |
4167 | return World.GetSceneObjectPart(key).Name; | 4167 | return World.GetSceneObjectPart(key).Name; |
@@ -4516,7 +4516,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4516 | private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues() | 4516 | private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues() |
4517 | { | 4517 | { |
4518 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(); | 4518 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(); |
4519 | 4519 | ||
4520 | // TODO find out about the other defaults and add them here | 4520 | // TODO find out about the other defaults and add them here |
4521 | ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | 4521 | ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); |
4522 | ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | 4522 | ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); |
@@ -4530,7 +4530,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4530 | ps.PartMaxAge = 10.0f; | 4530 | ps.PartMaxAge = 10.0f; |
4531 | return ps; | 4531 | return ps; |
4532 | } | 4532 | } |
4533 | 4533 | ||
4534 | public void llParticleSystem(LSL_Types.list rules) | 4534 | public void llParticleSystem(LSL_Types.list rules) |
4535 | { | 4535 | { |
4536 | m_host.AddScriptLPS(1); | 4536 | m_host.AddScriptLPS(1); |
@@ -4725,7 +4725,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4725 | itemList.Add(itemID); | 4725 | itemList.Add(itemID); |
4726 | } | 4726 | } |
4727 | } | 4727 | } |
4728 | 4728 | ||
4729 | if (itemList.Count == 0) | 4729 | if (itemList.Count == 0) |
4730 | return; | 4730 | return; |
4731 | 4731 | ||
@@ -4973,7 +4973,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4973 | public void llSetRemoteScriptAccessPin(int pin) | 4973 | public void llSetRemoteScriptAccessPin(int pin) |
4974 | { | 4974 | { |
4975 | m_host.AddScriptLPS(1); | 4975 | m_host.AddScriptLPS(1); |
4976 | 4976 | ||
4977 | m_host.ScriptAccessPin = pin; | 4977 | m_host.ScriptAccessPin = pin; |
4978 | } | 4978 | } |
4979 | 4979 | ||
@@ -4983,19 +4983,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4983 | bool found = false; | 4983 | bool found = false; |
4984 | LLUUID destId = LLUUID.Zero; | 4984 | LLUUID destId = LLUUID.Zero; |
4985 | LLUUID srcId = LLUUID.Zero; | 4985 | LLUUID srcId = LLUUID.Zero; |
4986 | 4986 | ||
4987 | if (!LLUUID.TryParse(target, out destId)) | 4987 | if (!LLUUID.TryParse(target, out destId)) |
4988 | { | 4988 | { |
4989 | llSay(0, "Could not parse key " + target); | 4989 | llSay(0, "Could not parse key " + target); |
4990 | return; | 4990 | return; |
4991 | } | 4991 | } |
4992 | 4992 | ||
4993 | // target must be a different prim than the one containing the script | 4993 | // target must be a different prim than the one containing the script |
4994 | if (m_host.UUID == destId) | 4994 | if (m_host.UUID == destId) |
4995 | { | 4995 | { |
4996 | return; | 4996 | return; |
4997 | } | 4997 | } |
4998 | 4998 | ||
4999 | // copy the first script found with this inventory name | 4999 | // copy the first script found with this inventory name |
5000 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 5000 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
5001 | { | 5001 | { |
@@ -5010,13 +5010,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5010 | } | 5010 | } |
5011 | } | 5011 | } |
5012 | } | 5012 | } |
5013 | 5013 | ||
5014 | if (!found) | 5014 | if (!found) |
5015 | { | 5015 | { |
5016 | llSay(0, "Could not find script " + name); | 5016 | llSay(0, "Could not find script " + name); |
5017 | return; | 5017 | return; |
5018 | } | 5018 | } |
5019 | 5019 | ||
5020 | // the rest of the permission checks are done in RezScript, so check the pin there as well | 5020 | // the rest of the permission checks are done in RezScript, so check the pin there as well |
5021 | World.RezScript(srcId, m_host, destId, pin, running, start_param); | 5021 | World.RezScript(srcId, m_host, destId, pin, running, start_param); |
5022 | // this will cause the delay even if the script pin or permissions were wrong - seems ok | 5022 | // this will cause the delay even if the script pin or permissions were wrong - seems ok |
@@ -5066,11 +5066,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5066 | m_host.AddScriptLPS(1); | 5066 | m_host.AddScriptLPS(1); |
5067 | return Util.Md5Hash(src + ":" + nonce.ToString()); | 5067 | return Util.Md5Hash(src + ":" + nonce.ToString()); |
5068 | } | 5068 | } |
5069 | 5069 | ||
5070 | private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) | 5070 | private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) |
5071 | { | 5071 | { |
5072 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 5072 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
5073 | 5073 | ||
5074 | if (holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_DEFAULT && | 5074 | if (holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_DEFAULT && |
5075 | holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_CIRCLE && | 5075 | holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_CIRCLE && |
5076 | holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_SQUARE && | 5076 | holeshape != (int)BuiltIn_Commands_BaseClass.PRIM_HOLE_SQUARE && |
@@ -5128,23 +5128,23 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5128 | } | 5128 | } |
5129 | shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); | 5129 | shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); |
5130 | shapeBlock.PathTwist = (sbyte)(200 * twist.y); | 5130 | shapeBlock.PathTwist = (sbyte)(200 * twist.y); |
5131 | 5131 | ||
5132 | shapeBlock.ObjectLocalID = m_host.LocalId; | 5132 | shapeBlock.ObjectLocalID = m_host.LocalId; |
5133 | 5133 | ||
5134 | // retain pathcurve | 5134 | // retain pathcurve |
5135 | shapeBlock.PathCurve = m_host.Shape.PathCurve; | 5135 | shapeBlock.PathCurve = m_host.Shape.PathCurve; |
5136 | 5136 | ||
5137 | return shapeBlock; | 5137 | return shapeBlock; |
5138 | } | 5138 | } |
5139 | 5139 | ||
5140 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) | 5140 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) |
5141 | { | 5141 | { |
5142 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5142 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5143 | 5143 | ||
5144 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5144 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5145 | 5145 | ||
5146 | shapeBlock.ProfileCurve += fudge; | 5146 | shapeBlock.ProfileCurve += fudge; |
5147 | 5147 | ||
5148 | if (taper_b.x < 0f) | 5148 | if (taper_b.x < 0f) |
5149 | { | 5149 | { |
5150 | taper_b.x = 0f; | 5150 | taper_b.x = 0f; |
@@ -5181,25 +5181,25 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5181 | } | 5181 | } |
5182 | shapeBlock.PathShearX = (byte)(100 * topshear.x); | 5182 | shapeBlock.PathShearX = (byte)(100 * topshear.x); |
5183 | shapeBlock.PathShearY = (byte)(100 * topshear.y); | 5183 | shapeBlock.PathShearY = (byte)(100 * topshear.y); |
5184 | 5184 | ||
5185 | m_host.UpdateShape(shapeBlock); | 5185 | m_host.UpdateShape(shapeBlock); |
5186 | } | 5186 | } |
5187 | 5187 | ||
5188 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) | 5188 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) |
5189 | { | 5189 | { |
5190 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5190 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5191 | 5191 | ||
5192 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5192 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5193 | 5193 | ||
5194 | // profile/path swapped for a sphere | 5194 | // profile/path swapped for a sphere |
5195 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 5195 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
5196 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; | 5196 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; |
5197 | 5197 | ||
5198 | shapeBlock.ProfileCurve += fudge; | 5198 | shapeBlock.ProfileCurve += fudge; |
5199 | 5199 | ||
5200 | shapeBlock.PathScaleX = 100; | 5200 | shapeBlock.PathScaleX = 100; |
5201 | shapeBlock.PathScaleY = 100; | 5201 | shapeBlock.PathScaleY = 100; |
5202 | 5202 | ||
5203 | if (dimple.x < 0f) | 5203 | if (dimple.x < 0f) |
5204 | { | 5204 | { |
5205 | dimple.x = 0f; | 5205 | dimple.x = 0f; |
@@ -5222,22 +5222,22 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5222 | } | 5222 | } |
5223 | shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); | 5223 | shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); |
5224 | shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); | 5224 | shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); |
5225 | 5225 | ||
5226 | m_host.UpdateShape(shapeBlock); | 5226 | m_host.UpdateShape(shapeBlock); |
5227 | } | 5227 | } |
5228 | 5228 | ||
5229 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) | 5229 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) |
5230 | { | 5230 | { |
5231 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5231 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5232 | 5232 | ||
5233 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5233 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5234 | 5234 | ||
5235 | shapeBlock.ProfileCurve += fudge; | 5235 | shapeBlock.ProfileCurve += fudge; |
5236 | 5236 | ||
5237 | // profile/path swapped for a torrus, tube, ring | 5237 | // profile/path swapped for a torrus, tube, ring |
5238 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 5238 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
5239 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; | 5239 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; |
5240 | 5240 | ||
5241 | if (holesize.x < 0.05f) | 5241 | if (holesize.x < 0.05f) |
5242 | { | 5242 | { |
5243 | holesize.x = 0.05f; | 5243 | holesize.x = 0.05f; |
@@ -5342,15 +5342,15 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5342 | skew = 0.95f; | 5342 | skew = 0.95f; |
5343 | } | 5343 | } |
5344 | shapeBlock.PathSkew = (sbyte)(100 * skew); | 5344 | shapeBlock.PathSkew = (sbyte)(100 * skew); |
5345 | 5345 | ||
5346 | m_host.UpdateShape(shapeBlock); | 5346 | m_host.UpdateShape(shapeBlock); |
5347 | } | 5347 | } |
5348 | 5348 | ||
5349 | private void SetPrimitiveShapeParams(string map, int type) | 5349 | private void SetPrimitiveShapeParams(string map, int type) |
5350 | { | 5350 | { |
5351 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 5351 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
5352 | LLUUID sculptId; | 5352 | LLUUID sculptId; |
5353 | 5353 | ||
5354 | if (!LLUUID.TryParse(map, out sculptId)) | 5354 | if (!LLUUID.TryParse(map, out sculptId)) |
5355 | { | 5355 | { |
5356 | llSay(0, "Could not parse key " + map); | 5356 | llSay(0, "Could not parse key " + map); |
@@ -5360,7 +5360,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5360 | shapeBlock.ObjectLocalID = m_host.LocalId; | 5360 | shapeBlock.ObjectLocalID = m_host.LocalId; |
5361 | shapeBlock.PathScaleX = 100; | 5361 | shapeBlock.PathScaleX = 100; |
5362 | shapeBlock.PathScaleY = 150; | 5362 | shapeBlock.PathScaleY = 150; |
5363 | 5363 | ||
5364 | if (type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_CYLINDER && | 5364 | if (type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_CYLINDER && |
5365 | type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_PLANE && | 5365 | type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_PLANE && |
5366 | type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_SPHERE && | 5366 | type != (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_SPHERE && |
@@ -5369,7 +5369,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5369 | // default | 5369 | // default |
5370 | type = (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_SPHERE; | 5370 | type = (int)BuiltIn_Commands_BaseClass.PRIM_SCULPT_TYPE_SPHERE; |
5371 | } | 5371 | } |
5372 | 5372 | ||
5373 | // retain pathcurve | 5373 | // retain pathcurve |
5374 | shapeBlock.PathCurve = m_host.Shape.PathCurve; | 5374 | shapeBlock.PathCurve = m_host.Shape.PathCurve; |
5375 | 5375 | ||
@@ -5422,7 +5422,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5422 | 5422 | ||
5423 | v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5423 | v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
5424 | SetScale(part, v); | 5424 | SetScale(part, v); |
5425 | 5425 | ||
5426 | break; | 5426 | break; |
5427 | case (int)BuiltIn_Commands_BaseClass.PRIM_ROTATION: | 5427 | case (int)BuiltIn_Commands_BaseClass.PRIM_ROTATION: |
5428 | if (remain < 1) | 5428 | if (remain < 1) |
@@ -5432,13 +5432,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5432 | SetRot(part, q); | 5432 | SetRot(part, q); |
5433 | 5433 | ||
5434 | break; | 5434 | break; |
5435 | 5435 | ||
5436 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: | 5436 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: |
5437 | if (remain < 3) | 5437 | if (remain < 3) |
5438 | return; | 5438 | return; |
5439 | 5439 | ||
5440 | code = Convert.ToInt32(rules.Data[idx++]); | 5440 | code = Convert.ToInt32(rules.Data[idx++]); |
5441 | 5441 | ||
5442 | remain = rules.Length - idx; | 5442 | remain = rules.Length - idx; |
5443 | float hollow; | 5443 | float hollow; |
5444 | LSL_Types.Vector3 twist; | 5444 | LSL_Types.Vector3 twist; |
@@ -5449,9 +5449,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5449 | float skew; | 5449 | float skew; |
5450 | LSL_Types.Vector3 holesize; | 5450 | LSL_Types.Vector3 holesize; |
5451 | LSL_Types.Vector3 profilecut; | 5451 | LSL_Types.Vector3 profilecut; |
5452 | 5452 | ||
5453 | switch (code) | 5453 | switch (code) |
5454 | { | 5454 | { |
5455 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: | 5455 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: |
5456 | if (remain < 6) | 5456 | if (remain < 6) |
5457 | return; | 5457 | return; |
@@ -5465,7 +5465,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5465 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; | 5465 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; |
5466 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); | 5466 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); |
5467 | break; | 5467 | break; |
5468 | 5468 | ||
5469 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: | 5469 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: |
5470 | if (remain < 6) | 5470 | if (remain < 6) |
5471 | return; | 5471 | return; |
@@ -5480,12 +5480,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5480 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; | 5480 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; |
5481 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); | 5481 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); |
5482 | break; | 5482 | break; |
5483 | 5483 | ||
5484 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: | 5484 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: |
5485 | if (remain < 6) | 5485 | if (remain < 6) |
5486 | return; | 5486 | return; |
5487 | 5487 | ||
5488 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5488 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5489 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5489 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5490 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5490 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5491 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5491 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5507,12 +5507,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5507 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5507 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5508 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); | 5508 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); |
5509 | break; | 5509 | break; |
5510 | 5510 | ||
5511 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: | 5511 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: |
5512 | if (remain < 11) | 5512 | if (remain < 11) |
5513 | return; | 5513 | return; |
5514 | 5514 | ||
5515 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5515 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5516 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5516 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5517 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5517 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5518 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5518 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5526,12 +5526,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5526 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5526 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5527 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); | 5527 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); |
5528 | break; | 5528 | break; |
5529 | 5529 | ||
5530 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: | 5530 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: |
5531 | if (remain < 11) | 5531 | if (remain < 11) |
5532 | return; | 5532 | return; |
5533 | 5533 | ||
5534 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5534 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5535 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5535 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5536 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5536 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5537 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5537 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5545,12 +5545,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5545 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5545 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5546 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); | 5546 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); |
5547 | break; | 5547 | break; |
5548 | 5548 | ||
5549 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: | 5549 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: |
5550 | if (remain < 11) | 5550 | if (remain < 11) |
5551 | return; | 5551 | return; |
5552 | 5552 | ||
5553 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5553 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5554 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5554 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5555 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5555 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5556 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5556 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5564,7 +5564,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5564 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5564 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5565 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); | 5565 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); |
5566 | break; | 5566 | break; |
5567 | 5567 | ||
5568 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: | 5568 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: |
5569 | if (remain < 2) | 5569 | if (remain < 2) |
5570 | return; | 5570 | return; |
@@ -5575,7 +5575,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5575 | SetPrimitiveShapeParams(map, face); | 5575 | SetPrimitiveShapeParams(map, face); |
5576 | break; | 5576 | break; |
5577 | } | 5577 | } |
5578 | 5578 | ||
5579 | break; | 5579 | break; |
5580 | 5580 | ||
5581 | case (int)BuiltIn_Commands_BaseClass.PRIM_TEXTURE: | 5581 | case (int)BuiltIn_Commands_BaseClass.PRIM_TEXTURE: |
@@ -5630,7 +5630,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5630 | float intensity = (float)Convert.ToDouble(rules.Data[idx++]); | 5630 | float intensity = (float)Convert.ToDouble(rules.Data[idx++]); |
5631 | float radius = (float)Convert.ToDouble(rules.Data[idx++]); | 5631 | float radius = (float)Convert.ToDouble(rules.Data[idx++]); |
5632 | float falloff = (float)Convert.ToDouble(rules.Data[idx++]); | 5632 | float falloff = (float)Convert.ToDouble(rules.Data[idx++]); |
5633 | 5633 | ||
5634 | SetPointLight(part, (light == 1), lightcolor, intensity, radius, falloff); | 5634 | SetPointLight(part, (light == 1), lightcolor, intensity, radius, falloff); |
5635 | 5635 | ||
5636 | break; | 5636 | break; |
@@ -5701,7 +5701,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5701 | public LSL_Types.list llGetAnimationList( string id ) | 5701 | public LSL_Types.list llGetAnimationList( string id ) |
5702 | { | 5702 | { |
5703 | m_host.AddScriptLPS(1); | 5703 | m_host.AddScriptLPS(1); |
5704 | 5704 | ||
5705 | LSL_Types.list l = new LSL_Types.list(); | 5705 | LSL_Types.list l = new LSL_Types.list(); |
5706 | ScenePresence av = World.GetScenePresence(id); | 5706 | ScenePresence av = World.GetScenePresence(id); |
5707 | if (av == null) | 5707 | if (av == null) |
@@ -6560,7 +6560,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6560 | IConfigSource config = new IniConfigSource(Application.iniFilePath); | 6560 | IConfigSource config = new IniConfigSource(Application.iniFilePath); |
6561 | if (config.Configs["LL-Functions"] == null) | 6561 | if (config.Configs["LL-Functions"] == null) |
6562 | config.AddConfig("LL-Functions"); | 6562 | config.AddConfig("LL-Functions"); |
6563 | 6563 | ||
6564 | if (config.Configs["LL-Functions"].GetBoolean("AllowGodFunctions", false)) | 6564 | if (config.Configs["LL-Functions"].GetBoolean("AllowGodFunctions", false)) |
6565 | { | 6565 | { |
6566 | if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) | 6566 | if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) |
@@ -6829,7 +6829,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6829 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) | 6829 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) |
6830 | m_host.AddScriptLPS(1); | 6830 | m_host.AddScriptLPS(1); |
6831 | for (int i = 0; i < commandList.Data.Length; i++) | 6831 | for (int i = 0; i < commandList.Data.Length; i++) |
6832 | { | 6832 | { |
6833 | switch ((ParcelMediaCommandEnum)commandList.Data[i]) | 6833 | switch ((ParcelMediaCommandEnum)commandList.Data[i]) |
6834 | { | 6834 | { |
6835 | case ParcelMediaCommandEnum.Play: | 6835 | case ParcelMediaCommandEnum.Play: |
@@ -6839,7 +6839,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6839 | if (!agent.IsChildAgent) | 6839 | if (!agent.IsChildAgent) |
6840 | { | 6840 | { |
6841 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); | 6841 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); |
6842 | } | 6842 | } |
6843 | } | 6843 | } |
6844 | break; | 6844 | break; |
6845 | case ParcelMediaCommandEnum.Stop: | 6845 | case ParcelMediaCommandEnum.Stop: |
@@ -6870,7 +6870,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6870 | { | 6870 | { |
6871 | //Set the new media URL only if the user is the owner of the land | 6871 | //Set the new media URL only if the user is the owner of the land |
6872 | osSetParcelMediaURL(commandList.Data[i + 1].ToString()); | 6872 | osSetParcelMediaURL(commandList.Data[i + 1].ToString()); |
6873 | 6873 | ||
6874 | List<ScenePresence> scenePresenceList = World.GetScenePresences(); | 6874 | List<ScenePresence> scenePresenceList = World.GetScenePresences(); |
6875 | LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6875 | LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6876 | //Send an update of the mediaURL to all the clients that are in the parcel | 6876 | //Send an update of the mediaURL to all the clients that are in the parcel |
@@ -6881,8 +6881,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6881 | //Send parcel media update to the client | 6881 | //Send parcel media update to the client |
6882 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1); | 6882 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1); |
6883 | } | 6883 | } |
6884 | } | 6884 | } |
6885 | 6885 | ||
6886 | } | 6886 | } |
6887 | i++; | 6887 | i++; |
6888 | } | 6888 | } |
@@ -6892,7 +6892,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6892 | NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString()); | 6892 | NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString()); |
6893 | break; | 6893 | break; |
6894 | }//end switch | 6894 | }//end switch |
6895 | 6895 | ||
6896 | } | 6896 | } |
6897 | 6897 | ||
6898 | 6898 | ||
@@ -6935,7 +6935,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6935 | } | 6935 | } |
6936 | } | 6936 | } |
6937 | return list; | 6937 | return list; |
6938 | 6938 | ||
6939 | } | 6939 | } |
6940 | 6940 | ||
6941 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) | 6941 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) |
@@ -6979,7 +6979,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6979 | { | 6979 | { |
6980 | m_host.AddScriptLPS(1); | 6980 | m_host.AddScriptLPS(1); |
6981 | LLUUID invItemID=InventorySelf(); | 6981 | LLUUID invItemID=InventorySelf(); |
6982 | if (invItemID == LLUUID.Zero) | 6982 | if (invItemID == LLUUID.Zero) |
6983 | return new LSL_Types.Vector3(); | 6983 | return new LSL_Types.Vector3(); |
6984 | if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) | 6984 | if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) |
6985 | return new LSL_Types.Vector3(); | 6985 | return new LSL_Types.Vector3(); |
@@ -6989,7 +6989,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6989 | return new LSL_Types.Vector3(); | 6989 | return new LSL_Types.Vector3(); |
6990 | } | 6990 | } |
6991 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 6991 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
6992 | if (presence != null) | 6992 | if (presence != null) |
6993 | { | 6993 | { |
6994 | LSL_Types.Vector3 pos = new LSL_Types.Vector3(presence.CameraPosition.x,presence.CameraPosition.y,presence.CameraPosition.z); | 6994 | LSL_Types.Vector3 pos = new LSL_Types.Vector3(presence.CameraPosition.x,presence.CameraPosition.y,presence.CameraPosition.z); |
6995 | return pos; | 6995 | return pos; |
@@ -7111,8 +7111,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7111 | public void llSetCameraParams(LSL_Types.list rules) | 7111 | public void llSetCameraParams(LSL_Types.list rules) |
7112 | { | 7112 | { |
7113 | m_host.AddScriptLPS(1); | 7113 | m_host.AddScriptLPS(1); |
7114 | 7114 | ||
7115 | // our key in the object we are in | 7115 | // our key in the object we are in |
7116 | LLUUID invItemID=InventorySelf(); | 7116 | LLUUID invItemID=InventorySelf(); |
7117 | if (invItemID == LLUUID.Zero) return; | 7117 | if (invItemID == LLUUID.Zero) return; |
7118 | 7118 | ||
@@ -7126,10 +7126,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7126 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 7126 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; |
7127 | 7127 | ||
7128 | ScenePresence presence = World.GetScenePresence(agentID); | 7128 | ScenePresence presence = World.GetScenePresence(agentID); |
7129 | 7129 | ||
7130 | // we are not interested in child-agents | 7130 | // we are not interested in child-agents |
7131 | if (presence.IsChildAgent) return; | 7131 | if (presence.IsChildAgent) return; |
7132 | 7132 | ||
7133 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); | 7133 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); |
7134 | object[] data = rules.Data; | 7134 | object[] data = rules.Data; |
7135 | for (int i = 0; i < data.Length; ++i) { | 7135 | for (int i = 0; i < data.Length; ++i) { |
@@ -7142,8 +7142,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7142 | case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET: | 7142 | case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET: |
7143 | case BuiltIn_Commands_BaseClass.CAMERA_POSITION: | 7143 | case BuiltIn_Commands_BaseClass.CAMERA_POSITION: |
7144 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; | 7144 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; |
7145 | parameters.Add(type + 1, (float)v.x); | 7145 | parameters.Add(type + 1, (float)v.x); |
7146 | parameters.Add(type + 2, (float)v.y); | 7146 | parameters.Add(type + 2, (float)v.y); |
7147 | parameters.Add(type + 3, (float)v.z); | 7147 | parameters.Add(type + 3, (float)v.z); |
7148 | break; | 7148 | break; |
7149 | default: | 7149 | default: |
@@ -7163,7 +7163,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7163 | { | 7163 | { |
7164 | m_host.AddScriptLPS(1); | 7164 | m_host.AddScriptLPS(1); |
7165 | 7165 | ||
7166 | // our key in the object we are in | 7166 | // our key in the object we are in |
7167 | LLUUID invItemID=InventorySelf(); | 7167 | LLUUID invItemID=InventorySelf(); |
7168 | if (invItemID == LLUUID.Zero) return; | 7168 | if (invItemID == LLUUID.Zero) return; |
7169 | 7169 | ||
@@ -7177,10 +7177,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7177 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 7177 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; |
7178 | 7178 | ||
7179 | ScenePresence presence = World.GetScenePresence(agentID); | 7179 | ScenePresence presence = World.GetScenePresence(agentID); |
7180 | 7180 | ||
7181 | // we are not interested in child-agents | 7181 | // we are not interested in child-agents |
7182 | if (presence.IsChildAgent) return; | 7182 | if (presence.IsChildAgent) return; |
7183 | 7183 | ||
7184 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 7184 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
7185 | } | 7185 | } |
7186 | 7186 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index e98dec6..3b317ac 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -703,7 +703,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
703 | // Otherwise, if we have strings, compare them alphabetically. | 703 | // Otherwise, if we have strings, compare them alphabetically. |
704 | string str1 = new string(space1); | 704 | string str1 = new string(space1); |
705 | string str2 = new string(space2); | 705 | string str2 = new string(space2); |
706 | 706 | ||
707 | int result; | 707 | int result; |
708 | 708 | ||
709 | if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) | 709 | if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) |
@@ -1427,22 +1427,22 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1427 | bool ret = i1.value != i2.value; | 1427 | bool ret = i1.value != i2.value; |
1428 | return ret; | 1428 | return ret; |
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | static public LSLInteger operator +(LSLInteger i1, int i2) | 1431 | static public LSLInteger operator +(LSLInteger i1, int i2) |
1432 | { | 1432 | { |
1433 | return new LSLInteger(i1.value + i2); | 1433 | return new LSLInteger(i1.value + i2); |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | static public LSLInteger operator -(LSLInteger i1, int i2) | 1436 | static public LSLInteger operator -(LSLInteger i1, int i2) |
1437 | { | 1437 | { |
1438 | return new LSLInteger(i1.value - i2); | 1438 | return new LSLInteger(i1.value - i2); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | static public LSLInteger operator *(LSLInteger i1, int i2) | 1441 | static public LSLInteger operator *(LSLInteger i1, int i2) |
1442 | { | 1442 | { |
1443 | return new LSLInteger(i1.value * i2); | 1443 | return new LSLInteger(i1.value * i2); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | static public LSLInteger operator /(LSLInteger i1, int i2) | 1446 | static public LSLInteger operator /(LSLInteger i1, int i2) |
1447 | { | 1447 | { |
1448 | return new LSLInteger(i1.value / i2); | 1448 | return new LSLInteger(i1.value / i2); |
@@ -1452,22 +1452,22 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1452 | { | 1452 | { |
1453 | return new LSLFloat((double)i1.value + f); | 1453 | return new LSLFloat((double)i1.value + f); |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | static public LSLFloat operator -(LSLInteger i1, double f) | 1456 | static public LSLFloat operator -(LSLInteger i1, double f) |
1457 | { | 1457 | { |
1458 | return new LSLFloat((double)i1.value - f); | 1458 | return new LSLFloat((double)i1.value - f); |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | static public LSLFloat operator *(LSLInteger i1, double f) | 1461 | static public LSLFloat operator *(LSLInteger i1, double f) |
1462 | { | 1462 | { |
1463 | return new LSLFloat((double)i1.value * f); | 1463 | return new LSLFloat((double)i1.value * f); |
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | static public LSLFloat operator /(LSLInteger i1, double f) | 1466 | static public LSLFloat operator /(LSLInteger i1, double f) |
1467 | { | 1467 | { |
1468 | return new LSLFloat((double)i1.value / f); | 1468 | return new LSLFloat((double)i1.value / f); |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | static public LSLInteger operator -(LSLInteger i) | 1471 | static public LSLInteger operator -(LSLInteger i) |
1472 | { | 1472 | { |
1473 | return new LSLInteger(-i.value); | 1473 | return new LSLInteger(-i.value); |
@@ -1623,17 +1623,17 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1623 | f.value--; | 1623 | f.value--; |
1624 | return f; | 1624 | return f; |
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | static public LSLFloat operator +(LSLFloat f, int i) | 1627 | static public LSLFloat operator +(LSLFloat f, int i) |
1628 | { | 1628 | { |
1629 | return new LSLFloat(f.value + (double)i); | 1629 | return new LSLFloat(f.value + (double)i); |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | static public LSLFloat operator -(LSLFloat f, int i) | 1632 | static public LSLFloat operator -(LSLFloat f, int i) |
1633 | { | 1633 | { |
1634 | return new LSLFloat(f.value - (double)i); | 1634 | return new LSLFloat(f.value - (double)i); |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | static public LSLFloat operator *(LSLFloat f, int i) | 1637 | static public LSLFloat operator *(LSLFloat f, int i) |
1638 | { | 1638 | { |
1639 | return new LSLFloat(f.value * (double)i); | 1639 | return new LSLFloat(f.value * (double)i); |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs index 5f86c9c..77cc7ea 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin | |||
88 | { | 88 | { |
89 | if (!DataserverRequests.ContainsKey(identifier)) | 89 | if (!DataserverRequests.ContainsKey(identifier)) |
90 | return; | 90 | return; |
91 | 91 | ||
92 | ds=DataserverRequests[identifier]; | 92 | ds=DataserverRequests[identifier]; |
93 | DataserverRequests.Remove(identifier); | 93 | DataserverRequests.Remove(identifier); |
94 | } | 94 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 79c1dde..5c57874 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
126 | /// Queue containing events waiting to be executed | 126 | /// Queue containing events waiting to be executed |
127 | /// </summary> | 127 | /// </summary> |
128 | public Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); | 128 | public Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); |
129 | 129 | ||
130 | #region " Queue structures " | 130 | #region " Queue structures " |
131 | /// <summary> | 131 | /// <summary> |
132 | /// Queue item structure | 132 | /// Queue item structure |
@@ -193,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
193 | } | 193 | } |
194 | 194 | ||
195 | #endregion | 195 | #endregion |
196 | 196 | ||
197 | #region " Shutdown all threads " | 197 | #region " Shutdown all threads " |
198 | ~EventQueueManager() | 198 | ~EventQueueManager() |
199 | { | 199 | { |
@@ -408,10 +408,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
408 | 408 | ||
409 | // Set flag if script should be removed or not | 409 | // Set flag if script should be removed or not |
410 | EventQueueThread.KillCurrentScript = KillScriptOnMaxFunctionExecutionTime; | 410 | EventQueueThread.KillCurrentScript = KillScriptOnMaxFunctionExecutionTime; |
411 | 411 | ||
412 | // Abort this thread | 412 | // Abort this thread |
413 | AbortThreadClass(EventQueueThread); | 413 | AbortThreadClass(EventQueueThread); |
414 | 414 | ||
415 | // We do not need to start another, MaintenenceThread will do that for us | 415 | // We do not need to start another, MaintenenceThread will do that for us |
416 | //StartNewThreadClass(); | 416 | //StartNewThreadClass(); |
417 | } | 417 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index 255ab99..4376e00 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
44 | public class EventQueueThreadClass : iScriptEngineFunctionModule | 44 | public class EventQueueThreadClass : iScriptEngineFunctionModule |
45 | { | 45 | { |
46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// How many ms to sleep if queue is empty | 49 | /// How many ms to sleep if queue is empty |
50 | /// </summary> | 50 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index f04ac01..9a465f6 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
73 | void remote_data(uint localID, LLUUID itemID); | 73 | void remote_data(uint localID, LLUUID itemID); |
74 | void http_response(uint localID, LLUUID itemID); | 74 | void http_response(uint localID, LLUUID itemID); |
75 | } | 75 | } |
76 | 76 | ||
77 | public interface ServerRemotingObject | 77 | public interface ServerRemotingObject |
78 | { | 78 | { |
79 | RemoteEvents Events(); | 79 | RemoteEvents Events(); |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 06c7387..fa3e35b 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -355,8 +355,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
355 | 355 | ||
356 | private static string CreateYPCompilerScript(string compileScript) | 356 | private static string CreateYPCompilerScript(string compileScript) |
357 | { | 357 | { |
358 | |||
359 | |||
360 | compileScript = String.Empty + | 358 | compileScript = String.Empty + |
361 | "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " + | 359 | "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " + |
362 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + | 360 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs index 3f7b95e..8618d6c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/YP2CSConverter.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
61 | myCode = myCode.Substring(0, cs_pointer); | 61 | myCode = myCode.Substring(0, cs_pointer); |
62 | } | 62 | } |
63 | myCode.Replace("//yp", "%YPCode"); | 63 | myCode.Replace("//yp", "%YPCode"); |
64 | 64 | ||
65 | StringWriter myCS_SW = new StringWriter(); | 65 | StringWriter myCS_SW = new StringWriter(); |
66 | StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n"); | 66 | StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n"); |
67 | 67 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs index 999208d..415c646 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
54 | { | 54 | { |
55 | _arity = arity; | 55 | _arity = arity; |
56 | } | 56 | } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Append the answer to the list and update the indexes, if any. | 59 | /// Append the answer to the list and update the indexes, if any. |
60 | /// Elements of answer must be ground, since arguments with unbound variables make this | 60 | /// Elements of answer must be ground, since arguments with unbound variables make this |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs index 9a1f00d..56ed719 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2008, Jeff Thompson | 2 | * Copyright (C) 2007-2008, Jeff Thompson |
3 | * | 3 | * |
4 | * All rights reserved. | 4 | * All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions are met: | 7 | * modification, are permitted provided that the following conditions are met: |
8 | * | 8 | * |
9 | * * Redistributions of source code must retain the above copyright | 9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * * Redistributions in binary form must reproduce the above copyright | 11 | * * Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. |
14 | * * Neither the name of the copyright holder nor the names of its contributors | 14 | * * Neither the name of the copyright holder nor the names of its contributors |
15 | * may be used to endorse or promote products derived from this software | 15 | * may be used to endorse or promote products derived from this software |
16 | * without specific prior written permission. | 16 | * without specific prior written permission. |
17 | * | 17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
54 | /// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding. | 54 | /// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding. |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="ErrorTerm">the error term of the error</param> | 56 | /// <param name="ErrorTerm">the error term of the error</param> |
57 | /// <param name="Messsage">the message term of the error. If this is a string, it is converted to an | 57 | /// <param name="Messsage">the message term of the error. If this is a string, it is converted to an |
58 | /// Atom so it can be used by Prolog code. | 58 | /// Atom so it can be used by Prolog code. |
59 | /// Message, converted to a string, is use as the printable exception message. | 59 | /// Message, converted to a string, is use as the printable exception message. |
60 | /// </param> | 60 | /// </param> |
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
66 | _term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore()); | 66 | _term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore()); |
67 | } | 67 | } |
68 | 68 | ||
69 | public class TypeErrorInfo | 69 | public class TypeErrorInfo |
70 | { | 70 | { |
71 | public readonly Atom _Type; | 71 | public readonly Atom _Type; |
72 | public readonly object _Culprit; | 72 | public readonly object _Culprit; |
@@ -116,14 +116,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
116 | /// <returns></returns> | 116 | /// <returns></returns> |
117 | public object getProcedureName() | 117 | public object getProcedureName() |
118 | { | 118 | { |
119 | if (!(_Type._name == "procedure" && | 119 | if (!(_Type._name == "procedure" && |
120 | _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH)) | 120 | _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH)) |
121 | return null; | 121 | return null; |
122 | return ((Functor2)_Culprit)._arg1; | 122 | return ((Functor2)_Culprit)._arg1; |
123 | } | 123 | } |
124 | 124 | ||
125 | /// <summary> | 125 | /// <summary> |
126 | /// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity. | 126 | /// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity. |
127 | /// Otherwise return -1. | 127 | /// Otherwise return -1. |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <returns></returns> | 129 | /// <returns></returns> |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs index b69f9c4..694e733 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2008, Jeff Thompson | 2 | * Copyright (C) 2007-2008, Jeff Thompson |
3 | * | 3 | * |
4 | * All rights reserved. | 4 | * All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions are met: | 7 | * modification, are permitted provided that the following conditions are met: |
8 | * | 8 | * |
9 | * * Redistributions of source code must retain the above copyright | 9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * * Redistributions in binary form must reproduce the above copyright | 11 | * * Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. |
14 | * * Neither the name of the copyright holder nor the names of its contributors | 14 | * * Neither the name of the copyright holder nor the names of its contributors |
15 | * may be used to endorse or promote products derived from this software | 15 | * may be used to endorse or promote products derived from this software |
16 | * without specific prior written permission. | 16 | * without specific prior written permission. |
17 | * | 17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Convert term to an int. | 148 | /// Convert term to an int. |
149 | /// If term is a single-element List, use its first element | 149 | /// If term is a single-element List, use its first element |
150 | /// (to handle the char types like "a"). | 150 | /// (to handle the char types like "a"). |
151 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only | 151 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only |
152 | /// called from arithmetic functions). | 152 | /// called from arithmetic functions). |
153 | /// </summary> | 153 | /// </summary> |
@@ -172,8 +172,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
172 | { | 172 | { |
173 | throw new PrologException | 173 | throw new PrologException |
174 | (new Functor2 | 174 | (new Functor2 |
175 | ("type_error", Atom.a("evaluable"), | 175 | ("type_error", Atom.a("evaluable"), |
176 | new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)), | 176 | new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)), |
177 | "Term must be an integer"); | 177 | "Term must be an integer"); |
178 | } | 178 | } |
179 | } | 179 | } |
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Convert term to a double. This may convert an int to a double, etc. | 182 | /// Convert term to a double. This may convert an int to a double, etc. |
183 | /// If term is a single-element List, use its first element | 183 | /// If term is a single-element List, use its first element |
184 | /// (to handle the char types like "a"). | 184 | /// (to handle the char types like "a"). |
185 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only | 185 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only |
186 | /// called from arithmetic functions). | 186 | /// called from arithmetic functions). |
187 | /// </summary> | 187 | /// </summary> |
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
195 | // Assume it is a char type like "a". | 195 | // Assume it is a char type like "a". |
196 | term = YP.getValue(((Functor2)term)._arg1); | 196 | term = YP.getValue(((Functor2)term)._arg1); |
197 | if (term is Variable) | 197 | if (term is Variable) |
198 | throw new PrologException(Atom.a("instantiation_error"), | 198 | throw new PrologException(Atom.a("instantiation_error"), |
199 | "Expected a number but the argument is an unbound variable"); | 199 | "Expected a number but the argument is an unbound variable"); |
200 | 200 | ||
201 | try | 201 | try |
@@ -776,8 +776,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
776 | if (term1TypeCode == -2) | 776 | if (term1TypeCode == -2) |
777 | { | 777 | { |
778 | // Variable. | 778 | // Variable. |
779 | // We always check for equality first because we want to be sure | 779 | // We always check for equality first because we want to be sure |
780 | // that less than returns false if the terms are equal, in | 780 | // that less than returns false if the terms are equal, in |
781 | // case that the less than check really behaves like less than or equal. | 781 | // case that the less than check really behaves like less than or equal. |
782 | if ((Variable)Term1 != (Variable)Term2) | 782 | if ((Variable)Term1 != (Variable)Term2) |
783 | // The hash code should be unique to a Variable object. | 783 | // The hash code should be unique to a Variable object. |
@@ -820,8 +820,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
820 | } | 820 | } |
821 | 821 | ||
822 | /// <summary> | 822 | /// <summary> |
823 | /// Type code is -2 if term is a Variable, 0 if it is an Atom, | 823 | /// Type code is -2 if term is a Variable, 0 if it is an Atom, |
824 | /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3, | 824 | /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3, |
825 | /// 4 if it is Functor. | 825 | /// 4 if it is Functor. |
826 | /// Otherwise, type code is -1. | 826 | /// Otherwise, type code is -1. |
827 | /// This does not call YP.getValue(term). | 827 | /// This does not call YP.getValue(term). |
@@ -1167,7 +1167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1167 | "Arg 2 List has an element which is an unbound variable"); | 1167 | "Arg 2 List has an element which is an unbound variable"); |
1168 | if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1)) | 1168 | if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1)) |
1169 | throw new PrologException | 1169 | throw new PrologException |
1170 | (new Functor2("type_error", Atom.a("character"), listAtom), | 1170 | (new Functor2("type_error", Atom.a("character"), listAtom), |
1171 | "Arg 2 List has an element which is not a one character atom"); | 1171 | "Arg 2 List has an element which is not a one character atom"); |
1172 | charArray[i] = ((Atom)listAtom)._name[0]; | 1172 | charArray[i] = ((Atom)listAtom)._name[0]; |
1173 | } | 1173 | } |
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1209 | int codeInt; | 1209 | int codeInt; |
1210 | if (!getInt(codeArray[i], out codeInt) || codeInt < 0) | 1210 | if (!getInt(codeArray[i], out codeInt) || codeInt < 0) |
1211 | throw new PrologException | 1211 | throw new PrologException |
1212 | (new Functor1("representation_error", Atom.a("character_code")), | 1212 | (new Functor1("representation_error", Atom.a("character_code")), |
1213 | "Element of Arg 2 List is not a character code"); | 1213 | "Element of Arg 2 List is not a character code"); |
1214 | charArray[i] = (char)codeInt; | 1214 | charArray[i] = (char)codeInt; |
1215 | } | 1215 | } |
@@ -1323,7 +1323,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1323 | { | 1323 | { |
1324 | if (!YP.number(Number)) | 1324 | if (!YP.number(Number)) |
1325 | throw new PrologException | 1325 | throw new PrologException |
1326 | (new Functor2("type_error", Atom.a("number"), Number), | 1326 | (new Functor2("type_error", Atom.a("number"), Number), |
1327 | "Arg 1 Number is not var or number"); | 1327 | "Arg 1 Number is not var or number"); |
1328 | // We just checked, so convertDouble shouldn't throw an exception. | 1328 | // We just checked, so convertDouble shouldn't throw an exception. |
1329 | numberString = YP.doubleToString(YP.convertDouble(Number)); | 1329 | numberString = YP.doubleToString(YP.convertDouble(Number)); |
@@ -1413,7 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1413 | { | 1413 | { |
1414 | if (!(Char is Atom) || ((Atom)Char)._name.Length != 1) | 1414 | if (!(Char is Atom) || ((Atom)Char)._name.Length != 1) |
1415 | throw new PrologException | 1415 | throw new PrologException |
1416 | (new Functor2("type_error", Atom.a("character"), Char), | 1416 | (new Functor2("type_error", Atom.a("character"), Char), |
1417 | "Arg 1 Char is not var or one-character atom"); | 1417 | "Arg 1 Char is not var or one-character atom"); |
1418 | 1418 | ||
1419 | if (Code is Variable) | 1419 | if (Code is Variable) |
@@ -1795,7 +1795,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1795 | IndexedAnswers indexedAnswers; | 1795 | IndexedAnswers indexedAnswers; |
1796 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) | 1796 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) |
1797 | { | 1797 | { |
1798 | // Create an IndexedAnswers as the only clause of the predicate. | 1798 | // Create an IndexedAnswers as the only clause of the predicate. |
1799 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); | 1799 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); |
1800 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); | 1800 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); |
1801 | } | 1801 | } |
@@ -1826,7 +1826,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1826 | IndexedAnswers indexedAnswers; | 1826 | IndexedAnswers indexedAnswers; |
1827 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) | 1827 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) |
1828 | { | 1828 | { |
1829 | // Create an IndexedAnswers as the only clause of the predicate. | 1829 | // Create an IndexedAnswers as the only clause of the predicate. |
1830 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); | 1830 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); |
1831 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); | 1831 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); |
1832 | } | 1832 | } |
@@ -1855,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1855 | { | 1855 | { |
1856 | List<IClause> clauses; | 1856 | List<IClause> clauses; |
1857 | if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses)) | 1857 | if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses)) |
1858 | return unknownPredicate(name, arguments.Length, | 1858 | return unknownPredicate(name, arguments.Length, |
1859 | "Undefined dynamic predicate: " + name + "/" + arguments.Length); | 1859 | "Undefined dynamic predicate: " + name + "/" + arguments.Length); |
1860 | 1860 | ||
1861 | if (clauses.Count == 1) | 1861 | if (clauses.Count == 1) |
@@ -1889,7 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | /// <summary> | 1891 | /// <summary> |
1892 | /// If _prologFlags["unknown"] is fail then return fail(), else if | 1892 | /// If _prologFlags["unknown"] is fail then return fail(), else if |
1893 | /// _prologFlags["unknown"] is warning then write the message to YP.write and | 1893 | /// _prologFlags["unknown"] is warning then write the message to YP.write and |
1894 | /// return fail(), else throw a PrologException for existence_error. . | 1894 | /// return fail(), else throw a PrologException for existence_error. . |
1895 | /// </summary> | 1895 | /// </summary> |
@@ -1917,7 +1917,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | /// <summary> | 1919 | /// <summary> |
1920 | /// This is deprecated and just calls matchDynamic. This matches all clauses, | 1920 | /// This is deprecated and just calls matchDynamic. This matches all clauses, |
1921 | /// not just the ones defined with assertFact. | 1921 | /// not just the ones defined with assertFact. |
1922 | /// </summary> | 1922 | /// </summary> |
1923 | /// <param name="name"></param> | 1923 | /// <param name="name"></param> |
@@ -2066,7 +2066,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2066 | /// dynamic predicate. | 2066 | /// dynamic predicate. |
2067 | /// </summary> | 2067 | /// </summary> |
2068 | /// <param name="NameSlashArity"></param> | 2068 | /// <param name="NameSlashArity"></param> |
2069 | /// <param name="declaringClass">if not null, used to resolve references to the default | 2069 | /// <param name="declaringClass">if not null, used to resolve references to the default |
2070 | /// module Atom.a("")</param> | 2070 | /// module Atom.a("")</param> |
2071 | /// <returns></returns> | 2071 | /// <returns></returns> |
2072 | public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass) | 2072 | public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass) |
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2078 | Functor2 NameArityFunctor = NameSlashArity as Functor2; | 2078 | Functor2 NameArityFunctor = NameSlashArity as Functor2; |
2079 | if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH)) | 2079 | if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH)) |
2080 | throw new PrologException | 2080 | throw new PrologException |
2081 | (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity), | 2081 | (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity), |
2082 | "Must be a name/arity predicate indicator"); | 2082 | "Must be a name/arity predicate indicator"); |
2083 | object name = YP.getValue(NameArityFunctor._arg1); | 2083 | object name = YP.getValue(NameArityFunctor._arg1); |
2084 | object arity = YP.getValue(NameArityFunctor._arg2); | 2084 | object arity = YP.getValue(NameArityFunctor._arg2); |
@@ -2163,12 +2163,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | /// <summary> | 2165 | /// <summary> |
2166 | /// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from | 2166 | /// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from |
2167 | /// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error. | 2167 | /// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error. |
2168 | /// Otherwise, compile the goal as a single clause predicate and invoke it. | 2168 | /// Otherwise, compile the goal as a single clause predicate and invoke it. |
2169 | /// </summary> | 2169 | /// </summary> |
2170 | /// <param name="Goal"></param> | 2170 | /// <param name="Goal"></param> |
2171 | /// <param name="declaringClass">if not null, used to resolve references to the default | 2171 | /// <param name="declaringClass">if not null, used to resolve references to the default |
2172 | /// module Atom.a("")</param> | 2172 | /// module Atom.a("")</param> |
2173 | /// <returns></returns> | 2173 | /// <returns></returns> |
2174 | public static IEnumerable<bool> getIterator(object Goal, Type declaringClass) | 2174 | public static IEnumerable<bool> getIterator(object Goal, Type declaringClass) |
@@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2259 | (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom"); | 2259 | (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom"); |
2260 | if (!_prologFlags.ContainsKey(((Atom)Key)._name)) | 2260 | if (!_prologFlags.ContainsKey(((Atom)Key)._name)) |
2261 | throw new PrologException | 2261 | throw new PrologException |
2262 | (new Functor2("domain_error", Atom.a("prolog_flag"), Key), | 2262 | (new Functor2("domain_error", Atom.a("prolog_flag"), Key), |
2263 | "Arg 1 Key is not a recognized flag"); | 2263 | "Arg 1 Key is not a recognized flag"); |
2264 | 2264 | ||
2265 | foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name])) | 2265 | foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name])) |
@@ -2343,7 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2343 | string results = ""; | 2343 | string results = ""; |
2344 | for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch()) | 2344 | for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch()) |
2345 | { | 2345 | { |
2346 | //Console.WriteLine( m ); | 2346 | //Console.WriteLine( m ); |
2347 | results += presep+ m + postsep; | 2347 | results += presep+ m + postsep; |
2348 | } | 2348 | } |
2349 | return results; | 2349 | return results; |
@@ -2662,7 +2662,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2662 | #pragma warning restore 0168 | 2662 | #pragma warning restore 0168 |
2663 | } | 2663 | } |
2664 | } | 2664 | } |
2665 | 2665 | ||
2666 | /// <summary> | 2666 | /// <summary> |
2667 | /// CodeListReader extends TextReader and overrides Read to read the next code from | 2667 | /// CodeListReader extends TextReader and overrides Read to read the next code from |
2668 | /// the CodeList which is a Prolog list of integer character codes. | 2668 | /// the CodeList which is a Prolog list of integer character codes. |
@@ -2683,7 +2683,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog | |||
2683 | /// <returns></returns> | 2683 | /// <returns></returns> |
2684 | public override int Read() | 2684 | public override int Read() |
2685 | { | 2685 | { |
2686 | Functor2 CodeListPair = _CodeList as Functor2; | 2686 | Functor2 CodeListPair = _CodeList as Functor2; |
2687 | int code; | 2687 | int code; |
2688 | if (!(CodeListPair != null && CodeListPair._name == Atom.DOT && | 2688 | if (!(CodeListPair != null && CodeListPair._name == Atom.DOT && |
2689 | getInt(CodeListPair._arg1, out code))) | 2689 | getInt(CodeListPair._arg1, out code))) |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 42d9bf8..c94b56a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -39,13 +39,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
39 | public class ScriptManager : Common.ScriptEngineBase.ScriptManager | 39 | public class ScriptManager : Common.ScriptEngineBase.ScriptManager |
40 | { | 40 | { |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine) | 43 | public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine) |
44 | : base(scriptEngine) | 44 | : base(scriptEngine) |
45 | { | 45 | { |
46 | base.m_scriptEngine = scriptEngine; | 46 | base.m_scriptEngine = scriptEngine; |
47 | } | 47 | } |
48 | private Compiler.LSL.Compiler LSLCompiler; | 48 | private Compiler.LSL.Compiler LSLCompiler; |
49 | 49 | ||
50 | public override void Initialize() | 50 | public override void Initialize() |
51 | { | 51 | { |
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
63 | public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) | 63 | public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) |
64 | { | 64 | { |
65 | m_log.DebugFormat( | 65 | m_log.DebugFormat( |
66 | "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}", | 66 | "[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}", |
67 | m_scriptEngine.ScriptEngineName, localID, itemID); | 67 | m_scriptEngine.ScriptEngineName, localID, itemID); |
68 | 68 | ||
69 | //IScriptHost root = host.GetRoot(); | 69 | //IScriptHost root = host.GetRoot(); |
@@ -73,13 +73,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
73 | string CompiledScriptFile = String.Empty; | 73 | string CompiledScriptFile = String.Empty; |
74 | 74 | ||
75 | SceneObjectPart m_host = World.GetSceneObjectPart(localID); | 75 | SceneObjectPart m_host = World.GetSceneObjectPart(localID); |
76 | 76 | ||
77 | if (null == m_host) | 77 | if (null == m_host) |
78 | { | 78 | { |
79 | m_log.ErrorFormat( | 79 | m_log.ErrorFormat( |
80 | "[{0}]: Could not find scene object part corresponding to localID {1} to start script", | 80 | "[{0}]: Could not find scene object part corresponding to localID {1} to start script", |
81 | m_scriptEngine.ScriptEngineName, localID); | 81 | m_scriptEngine.ScriptEngineName, localID); |
82 | 82 | ||
83 | return; | 83 | return; |
84 | } | 84 | } |
85 | 85 | ||
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs index 6924dd2..21888fa 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | |||
@@ -53,12 +53,12 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
53 | public EventManager(ScriptEngine _ScriptEngine) | 53 | public EventManager(ScriptEngine _ScriptEngine) |
54 | { | 54 | { |
55 | myScriptEngine = _ScriptEngine; | 55 | myScriptEngine = _ScriptEngine; |
56 | 56 | ||
57 | m_TCPClient = new TCPClient(); | 57 | m_TCPClient = new TCPClient(); |
58 | RPC = new TRPC_Remote(m_TCPClient); | 58 | RPC = new TRPC_Remote(m_TCPClient); |
59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); | 59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); |
60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); | 60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); |
61 | 61 | ||
62 | myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events"); | 62 | myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events"); |
63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9604828..4de207a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -348,23 +348,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
348 | a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting | 348 | a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting |
349 | vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. | 349 | vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. |
350 | */ | 350 | */ |
351 | 351 | ||
352 | /* How we arrived at this llEuler2Rot | 352 | /* How we arrived at this llEuler2Rot |
353 | * | 353 | * |
354 | * Experiment in SL to determine conventions: | 354 | * Experiment in SL to determine conventions: |
355 | * llEuler2Rot(<PI,0,0>)=<1,0,0,0> | 355 | * llEuler2Rot(<PI,0,0>)=<1,0,0,0> |
356 | * llEuler2Rot(<0,PI,0>)=<0,1,0,0> | 356 | * llEuler2Rot(<0,PI,0>)=<0,1,0,0> |
357 | * llEuler2Rot(<0,0,PI>)=<0,0,1,0> | 357 | * llEuler2Rot(<0,0,PI>)=<0,0,1,0> |
358 | * | 358 | * |
359 | * Important facts about Quaternions | 359 | * Important facts about Quaternions |
360 | * - multiplication is non-commutative (a*b != b*a) | 360 | * - multiplication is non-commutative (a*b != b*a) |
361 | * - http://en.wikipedia.org/wiki/Quaternion#Basis_multiplication | 361 | * - http://en.wikipedia.org/wiki/Quaternion#Basis_multiplication |
362 | * | 362 | * |
363 | * Above SL experiment gives (c1,c2,c3,s1,s2,s3 as defined in our llEuler2Rot): | 363 | * Above SL experiment gives (c1,c2,c3,s1,s2,s3 as defined in our llEuler2Rot): |
364 | * Qx = c1+i*s1 | 364 | * Qx = c1+i*s1 |
365 | * Qy = c2+j*s2; | 365 | * Qy = c2+j*s2; |
366 | * Qz = c3+k*s3; | 366 | * Qz = c3+k*s3; |
367 | * | 367 | * |
368 | * Rotations applied in order (from above) Z, Y, X | 368 | * Rotations applied in order (from above) Z, Y, X |
369 | * Q = (Qz * Qy) * Qx | 369 | * Q = (Qz * Qy) * Qx |
370 | * ((c1+i*s1)*(c2+j*s2))*(c3+k*s3) | 370 | * ((c1+i*s1)*(c2+j*s2))*(c3+k*s3) |
@@ -376,23 +376,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
376 | * y=j*(c1*s2*c3-s1*c2*s3) | 376 | * y=j*(c1*s2*c3-s1*c2*s3) |
377 | * z=k*(s1*s2*c3+c1*c2*s3) | 377 | * z=k*(s1*s2*c3+c1*c2*s3) |
378 | * s= c1*c2*c3-s1*s2*s3 | 378 | * s= c1*c2*c3-s1*s2*s3 |
379 | * | 379 | * |
380 | * This implementation agrees with the functions found here: | 380 | * This implementation agrees with the functions found here: |
381 | * http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions | 381 | * http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions |
382 | * And with the results in SL. | 382 | * And with the results in SL. |
383 | * | 383 | * |
384 | * It's also possible to calculate llEuler2Rot by direct multiplication of | 384 | * It's also possible to calculate llEuler2Rot by direct multiplication of |
385 | * the Qz, Qy, and Qx vectors (as above - and done in the "accurate" function | 385 | * the Qz, Qy, and Qx vectors (as above - and done in the "accurate" function |
386 | * from the wiki). | 386 | * from the wiki). |
387 | * Apparently in some cases this is better from a numerical precision perspective? | 387 | * Apparently in some cases this is better from a numerical precision perspective? |
388 | */ | 388 | */ |
389 | 389 | ||
390 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | 390 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) |
391 | { | 391 | { |
392 | m_host.AddScriptLPS(1); | 392 | m_host.AddScriptLPS(1); |
393 | 393 | ||
394 | double x,y,z,s; | 394 | double x,y,z,s; |
395 | 395 | ||
396 | double c1 = Math.Cos(v.x/2.0); | 396 | double c1 = Math.Cos(v.x/2.0); |
397 | double c2 = Math.Cos(v.y/2.0); | 397 | double c2 = Math.Cos(v.y/2.0); |
398 | double c3 = Math.Cos(v.z/2.0); | 398 | double c3 = Math.Cos(v.z/2.0); |
@@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
404 | y = c1*s2*c3-s1*c2*s3; | 404 | y = c1*s2*c3-s1*c2*s3; |
405 | z = s1*s2*c3+c1*c2*s3; | 405 | z = s1*s2*c3+c1*c2*s3; |
406 | s = c1*c2*c3-s1*s2*s3; | 406 | s = c1*c2*c3-s1*s2*s3; |
407 | 407 | ||
408 | return new LSL_Types.Quaternion(x, y, z, s); | 408 | return new LSL_Types.Quaternion(x, y, z, s); |
409 | } | 409 | } |
410 | 410 | ||
@@ -414,7 +414,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
414 | double x, y, z, s; | 414 | double x, y, z, s; |
415 | int f = 0; | 415 | int f = 0; |
416 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> | 416 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> |
417 | // Computing quaternion x,y,z,s values | 417 | // Computing quaternion x,y,z,s values |
418 | x = ((fwd.x - left.y - up.z + 1) / 4); | 418 | x = ((fwd.x - left.y - up.z + 1) / 4); |
419 | x *= x; | 419 | x *= x; |
420 | x = Math.Sqrt(Math.Sqrt(x)); | 420 | x = Math.Sqrt(Math.Sqrt(x)); |
@@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
428 | s *= s; | 428 | s *= s; |
429 | s = Math.Sqrt(Math.Sqrt(s)); | 429 | s = Math.Sqrt(Math.Sqrt(s)); |
430 | 430 | ||
431 | // Set f for signs detection | 431 | // Set f for signs detection |
432 | if (fwd.y + left.x >= 0) { f += 1; } | 432 | if (fwd.y + left.x >= 0) { f += 1; } |
433 | if (fwd.z + up.x >= 0) { f += 2; } | 433 | if (fwd.z + up.x >= 0) { f += 2; } |
434 | if (left.z - up.y >= 0) { f += 4; } | 434 | if (left.z - up.y >= 0) { f += 4; } |
@@ -1013,9 +1013,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1013 | return; | 1013 | return; |
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | public void SetGlow(SceneObjectPart part, int face, float glow) | 1017 | public void SetGlow(SceneObjectPart part, int face, float glow) |
1018 | { | 1018 | { |
1019 | LLObject.TextureEntry tex = part.Shape.Textures; | 1019 | LLObject.TextureEntry tex = part.Shape.Textures; |
1020 | if (face > -1) | 1020 | if (face > -1) |
1021 | { | 1021 | { |
@@ -1023,7 +1023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1023 | tex.FaceTextures[face].Glow = glow; | 1023 | tex.FaceTextures[face].Glow = glow; |
1024 | part.UpdateTexture(tex); | 1024 | part.UpdateTexture(tex); |
1025 | return; | 1025 | return; |
1026 | } | 1026 | } |
1027 | else if (face == -1) | 1027 | else if (face == -1) |
1028 | { | 1028 | { |
1029 | for (uint i = 0; i < 32; i++) | 1029 | for (uint i = 0; i < 32; i++) |
@@ -1038,15 +1038,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1038 | return; | 1038 | return; |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) | 1042 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) |
1043 | { | 1043 | { |
1044 | 1044 | ||
1045 | Shininess sval = new Shininess(); | 1045 | Shininess sval = new Shininess(); |
1046 | 1046 | ||
1047 | switch (shiny) | 1047 | switch (shiny) |
1048 | { | 1048 | { |
1049 | case 0: | 1049 | case 0: |
1050 | sval = Shininess.None; | 1050 | sval = Shininess.None; |
1051 | break; | 1051 | break; |
1052 | case 1: | 1052 | case 1: |
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1062 | sval = Shininess.None; | 1062 | sval = Shininess.None; |
1063 | break; | 1063 | break; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | LLObject.TextureEntry tex = part.Shape.Textures; | 1066 | LLObject.TextureEntry tex = part.Shape.Textures; |
1067 | if (face > -1) | 1067 | if (face > -1) |
1068 | { | 1068 | { |
@@ -1070,8 +1070,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1070 | tex.FaceTextures[face].Shiny = sval; | 1070 | tex.FaceTextures[face].Shiny = sval; |
1071 | tex.FaceTextures[face].Bump = bump; | 1071 | tex.FaceTextures[face].Bump = bump; |
1072 | part.UpdateTexture(tex); | 1072 | part.UpdateTexture(tex); |
1073 | return; | 1073 | return; |
1074 | } | 1074 | } |
1075 | else if (face == -1) | 1075 | else if (face == -1) |
1076 | { | 1076 | { |
1077 | for (uint i = 0; i < 32; i++) | 1077 | for (uint i = 0; i < 32; i++) |
@@ -1088,8 +1088,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1088 | return; | 1088 | return; |
1089 | } | 1089 | } |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | public void SetFullBright(SceneObjectPart part, int face, bool bright) | 1092 | public void SetFullBright(SceneObjectPart part, int face, bool bright) |
1093 | { | 1093 | { |
1094 | LLObject.TextureEntry tex = part.Shape.Textures; | 1094 | LLObject.TextureEntry tex = part.Shape.Textures; |
1095 | if (face > -1) | 1095 | if (face > -1) |
@@ -1106,14 +1106,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1106 | if (tex.FaceTextures[i] != null) | 1106 | if (tex.FaceTextures[i] != null) |
1107 | { | 1107 | { |
1108 | tex.FaceTextures[i].Fullbright = bright; | 1108 | tex.FaceTextures[i].Fullbright = bright; |
1109 | } | 1109 | } |
1110 | } | 1110 | } |
1111 | tex.DefaultTexture.Fullbright = bright; | 1111 | tex.DefaultTexture.Fullbright = bright; |
1112 | part.UpdateTexture(tex); | 1112 | part.UpdateTexture(tex); |
1113 | return; | 1113 | return; |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | public double llGetAlpha(int face) | 1117 | public double llGetAlpha(int face) |
1118 | { | 1118 | { |
1119 | m_host.AddScriptLPS(1); | 1119 | m_host.AddScriptLPS(1); |
@@ -1169,7 +1169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1169 | 1169 | ||
1170 | /// <summary> | 1170 | /// <summary> |
1171 | /// Set flexi parameters of a part. | 1171 | /// Set flexi parameters of a part. |
1172 | /// | 1172 | /// |
1173 | /// FIXME: Much of this code should probably be within the part itself. | 1173 | /// FIXME: Much of this code should probably be within the part itself. |
1174 | /// </summary> | 1174 | /// </summary> |
1175 | /// <param name="part"></param> | 1175 | /// <param name="part"></param> |
@@ -1179,7 +1179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1179 | /// <param name="friction"></param> | 1179 | /// <param name="friction"></param> |
1180 | /// <param name="wind"></param> | 1180 | /// <param name="wind"></param> |
1181 | /// <param name="tension"></param> | 1181 | /// <param name="tension"></param> |
1182 | /// <param name="Force"></param> | 1182 | /// <param name="Force"></param> |
1183 | private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, | 1183 | private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, |
1184 | float wind, float tension, LSL_Types.Vector3 Force) | 1184 | float wind, float tension, LSL_Types.Vector3 Force) |
1185 | { | 1185 | { |
@@ -1230,7 +1230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1230 | 1230 | ||
1231 | /// <summary> | 1231 | /// <summary> |
1232 | /// Set a light point on a part | 1232 | /// Set a light point on a part |
1233 | /// | 1233 | /// |
1234 | /// FIXME: Much of this code should probably be in SceneObjectGroup | 1234 | /// FIXME: Much of this code should probably be in SceneObjectGroup |
1235 | /// </summary> | 1235 | /// </summary> |
1236 | /// <param name="part"></param> | 1236 | /// <param name="part"></param> |
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1238 | /// <param name="color"></param> | 1238 | /// <param name="color"></param> |
1239 | /// <param name="intensity"></param> | 1239 | /// <param name="intensity"></param> |
1240 | /// <param name="radius"></param> | 1240 | /// <param name="radius"></param> |
1241 | /// <param name="falloff"></param> | 1241 | /// <param name="falloff"></param> |
1242 | private void SetPointLight(SceneObjectPart part, bool light, LSL_Types.Vector3 color, float intensity, float radius, float falloff) | 1242 | private void SetPointLight(SceneObjectPart part, bool light, LSL_Types.Vector3 color, float intensity, float radius, float falloff) |
1243 | { | 1243 | { |
1244 | if (part == null) | 1244 | if (part == null) |
@@ -2880,13 +2880,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2880 | bool found = false; | 2880 | bool found = false; |
2881 | LLUUID destId = LLUUID.Zero; | 2881 | LLUUID destId = LLUUID.Zero; |
2882 | LLUUID objId = LLUUID.Zero; | 2882 | LLUUID objId = LLUUID.Zero; |
2883 | 2883 | ||
2884 | if (!LLUUID.TryParse(destination, out destId)) | 2884 | if (!LLUUID.TryParse(destination, out destId)) |
2885 | { | 2885 | { |
2886 | llSay(0, "Could not parse key " + destination); | 2886 | llSay(0, "Could not parse key " + destination); |
2887 | return; | 2887 | return; |
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | // move the first object found with this inventory name | 2890 | // move the first object found with this inventory name |
2891 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 2891 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
2892 | { | 2892 | { |
@@ -4451,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4451 | private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues() | 4451 | private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues() |
4452 | { | 4452 | { |
4453 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(); | 4453 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(); |
4454 | 4454 | ||
4455 | // TODO find out about the other defaults and add them here | 4455 | // TODO find out about the other defaults and add them here |
4456 | ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | 4456 | ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); |
4457 | ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); | 4457 | ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f); |
@@ -4465,7 +4465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4465 | ps.PartMaxAge = 10.0f; | 4465 | ps.PartMaxAge = 10.0f; |
4466 | return ps; | 4466 | return ps; |
4467 | } | 4467 | } |
4468 | 4468 | ||
4469 | public void llParticleSystem(LSL_Types.list rules) | 4469 | public void llParticleSystem(LSL_Types.list rules) |
4470 | { | 4470 | { |
4471 | m_host.AddScriptLPS(1); | 4471 | m_host.AddScriptLPS(1); |
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4660 | itemList.Add(itemID); | 4660 | itemList.Add(itemID); |
4661 | } | 4661 | } |
4662 | } | 4662 | } |
4663 | 4663 | ||
4664 | if (itemList.Count == 0) | 4664 | if (itemList.Count == 0) |
4665 | return; | 4665 | return; |
4666 | 4666 | ||
@@ -4936,11 +4936,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4936 | m_host.AddScriptLPS(1); | 4936 | m_host.AddScriptLPS(1); |
4937 | return Util.Md5Hash(src + ":" + nonce.ToString()); | 4937 | return Util.Md5Hash(src + ":" + nonce.ToString()); |
4938 | } | 4938 | } |
4939 | 4939 | ||
4940 | private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) | 4940 | private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) |
4941 | { | 4941 | { |
4942 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 4942 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
4943 | 4943 | ||
4944 | if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && | 4944 | if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT && |
4945 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && | 4945 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE && |
4946 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE && | 4946 | holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE && |
@@ -4998,23 +4998,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4998 | } | 4998 | } |
4999 | shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); | 4999 | shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); |
5000 | shapeBlock.PathTwist = (sbyte)(200 * twist.y); | 5000 | shapeBlock.PathTwist = (sbyte)(200 * twist.y); |
5001 | 5001 | ||
5002 | shapeBlock.ObjectLocalID = m_host.LocalId; | 5002 | shapeBlock.ObjectLocalID = m_host.LocalId; |
5003 | 5003 | ||
5004 | // retain pathcurve | 5004 | // retain pathcurve |
5005 | shapeBlock.PathCurve = m_host.Shape.PathCurve; | 5005 | shapeBlock.PathCurve = m_host.Shape.PathCurve; |
5006 | 5006 | ||
5007 | return shapeBlock; | 5007 | return shapeBlock; |
5008 | } | 5008 | } |
5009 | 5009 | ||
5010 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) | 5010 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) |
5011 | { | 5011 | { |
5012 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5012 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5013 | 5013 | ||
5014 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5014 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5015 | 5015 | ||
5016 | shapeBlock.ProfileCurve += fudge; | 5016 | shapeBlock.ProfileCurve += fudge; |
5017 | 5017 | ||
5018 | if (taper_b.x < 0f) | 5018 | if (taper_b.x < 0f) |
5019 | { | 5019 | { |
5020 | taper_b.x = 0f; | 5020 | taper_b.x = 0f; |
@@ -5051,25 +5051,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5051 | } | 5051 | } |
5052 | shapeBlock.PathShearX = (byte)(100 * topshear.x); | 5052 | shapeBlock.PathShearX = (byte)(100 * topshear.x); |
5053 | shapeBlock.PathShearY = (byte)(100 * topshear.y); | 5053 | shapeBlock.PathShearY = (byte)(100 * topshear.y); |
5054 | 5054 | ||
5055 | m_host.UpdateShape(shapeBlock); | 5055 | m_host.UpdateShape(shapeBlock); |
5056 | } | 5056 | } |
5057 | 5057 | ||
5058 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) | 5058 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) |
5059 | { | 5059 | { |
5060 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5060 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5061 | 5061 | ||
5062 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5062 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5063 | 5063 | ||
5064 | // profile/path swapped for a sphere | 5064 | // profile/path swapped for a sphere |
5065 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 5065 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
5066 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; | 5066 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; |
5067 | 5067 | ||
5068 | shapeBlock.ProfileCurve += fudge; | 5068 | shapeBlock.ProfileCurve += fudge; |
5069 | 5069 | ||
5070 | shapeBlock.PathScaleX = 100; | 5070 | shapeBlock.PathScaleX = 100; |
5071 | shapeBlock.PathScaleY = 100; | 5071 | shapeBlock.PathScaleY = 100; |
5072 | 5072 | ||
5073 | if (dimple.x < 0f) | 5073 | if (dimple.x < 0f) |
5074 | { | 5074 | { |
5075 | dimple.x = 0f; | 5075 | dimple.x = 0f; |
@@ -5092,22 +5092,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5092 | } | 5092 | } |
5093 | shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); | 5093 | shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); |
5094 | shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); | 5094 | shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); |
5095 | 5095 | ||
5096 | m_host.UpdateShape(shapeBlock); | 5096 | m_host.UpdateShape(shapeBlock); |
5097 | } | 5097 | } |
5098 | 5098 | ||
5099 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) | 5099 | private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) |
5100 | { | 5100 | { |
5101 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 5101 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
5102 | 5102 | ||
5103 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); | 5103 | shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); |
5104 | 5104 | ||
5105 | shapeBlock.ProfileCurve += fudge; | 5105 | shapeBlock.ProfileCurve += fudge; |
5106 | 5106 | ||
5107 | // profile/path swapped for a torrus, tube, ring | 5107 | // profile/path swapped for a torrus, tube, ring |
5108 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; | 5108 | shapeBlock.PathBegin = shapeBlock.ProfileBegin; |
5109 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; | 5109 | shapeBlock.PathEnd = shapeBlock.ProfileEnd; |
5110 | 5110 | ||
5111 | if (holesize.x < 0.05f) | 5111 | if (holesize.x < 0.05f) |
5112 | { | 5112 | { |
5113 | holesize.x = 0.05f; | 5113 | holesize.x = 0.05f; |
@@ -5212,15 +5212,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5212 | skew = 0.95f; | 5212 | skew = 0.95f; |
5213 | } | 5213 | } |
5214 | shapeBlock.PathSkew = (sbyte)(100 * skew); | 5214 | shapeBlock.PathSkew = (sbyte)(100 * skew); |
5215 | 5215 | ||
5216 | m_host.UpdateShape(shapeBlock); | 5216 | m_host.UpdateShape(shapeBlock); |
5217 | } | 5217 | } |
5218 | 5218 | ||
5219 | private void SetPrimitiveShapeParams(string map, int type) | 5219 | private void SetPrimitiveShapeParams(string map, int type) |
5220 | { | 5220 | { |
5221 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 5221 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
5222 | LLUUID sculptId; | 5222 | LLUUID sculptId; |
5223 | 5223 | ||
5224 | if (!LLUUID.TryParse(map, out sculptId)) | 5224 | if (!LLUUID.TryParse(map, out sculptId)) |
5225 | { | 5225 | { |
5226 | llSay(0, "Could not parse key " + map); | 5226 | llSay(0, "Could not parse key " + map); |
@@ -5230,7 +5230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5230 | shapeBlock.ObjectLocalID = m_host.LocalId; | 5230 | shapeBlock.ObjectLocalID = m_host.LocalId; |
5231 | shapeBlock.PathScaleX = 100; | 5231 | shapeBlock.PathScaleX = 100; |
5232 | shapeBlock.PathScaleY = 150; | 5232 | shapeBlock.PathScaleY = 150; |
5233 | 5233 | ||
5234 | if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && | 5234 | if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && |
5235 | type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && | 5235 | type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && |
5236 | type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && | 5236 | type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && |
@@ -5239,7 +5239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5239 | // default | 5239 | // default |
5240 | type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; | 5240 | type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; |
5241 | } | 5241 | } |
5242 | 5242 | ||
5243 | // retain pathcurve | 5243 | // retain pathcurve |
5244 | shapeBlock.PathCurve = m_host.Shape.PathCurve; | 5244 | shapeBlock.PathCurve = m_host.Shape.PathCurve; |
5245 | 5245 | ||
@@ -5256,7 +5256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5256 | public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) | 5256 | public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) |
5257 | { | 5257 | { |
5258 | m_host.AddScriptLPS(1); | 5258 | m_host.AddScriptLPS(1); |
5259 | 5259 | ||
5260 | if (m_host.ParentGroup == null) | 5260 | if (m_host.ParentGroup == null) |
5261 | return; | 5261 | return; |
5262 | 5262 | ||
@@ -5302,13 +5302,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5302 | SetRot(part, q); | 5302 | SetRot(part, q); |
5303 | 5303 | ||
5304 | break; | 5304 | break; |
5305 | 5305 | ||
5306 | case (int)ScriptBaseClass.PRIM_TYPE: | 5306 | case (int)ScriptBaseClass.PRIM_TYPE: |
5307 | if (remain < 3) | 5307 | if (remain < 3) |
5308 | return; | 5308 | return; |
5309 | 5309 | ||
5310 | code = Convert.ToInt32(rules.Data[idx++]); | 5310 | code = Convert.ToInt32(rules.Data[idx++]); |
5311 | 5311 | ||
5312 | remain = rules.Length - idx; | 5312 | remain = rules.Length - idx; |
5313 | float hollow; | 5313 | float hollow; |
5314 | LSL_Types.Vector3 twist; | 5314 | LSL_Types.Vector3 twist; |
@@ -5319,9 +5319,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5319 | float skew; | 5319 | float skew; |
5320 | LSL_Types.Vector3 holesize; | 5320 | LSL_Types.Vector3 holesize; |
5321 | LSL_Types.Vector3 profilecut; | 5321 | LSL_Types.Vector3 profilecut; |
5322 | 5322 | ||
5323 | switch (code) | 5323 | switch (code) |
5324 | { | 5324 | { |
5325 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: | 5325 | case (int)ScriptBaseClass.PRIM_TYPE_BOX: |
5326 | if (remain < 6) | 5326 | if (remain < 6) |
5327 | return; | 5327 | return; |
@@ -5335,7 +5335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5335 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; | 5335 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; |
5336 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); | 5336 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); |
5337 | break; | 5337 | break; |
5338 | 5338 | ||
5339 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: | 5339 | case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: |
5340 | if (remain < 6) | 5340 | if (remain < 6) |
5341 | return; | 5341 | return; |
@@ -5350,12 +5350,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5350 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; | 5350 | m_host.Shape.PathCurve = (byte) Extrusion.Straight; |
5351 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); | 5351 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); |
5352 | break; | 5352 | break; |
5353 | 5353 | ||
5354 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: | 5354 | case (int)ScriptBaseClass.PRIM_TYPE_PRISM: |
5355 | if (remain < 6) | 5355 | if (remain < 6) |
5356 | return; | 5356 | return; |
5357 | 5357 | ||
5358 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5358 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5359 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5359 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5360 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5360 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5361 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5361 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5377,12 +5377,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5377 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5377 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5378 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); | 5378 | SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); |
5379 | break; | 5379 | break; |
5380 | 5380 | ||
5381 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: | 5381 | case (int)ScriptBaseClass.PRIM_TYPE_TORUS: |
5382 | if (remain < 11) | 5382 | if (remain < 11) |
5383 | return; | 5383 | return; |
5384 | 5384 | ||
5385 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5385 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5386 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5386 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5387 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5387 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5388 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5388 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5396,12 +5396,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5396 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5396 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5397 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); | 5397 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); |
5398 | break; | 5398 | break; |
5399 | 5399 | ||
5400 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: | 5400 | case (int)ScriptBaseClass.PRIM_TYPE_TUBE: |
5401 | if (remain < 11) | 5401 | if (remain < 11) |
5402 | return; | 5402 | return; |
5403 | 5403 | ||
5404 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5404 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5405 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5405 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5406 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5406 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5407 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5407 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5415,12 +5415,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5415 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5415 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5416 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); | 5416 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); |
5417 | break; | 5417 | break; |
5418 | 5418 | ||
5419 | case (int)ScriptBaseClass.PRIM_TYPE_RING: | 5419 | case (int)ScriptBaseClass.PRIM_TYPE_RING: |
5420 | if (remain < 11) | 5420 | if (remain < 11) |
5421 | return; | 5421 | return; |
5422 | 5422 | ||
5423 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape | 5423 | face = Convert.ToInt32(rules.Data[idx++]); // holeshape |
5424 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut | 5424 | v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut |
5425 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); | 5425 | hollow = (float)Convert.ToDouble(rules.Data[idx++]); |
5426 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); | 5426 | twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); |
@@ -5434,7 +5434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5434 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; | 5434 | m_host.Shape.PathCurve = (byte) Extrusion.Curve1; |
5435 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); | 5435 | SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); |
5436 | break; | 5436 | break; |
5437 | 5437 | ||
5438 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: | 5438 | case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: |
5439 | if (remain < 2) | 5439 | if (remain < 2) |
5440 | return; | 5440 | return; |
@@ -5445,7 +5445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5445 | SetPrimitiveShapeParams(map, face); | 5445 | SetPrimitiveShapeParams(map, face); |
5446 | break; | 5446 | break; |
5447 | } | 5447 | } |
5448 | 5448 | ||
5449 | break; | 5449 | break; |
5450 | 5450 | ||
5451 | case (int)ScriptBaseClass.PRIM_TEXTURE: | 5451 | case (int)ScriptBaseClass.PRIM_TEXTURE: |
@@ -5509,31 +5509,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5509 | return; | 5509 | return; |
5510 | face = Convert.ToInt32(rules.Data[idx++]); | 5510 | face = Convert.ToInt32(rules.Data[idx++]); |
5511 | float glow = (float)Convert.ToDouble(rules.Data[idx++]); | 5511 | float glow = (float)Convert.ToDouble(rules.Data[idx++]); |
5512 | 5512 | ||
5513 | SetGlow(part, face, glow); | 5513 | SetGlow(part, face, glow); |
5514 | 5514 | ||
5515 | break; | 5515 | break; |
5516 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 5516 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
5517 | if (remain < 3) | 5517 | if (remain < 3) |
5518 | return; | 5518 | return; |
5519 | face = Convert.ToInt32(rules.Data[idx++]); | 5519 | face = Convert.ToInt32(rules.Data[idx++]); |
5520 | int shiny = Convert.ToInt32(rules.Data[idx++]); | 5520 | int shiny = Convert.ToInt32(rules.Data[idx++]); |
5521 | Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); | 5521 | Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); |
5522 | 5522 | ||
5523 | SetShiny(part, face, shiny, bump); | 5523 | SetShiny(part, face, shiny, bump); |
5524 | 5524 | ||
5525 | break; | 5525 | break; |
5526 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 5526 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
5527 | if (remain < 2) | 5527 | if (remain < 2) |
5528 | return; | 5528 | return; |
5529 | face = Convert.ToInt32(rules.Data[idx++]); | 5529 | face = Convert.ToInt32(rules.Data[idx++]); |
5530 | string bv = rules.Data[idx++].ToString(); | 5530 | string bv = rules.Data[idx++].ToString(); |
5531 | bool st; | 5531 | bool st; |
5532 | if (bv.Equals("1")) | 5532 | if (bv.Equals("1")) |
5533 | st = true; | 5533 | st = true; |
5534 | else | 5534 | else |
5535 | st = false; | 5535 | st = false; |
5536 | 5536 | ||
5537 | SetFullBright(part, face , st); | 5537 | SetFullBright(part, face , st); |
5538 | break; | 5538 | break; |
5539 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 5539 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
@@ -5552,29 +5552,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5552 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 5552 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
5553 | if (remain < 1) | 5553 | if (remain < 1) |
5554 | return; | 5554 | return; |
5555 | 5555 | ||
5556 | string ph = rules.Data[idx++].ToString(); | 5556 | string ph = rules.Data[idx++].ToString(); |
5557 | bool phantom; | 5557 | bool phantom; |
5558 | 5558 | ||
5559 | if (ph.Equals("1")) | 5559 | if (ph.Equals("1")) |
5560 | phantom = true; | 5560 | phantom = true; |
5561 | else | 5561 | else |
5562 | phantom = false; | 5562 | phantom = false; |
5563 | 5563 | ||
5564 | part.ScriptSetPhantomStatus(phantom); | 5564 | part.ScriptSetPhantomStatus(phantom); |
5565 | part.ScheduleFullUpdate(); | 5565 | part.ScheduleFullUpdate(); |
5566 | break; | 5566 | break; |
5567 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 5567 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
5568 | if (remain < 1) | 5568 | if (remain < 1) |
5569 | return; | 5569 | return; |
5570 | string phy = rules.Data[idx++].ToString(); | 5570 | string phy = rules.Data[idx++].ToString(); |
5571 | bool physics; | 5571 | bool physics; |
5572 | 5572 | ||
5573 | if (phy.Equals("1")) | 5573 | if (phy.Equals("1")) |
5574 | physics = true; | 5574 | physics = true; |
5575 | else | 5575 | else |
5576 | physics = false; | 5576 | physics = false; |
5577 | 5577 | ||
5578 | m_host.ScriptSetPhysicsStatus(physics); | 5578 | m_host.ScriptSetPhysicsStatus(physics); |
5579 | part.ScheduleFullUpdate(); | 5579 | part.ScheduleFullUpdate(); |
5580 | break; | 5580 | break; |
@@ -5645,7 +5645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5645 | public LSL_Types.list llGetAnimationList( string id ) | 5645 | public LSL_Types.list llGetAnimationList( string id ) |
5646 | { | 5646 | { |
5647 | m_host.AddScriptLPS(1); | 5647 | m_host.AddScriptLPS(1); |
5648 | 5648 | ||
5649 | LSL_Types.list l = new LSL_Types.list(); | 5649 | LSL_Types.list l = new LSL_Types.list(); |
5650 | ScenePresence av = World.GetScenePresence(id); | 5650 | ScenePresence av = World.GetScenePresence(id); |
5651 | if (av == null) | 5651 | if (av == null) |
@@ -6758,7 +6758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6758 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) | 6758 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) |
6759 | m_host.AddScriptLPS(1); | 6759 | m_host.AddScriptLPS(1); |
6760 | for (int i = 0; i < commandList.Data.Length; i++) | 6760 | for (int i = 0; i < commandList.Data.Length; i++) |
6761 | { | 6761 | { |
6762 | switch ((ParcelMediaCommandEnum)commandList.Data[i]) | 6762 | switch ((ParcelMediaCommandEnum)commandList.Data[i]) |
6763 | { | 6763 | { |
6764 | case ParcelMediaCommandEnum.Play: | 6764 | case ParcelMediaCommandEnum.Play: |
@@ -6768,7 +6768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6768 | if (!agent.IsChildAgent) | 6768 | if (!agent.IsChildAgent) |
6769 | { | 6769 | { |
6770 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); | 6770 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); |
6771 | } | 6771 | } |
6772 | } | 6772 | } |
6773 | break; | 6773 | break; |
6774 | case ParcelMediaCommandEnum.Stop: | 6774 | case ParcelMediaCommandEnum.Stop: |
@@ -6799,7 +6799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6799 | { | 6799 | { |
6800 | //Set the new media URL only if the user is the owner of the land | 6800 | //Set the new media URL only if the user is the owner of the land |
6801 | osSetParcelMediaURL(commandList.Data[i + 1].ToString()); | 6801 | osSetParcelMediaURL(commandList.Data[i + 1].ToString()); |
6802 | 6802 | ||
6803 | List<ScenePresence> scenePresenceList = World.GetScenePresences(); | 6803 | List<ScenePresence> scenePresenceList = World.GetScenePresences(); |
6804 | LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6804 | LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6805 | //Send an update of the mediaURL to all the clients that are in the parcel | 6805 | //Send an update of the mediaURL to all the clients that are in the parcel |
@@ -6810,8 +6810,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6810 | //Send parcel media update to the client | 6810 | //Send parcel media update to the client |
6811 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1); | 6811 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1); |
6812 | } | 6812 | } |
6813 | } | 6813 | } |
6814 | 6814 | ||
6815 | } | 6815 | } |
6816 | i++; | 6816 | i++; |
6817 | } | 6817 | } |
@@ -6821,7 +6821,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6821 | NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString()); | 6821 | NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString()); |
6822 | break; | 6822 | break; |
6823 | }//end switch | 6823 | }//end switch |
6824 | 6824 | ||
6825 | } | 6825 | } |
6826 | 6826 | ||
6827 | 6827 | ||
@@ -6864,7 +6864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6864 | } | 6864 | } |
6865 | } | 6865 | } |
6866 | return list; | 6866 | return list; |
6867 | 6867 | ||
6868 | } | 6868 | } |
6869 | 6869 | ||
6870 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) | 6870 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) |
@@ -6908,7 +6908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6908 | { | 6908 | { |
6909 | m_host.AddScriptLPS(1); | 6909 | m_host.AddScriptLPS(1); |
6910 | LLUUID invItemID=InventorySelf(); | 6910 | LLUUID invItemID=InventorySelf(); |
6911 | if (invItemID == LLUUID.Zero) | 6911 | if (invItemID == LLUUID.Zero) |
6912 | return new LSL_Types.Vector3(); | 6912 | return new LSL_Types.Vector3(); |
6913 | if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) | 6913 | if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) |
6914 | return new LSL_Types.Vector3(); | 6914 | return new LSL_Types.Vector3(); |
@@ -7036,8 +7036,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7036 | public void llSetCameraParams(LSL_Types.list rules) | 7036 | public void llSetCameraParams(LSL_Types.list rules) |
7037 | { | 7037 | { |
7038 | m_host.AddScriptLPS(1); | 7038 | m_host.AddScriptLPS(1); |
7039 | 7039 | ||
7040 | // our key in the object we are in | 7040 | // our key in the object we are in |
7041 | LLUUID invItemID=InventorySelf(); | 7041 | LLUUID invItemID=InventorySelf(); |
7042 | if (invItemID == LLUUID.Zero) return; | 7042 | if (invItemID == LLUUID.Zero) return; |
7043 | 7043 | ||
@@ -7051,10 +7051,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7051 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 7051 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; |
7052 | 7052 | ||
7053 | ScenePresence presence = World.GetScenePresence(agentID); | 7053 | ScenePresence presence = World.GetScenePresence(agentID); |
7054 | 7054 | ||
7055 | // we are not interested in child-agents | 7055 | // we are not interested in child-agents |
7056 | if (presence.IsChildAgent) return; | 7056 | if (presence.IsChildAgent) return; |
7057 | 7057 | ||
7058 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); | 7058 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); |
7059 | object[] data = rules.Data; | 7059 | object[] data = rules.Data; |
7060 | for (int i = 0; i < data.Length; ++i) { | 7060 | for (int i = 0; i < data.Length; ++i) { |
@@ -7067,8 +7067,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7067 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | 7067 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: |
7068 | case ScriptBaseClass.CAMERA_POSITION: | 7068 | case ScriptBaseClass.CAMERA_POSITION: |
7069 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; | 7069 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; |
7070 | parameters.Add(type + 1, (float)v.x); | 7070 | parameters.Add(type + 1, (float)v.x); |
7071 | parameters.Add(type + 2, (float)v.y); | 7071 | parameters.Add(type + 2, (float)v.y); |
7072 | parameters.Add(type + 3, (float)v.z); | 7072 | parameters.Add(type + 3, (float)v.z); |
7073 | break; | 7073 | break; |
7074 | default: | 7074 | default: |
@@ -7088,7 +7088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7088 | { | 7088 | { |
7089 | m_host.AddScriptLPS(1); | 7089 | m_host.AddScriptLPS(1); |
7090 | 7090 | ||
7091 | // our key in the object we are in | 7091 | // our key in the object we are in |
7092 | LLUUID invItemID=InventorySelf(); | 7092 | LLUUID invItemID=InventorySelf(); |
7093 | if (invItemID == LLUUID.Zero) return; | 7093 | if (invItemID == LLUUID.Zero) return; |
7094 | 7094 | ||
@@ -7102,10 +7102,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7102 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 7102 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; |
7103 | 7103 | ||
7104 | ScenePresence presence = World.GetScenePresence(agentID); | 7104 | ScenePresence presence = World.GetScenePresence(agentID); |
7105 | 7105 | ||
7106 | // we are not interested in child-agents | 7106 | // we are not interested in child-agents |
7107 | if (presence.IsChildAgent) return; | 7107 | if (presence.IsChildAgent) return; |
7108 | 7108 | ||
7109 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 7109 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
7110 | } | 7110 | } |
7111 | 7111 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 6c88ae86..52d277e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs | |||
@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
89 | { | 89 | { |
90 | if (!DataserverRequests.ContainsKey(identifier)) | 90 | if (!DataserverRequests.ContainsKey(identifier)) |
91 | return; | 91 | return; |
92 | 92 | ||
93 | ds=DataserverRequests[identifier]; | 93 | ds=DataserverRequests[identifier]; |
94 | DataserverRequests.Remove(identifier); | 94 | DataserverRequests.Remove(identifier); |
95 | } | 95 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs index 89bf51c..3f3cf39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
70 | new LSL_Types.LSLInteger(rInfo.GetIntValue()), | 70 | new LSL_Types.LSLInteger(rInfo.GetIntValue()), |
71 | new LSL_Types.LSLString(rInfo.GetStrVal()) | 71 | new LSL_Types.LSLString(rInfo.GetStrVal()) |
72 | }; | 72 | }; |
73 | 73 | ||
74 | foreach (AsyncCommandManager m in m_CmdManager.Managers) | 74 | foreach (AsyncCommandManager m in m_CmdManager.Managers) |
75 | { | 75 | { |
76 | if (m.m_ScriptEngine.PostScriptEvent( | 76 | if (m.m_ScriptEngine.PostScriptEvent( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index 5b32cde..c28aa9a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
81 | return; | 81 | return; |
82 | 82 | ||
83 | MethodInfo mi = inits[api]; | 83 | MethodInfo mi = inits[api]; |
84 | 84 | ||
85 | Object[] args = new Object[1]; | 85 | Object[] args = new Object[1]; |
86 | args[0] = data; | 86 | args[0] = data; |
87 | 87 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs index 681b2f2..d6a339b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
54 | { | 54 | { |
55 | _arity = arity; | 55 | _arity = arity; |
56 | } | 56 | } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Append the answer to the list and update the indexes, if any. | 59 | /// Append the answer to the list and update the indexes, if any. |
60 | /// Elements of answer must be ground, since arguments with unbound variables make this | 60 | /// Elements of answer must be ground, since arguments with unbound variables make this |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs index a2fe7ec..9f5ae3d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2008, Jeff Thompson | 2 | * Copyright (C) 2007-2008, Jeff Thompson |
3 | * | 3 | * |
4 | * All rights reserved. | 4 | * All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions are met: | 7 | * modification, are permitted provided that the following conditions are met: |
8 | * | 8 | * |
9 | * * Redistributions of source code must retain the above copyright | 9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * * Redistributions in binary form must reproduce the above copyright | 11 | * * Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. |
14 | * * Neither the name of the copyright holder nor the names of its contributors | 14 | * * Neither the name of the copyright holder nor the names of its contributors |
15 | * may be used to endorse or promote products derived from this software | 15 | * may be used to endorse or promote products derived from this software |
16 | * without specific prior written permission. | 16 | * without specific prior written permission. |
17 | * | 17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
54 | /// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding. | 54 | /// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding. |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="ErrorTerm">the error term of the error</param> | 56 | /// <param name="ErrorTerm">the error term of the error</param> |
57 | /// <param name="Messsage">the message term of the error. If this is a string, it is converted to an | 57 | /// <param name="Messsage">the message term of the error. If this is a string, it is converted to an |
58 | /// Atom so it can be used by Prolog code. | 58 | /// Atom so it can be used by Prolog code. |
59 | /// Message, converted to a string, is use as the printable exception message. | 59 | /// Message, converted to a string, is use as the printable exception message. |
60 | /// </param> | 60 | /// </param> |
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
66 | _term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore()); | 66 | _term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore()); |
67 | } | 67 | } |
68 | 68 | ||
69 | public class TypeErrorInfo | 69 | public class TypeErrorInfo |
70 | { | 70 | { |
71 | public readonly Atom _Type; | 71 | public readonly Atom _Type; |
72 | public readonly object _Culprit; | 72 | public readonly object _Culprit; |
@@ -116,14 +116,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
116 | /// <returns></returns> | 116 | /// <returns></returns> |
117 | public object getProcedureName() | 117 | public object getProcedureName() |
118 | { | 118 | { |
119 | if (!(_Type._name == "procedure" && | 119 | if (!(_Type._name == "procedure" && |
120 | _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH)) | 120 | _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH)) |
121 | return null; | 121 | return null; |
122 | return ((Functor2)_Culprit)._arg1; | 122 | return ((Functor2)_Culprit)._arg1; |
123 | } | 123 | } |
124 | 124 | ||
125 | /// <summary> | 125 | /// <summary> |
126 | /// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity. | 126 | /// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity. |
127 | /// Otherwise return -1. | 127 | /// Otherwise return -1. |
128 | /// </summary> | 128 | /// </summary> |
129 | /// <returns></returns> | 129 | /// <returns></returns> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs index 97c9087..2e90d74 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2008, Jeff Thompson | 2 | * Copyright (C) 2007-2008, Jeff Thompson |
3 | * | 3 | * |
4 | * All rights reserved. | 4 | * All rights reserved. |
5 | * | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions are met: | 7 | * modification, are permitted provided that the following conditions are met: |
8 | * | 8 | * |
9 | * * Redistributions of source code must retain the above copyright | 9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * * Redistributions in binary form must reproduce the above copyright | 11 | * * Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. |
14 | * * Neither the name of the copyright holder nor the names of its contributors | 14 | * * Neither the name of the copyright holder nor the names of its contributors |
15 | * may be used to endorse or promote products derived from this software | 15 | * may be used to endorse or promote products derived from this software |
16 | * without specific prior written permission. | 16 | * without specific prior written permission. |
17 | * | 17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Convert term to an int. | 148 | /// Convert term to an int. |
149 | /// If term is a single-element List, use its first element | 149 | /// If term is a single-element List, use its first element |
150 | /// (to handle the char types like "a"). | 150 | /// (to handle the char types like "a"). |
151 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only | 151 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only |
152 | /// called from arithmetic functions). | 152 | /// called from arithmetic functions). |
153 | /// </summary> | 153 | /// </summary> |
@@ -172,8 +172,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
172 | { | 172 | { |
173 | throw new PrologException | 173 | throw new PrologException |
174 | (new Functor2 | 174 | (new Functor2 |
175 | ("type_error", Atom.a("evaluable"), | 175 | ("type_error", Atom.a("evaluable"), |
176 | new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)), | 176 | new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)), |
177 | "Term must be an integer"); | 177 | "Term must be an integer"); |
178 | } | 178 | } |
179 | } | 179 | } |
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Convert term to a double. This may convert an int to a double, etc. | 182 | /// Convert term to a double. This may convert an int to a double, etc. |
183 | /// If term is a single-element List, use its first element | 183 | /// If term is a single-element List, use its first element |
184 | /// (to handle the char types like "a"). | 184 | /// (to handle the char types like "a"). |
185 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only | 185 | /// If can't convert, throw a PrologException for type_error evaluable (because this is only |
186 | /// called from arithmetic functions). | 186 | /// called from arithmetic functions). |
187 | /// </summary> | 187 | /// </summary> |
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
195 | // Assume it is a char type like "a". | 195 | // Assume it is a char type like "a". |
196 | term = YP.getValue(((Functor2)term)._arg1); | 196 | term = YP.getValue(((Functor2)term)._arg1); |
197 | if (term is Variable) | 197 | if (term is Variable) |
198 | throw new PrologException(Atom.a("instantiation_error"), | 198 | throw new PrologException(Atom.a("instantiation_error"), |
199 | "Expected a number but the argument is an unbound variable"); | 199 | "Expected a number but the argument is an unbound variable"); |
200 | 200 | ||
201 | try | 201 | try |
@@ -776,8 +776,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
776 | if (term1TypeCode == -2) | 776 | if (term1TypeCode == -2) |
777 | { | 777 | { |
778 | // Variable. | 778 | // Variable. |
779 | // We always check for equality first because we want to be sure | 779 | // We always check for equality first because we want to be sure |
780 | // that less than returns false if the terms are equal, in | 780 | // that less than returns false if the terms are equal, in |
781 | // case that the less than check really behaves like less than or equal. | 781 | // case that the less than check really behaves like less than or equal. |
782 | if ((Variable)Term1 != (Variable)Term2) | 782 | if ((Variable)Term1 != (Variable)Term2) |
783 | // The hash code should be unique to a Variable object. | 783 | // The hash code should be unique to a Variable object. |
@@ -820,8 +820,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
820 | } | 820 | } |
821 | 821 | ||
822 | /// <summary> | 822 | /// <summary> |
823 | /// Type code is -2 if term is a Variable, 0 if it is an Atom, | 823 | /// Type code is -2 if term is a Variable, 0 if it is an Atom, |
824 | /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3, | 824 | /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3, |
825 | /// 4 if it is Functor. | 825 | /// 4 if it is Functor. |
826 | /// Otherwise, type code is -1. | 826 | /// Otherwise, type code is -1. |
827 | /// This does not call YP.getValue(term). | 827 | /// This does not call YP.getValue(term). |
@@ -1167,7 +1167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1167 | "Arg 2 List has an element which is an unbound variable"); | 1167 | "Arg 2 List has an element which is an unbound variable"); |
1168 | if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1)) | 1168 | if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1)) |
1169 | throw new PrologException | 1169 | throw new PrologException |
1170 | (new Functor2("type_error", Atom.a("character"), listAtom), | 1170 | (new Functor2("type_error", Atom.a("character"), listAtom), |
1171 | "Arg 2 List has an element which is not a one character atom"); | 1171 | "Arg 2 List has an element which is not a one character atom"); |
1172 | charArray[i] = ((Atom)listAtom)._name[0]; | 1172 | charArray[i] = ((Atom)listAtom)._name[0]; |
1173 | } | 1173 | } |
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1209 | int codeInt; | 1209 | int codeInt; |
1210 | if (!getInt(codeArray[i], out codeInt) || codeInt < 0) | 1210 | if (!getInt(codeArray[i], out codeInt) || codeInt < 0) |
1211 | throw new PrologException | 1211 | throw new PrologException |
1212 | (new Functor1("representation_error", Atom.a("character_code")), | 1212 | (new Functor1("representation_error", Atom.a("character_code")), |
1213 | "Element of Arg 2 List is not a character code"); | 1213 | "Element of Arg 2 List is not a character code"); |
1214 | charArray[i] = (char)codeInt; | 1214 | charArray[i] = (char)codeInt; |
1215 | } | 1215 | } |
@@ -1323,7 +1323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1323 | { | 1323 | { |
1324 | if (!YP.number(Number)) | 1324 | if (!YP.number(Number)) |
1325 | throw new PrologException | 1325 | throw new PrologException |
1326 | (new Functor2("type_error", Atom.a("number"), Number), | 1326 | (new Functor2("type_error", Atom.a("number"), Number), |
1327 | "Arg 1 Number is not var or number"); | 1327 | "Arg 1 Number is not var or number"); |
1328 | // We just checked, so convertDouble shouldn't throw an exception. | 1328 | // We just checked, so convertDouble shouldn't throw an exception. |
1329 | numberString = YP.doubleToString(YP.convertDouble(Number)); | 1329 | numberString = YP.doubleToString(YP.convertDouble(Number)); |
@@ -1413,7 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1413 | { | 1413 | { |
1414 | if (!(Char is Atom) || ((Atom)Char)._name.Length != 1) | 1414 | if (!(Char is Atom) || ((Atom)Char)._name.Length != 1) |
1415 | throw new PrologException | 1415 | throw new PrologException |
1416 | (new Functor2("type_error", Atom.a("character"), Char), | 1416 | (new Functor2("type_error", Atom.a("character"), Char), |
1417 | "Arg 1 Char is not var or one-character atom"); | 1417 | "Arg 1 Char is not var or one-character atom"); |
1418 | 1418 | ||
1419 | if (Code is Variable) | 1419 | if (Code is Variable) |
@@ -1795,7 +1795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1795 | IndexedAnswers indexedAnswers; | 1795 | IndexedAnswers indexedAnswers; |
1796 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) | 1796 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) |
1797 | { | 1797 | { |
1798 | // Create an IndexedAnswers as the only clause of the predicate. | 1798 | // Create an IndexedAnswers as the only clause of the predicate. |
1799 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); | 1799 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); |
1800 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); | 1800 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); |
1801 | } | 1801 | } |
@@ -1826,7 +1826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1826 | IndexedAnswers indexedAnswers; | 1826 | IndexedAnswers indexedAnswers; |
1827 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) | 1827 | if (!_predicatesStore.TryGetValue(nameArity, out clauses)) |
1828 | { | 1828 | { |
1829 | // Create an IndexedAnswers as the only clause of the predicate. | 1829 | // Create an IndexedAnswers as the only clause of the predicate. |
1830 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); | 1830 | _predicatesStore[nameArity] = (clauses = new List<IClause>()); |
1831 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); | 1831 | clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); |
1832 | } | 1832 | } |
@@ -1855,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1855 | { | 1855 | { |
1856 | List<IClause> clauses; | 1856 | List<IClause> clauses; |
1857 | if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses)) | 1857 | if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses)) |
1858 | return unknownPredicate(name, arguments.Length, | 1858 | return unknownPredicate(name, arguments.Length, |
1859 | "Undefined dynamic predicate: " + name + "/" + arguments.Length); | 1859 | "Undefined dynamic predicate: " + name + "/" + arguments.Length); |
1860 | 1860 | ||
1861 | if (clauses.Count == 1) | 1861 | if (clauses.Count == 1) |
@@ -1889,7 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | /// <summary> | 1891 | /// <summary> |
1892 | /// If _prologFlags["unknown"] is fail then return fail(), else if | 1892 | /// If _prologFlags["unknown"] is fail then return fail(), else if |
1893 | /// _prologFlags["unknown"] is warning then write the message to YP.write and | 1893 | /// _prologFlags["unknown"] is warning then write the message to YP.write and |
1894 | /// return fail(), else throw a PrologException for existence_error. . | 1894 | /// return fail(), else throw a PrologException for existence_error. . |
1895 | /// </summary> | 1895 | /// </summary> |
@@ -1917,7 +1917,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | /// <summary> | 1919 | /// <summary> |
1920 | /// This is deprecated and just calls matchDynamic. This matches all clauses, | 1920 | /// This is deprecated and just calls matchDynamic. This matches all clauses, |
1921 | /// not just the ones defined with assertFact. | 1921 | /// not just the ones defined with assertFact. |
1922 | /// </summary> | 1922 | /// </summary> |
1923 | /// <param name="name"></param> | 1923 | /// <param name="name"></param> |
@@ -2066,7 +2066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2066 | /// dynamic predicate. | 2066 | /// dynamic predicate. |
2067 | /// </summary> | 2067 | /// </summary> |
2068 | /// <param name="NameSlashArity"></param> | 2068 | /// <param name="NameSlashArity"></param> |
2069 | /// <param name="declaringClass">if not null, used to resolve references to the default | 2069 | /// <param name="declaringClass">if not null, used to resolve references to the default |
2070 | /// module Atom.a("")</param> | 2070 | /// module Atom.a("")</param> |
2071 | /// <returns></returns> | 2071 | /// <returns></returns> |
2072 | public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass) | 2072 | public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass) |
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2078 | Functor2 NameArityFunctor = NameSlashArity as Functor2; | 2078 | Functor2 NameArityFunctor = NameSlashArity as Functor2; |
2079 | if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH)) | 2079 | if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH)) |
2080 | throw new PrologException | 2080 | throw new PrologException |
2081 | (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity), | 2081 | (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity), |
2082 | "Must be a name/arity predicate indicator"); | 2082 | "Must be a name/arity predicate indicator"); |
2083 | object name = YP.getValue(NameArityFunctor._arg1); | 2083 | object name = YP.getValue(NameArityFunctor._arg1); |
2084 | object arity = YP.getValue(NameArityFunctor._arg2); | 2084 | object arity = YP.getValue(NameArityFunctor._arg2); |
@@ -2163,12 +2163,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | /// <summary> | 2165 | /// <summary> |
2166 | /// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from | 2166 | /// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from |
2167 | /// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error. | 2167 | /// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error. |
2168 | /// Otherwise, compile the goal as a single clause predicate and invoke it. | 2168 | /// Otherwise, compile the goal as a single clause predicate and invoke it. |
2169 | /// </summary> | 2169 | /// </summary> |
2170 | /// <param name="Goal"></param> | 2170 | /// <param name="Goal"></param> |
2171 | /// <param name="declaringClass">if not null, used to resolve references to the default | 2171 | /// <param name="declaringClass">if not null, used to resolve references to the default |
2172 | /// module Atom.a("")</param> | 2172 | /// module Atom.a("")</param> |
2173 | /// <returns></returns> | 2173 | /// <returns></returns> |
2174 | public static IEnumerable<bool> getIterator(object Goal, Type declaringClass) | 2174 | public static IEnumerable<bool> getIterator(object Goal, Type declaringClass) |
@@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2259 | (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom"); | 2259 | (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom"); |
2260 | if (!_prologFlags.ContainsKey(((Atom)Key)._name)) | 2260 | if (!_prologFlags.ContainsKey(((Atom)Key)._name)) |
2261 | throw new PrologException | 2261 | throw new PrologException |
2262 | (new Functor2("domain_error", Atom.a("prolog_flag"), Key), | 2262 | (new Functor2("domain_error", Atom.a("prolog_flag"), Key), |
2263 | "Arg 1 Key is not a recognized flag"); | 2263 | "Arg 1 Key is not a recognized flag"); |
2264 | 2264 | ||
2265 | foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name])) | 2265 | foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name])) |
@@ -2343,7 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2343 | string results = ""; | 2343 | string results = ""; |
2344 | for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch()) | 2344 | for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch()) |
2345 | { | 2345 | { |
2346 | //Console.WriteLine( m ); | 2346 | //Console.WriteLine( m ); |
2347 | results += presep+ m + postsep; | 2347 | results += presep+ m + postsep; |
2348 | } | 2348 | } |
2349 | return results; | 2349 | return results; |
@@ -2662,7 +2662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2662 | #pragma warning restore 0168 | 2662 | #pragma warning restore 0168 |
2663 | } | 2663 | } |
2664 | } | 2664 | } |
2665 | 2665 | ||
2666 | /// <summary> | 2666 | /// <summary> |
2667 | /// CodeListReader extends TextReader and overrides Read to read the next code from | 2667 | /// CodeListReader extends TextReader and overrides Read to read the next code from |
2668 | /// the CodeList which is a Prolog list of integer character codes. | 2668 | /// the CodeList which is a Prolog list of integer character codes. |
@@ -2683,7 +2683,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
2683 | /// <returns></returns> | 2683 | /// <returns></returns> |
2684 | public override int Read() | 2684 | public override int Read() |
2685 | { | 2685 | { |
2686 | Functor2 CodeListPair = _CodeList as Functor2; | 2686 | Functor2 CodeListPair = _CodeList as Functor2; |
2687 | int code; | 2687 | int code; |
2688 | if (!(CodeListPair != null && CodeListPair._name == Atom.DOT && | 2688 | if (!(CodeListPair != null && CodeListPair._name == Atom.DOT && |
2689 | getInt(CodeListPair._arg1, out code))) | 2689 | getInt(CodeListPair._arg1, out code))) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs index f9b160d..0f79019 100644 --- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs | |||
@@ -54,11 +54,11 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
54 | { | 54 | { |
55 | string path = Path.Combine(Directory.GetCurrentDirectory(), | 55 | string path = Path.Combine(Directory.GetCurrentDirectory(), |
56 | Path.Combine(s, assemblyName))+".dll"; | 56 | Path.Combine(s, assemblyName))+".dll"; |
57 | 57 | ||
58 | if (File.Exists(path)) | 58 | if (File.Exists(path)) |
59 | return Assembly.LoadFrom(path); | 59 | return Assembly.LoadFrom(path); |
60 | } | 60 | } |
61 | 61 | ||
62 | return null; | 62 | return null; |
63 | } | 63 | } |
64 | } | 64 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 4962023..db90f3e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -412,8 +412,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
412 | 412 | ||
413 | private static string CreateYPCompilerScript(string compileScript) | 413 | private static string CreateYPCompilerScript(string compileScript) |
414 | { | 414 | { |
415 | |||
416 | |||
417 | compileScript = String.Empty + | 415 | compileScript = String.Empty + |
418 | "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " + | 416 | "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " + |
419 | "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + | 417 | "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs index 57e8776..45f92e3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSConverter.cs | |||
@@ -87,9 +87,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
87 | string quote = String.Empty; | 87 | string quote = String.Empty; |
88 | bool last_was_escape = false; | 88 | bool last_was_escape = false; |
89 | int quote_replaced_count = 0; | 89 | int quote_replaced_count = 0; |
90 | 90 | ||
91 | string removefwnoncomments = nonCommentFwsl.Replace(Script, "\"\";"); | 91 | string removefwnoncomments = nonCommentFwsl.Replace(Script, "\"\";"); |
92 | 92 | ||
93 | string removecomments = conelinecomments.Replace(removefwnoncomments, ""); | 93 | string removecomments = conelinecomments.Replace(removefwnoncomments, ""); |
94 | removecomments = cstylecomments.Replace(removecomments, ""); | 94 | removecomments = cstylecomments.Replace(removecomments, ""); |
95 | string[] localscript = removecomments.Split('"'); | 95 | string[] localscript = removecomments.Split('"'); |
@@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
120 | // checks for alpha.alpha way of referring to objects in C# | 120 | // checks for alpha.alpha way of referring to objects in C# |
121 | // ignores alpha.x alpha.y, alpha.z for refering to vector components | 121 | // ignores alpha.x alpha.y, alpha.z for refering to vector components |
122 | Match SecurityM; | 122 | Match SecurityM; |
123 | 123 | ||
124 | // BROKEN: this check is very wrong. It block's any url in strings. | 124 | // BROKEN: this check is very wrong. It block's any url in strings. |
125 | SecurityM = Regex.Match(checkscript, @"(?:[a-zA-Z])\.(?:[a-rt-wA-Z]|[a-zA-Z][a-zA-Z])", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 125 | SecurityM = Regex.Match(checkscript, @"(?:[a-zA-Z])\.(?:[a-rt-wA-Z]|[a-zA-Z][a-zA-Z])", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
126 | 126 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs index 831b918..22b3742 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
61 | myCode = myCode.Substring(0, cs_pointer); | 61 | myCode = myCode.Substring(0, cs_pointer); |
62 | } | 62 | } |
63 | myCode.Replace("//yp", "%YPCode"); | 63 | myCode.Replace("//yp", "%YPCode"); |
64 | 64 | ||
65 | StringWriter myCS_SW = new StringWriter(); | 65 | StringWriter myCS_SW = new StringWriter(); |
66 | StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n"); | 66 | StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n"); |
67 | 67 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 8326e16..5497e2c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1335,22 +1335,22 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1335 | bool ret = i1.value != i2.value; | 1335 | bool ret = i1.value != i2.value; |
1336 | return ret; | 1336 | return ret; |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | static public LSLInteger operator +(LSLInteger i1, int i2) | 1339 | static public LSLInteger operator +(LSLInteger i1, int i2) |
1340 | { | 1340 | { |
1341 | return new LSLInteger(i1.value + i2); | 1341 | return new LSLInteger(i1.value + i2); |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | static public LSLInteger operator -(LSLInteger i1, int i2) | 1344 | static public LSLInteger operator -(LSLInteger i1, int i2) |
1345 | { | 1345 | { |
1346 | return new LSLInteger(i1.value - i2); | 1346 | return new LSLInteger(i1.value - i2); |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | static public LSLInteger operator *(LSLInteger i1, int i2) | 1349 | static public LSLInteger operator *(LSLInteger i1, int i2) |
1350 | { | 1350 | { |
1351 | return new LSLInteger(i1.value * i2); | 1351 | return new LSLInteger(i1.value * i2); |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | static public LSLInteger operator /(LSLInteger i1, int i2) | 1354 | static public LSLInteger operator /(LSLInteger i1, int i2) |
1355 | { | 1355 | { |
1356 | return new LSLInteger(i1.value / i2); | 1356 | return new LSLInteger(i1.value / i2); |
@@ -1360,22 +1360,22 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1360 | { | 1360 | { |
1361 | return new LSLFloat((double)i1.value + f); | 1361 | return new LSLFloat((double)i1.value + f); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | static public LSLFloat operator -(LSLInteger i1, double f) | 1364 | static public LSLFloat operator -(LSLInteger i1, double f) |
1365 | { | 1365 | { |
1366 | return new LSLFloat((double)i1.value - f); | 1366 | return new LSLFloat((double)i1.value - f); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static public LSLFloat operator *(LSLInteger i1, double f) | 1369 | static public LSLFloat operator *(LSLInteger i1, double f) |
1370 | { | 1370 | { |
1371 | return new LSLFloat((double)i1.value * f); | 1371 | return new LSLFloat((double)i1.value * f); |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | static public LSLFloat operator /(LSLInteger i1, double f) | 1374 | static public LSLFloat operator /(LSLInteger i1, double f) |
1375 | { | 1375 | { |
1376 | return new LSLFloat((double)i1.value / f); | 1376 | return new LSLFloat((double)i1.value / f); |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static public LSLInteger operator -(LSLInteger i) | 1379 | static public LSLInteger operator -(LSLInteger i) |
1380 | { | 1380 | { |
1381 | return new LSLInteger(-i.value); | 1381 | return new LSLInteger(-i.value); |
@@ -1536,17 +1536,17 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1536 | f.value--; | 1536 | f.value--; |
1537 | return f; | 1537 | return f; |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | static public LSLFloat operator +(LSLFloat f, int i) | 1540 | static public LSLFloat operator +(LSLFloat f, int i) |
1541 | { | 1541 | { |
1542 | return new LSLFloat(f.value + (double)i); | 1542 | return new LSLFloat(f.value + (double)i); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | static public LSLFloat operator -(LSLFloat f, int i) | 1545 | static public LSLFloat operator -(LSLFloat f, int i) |
1546 | { | 1546 | { |
1547 | return new LSLFloat(f.value - (double)i); | 1547 | return new LSLFloat(f.value - (double)i); |
1548 | } | 1548 | } |
1549 | 1549 | ||
1550 | static public LSLFloat operator *(LSLFloat f, int i) | 1550 | static public LSLFloat operator *(LSLFloat f, int i) |
1551 | { | 1551 | { |
1552 | return new LSLFloat(f.value * (double)i); | 1552 | return new LSLFloat(f.value * (double)i); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index cdba1ac..c528c02 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -363,7 +363,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
363 | new WorkItemCallback( | 363 | new WorkItemCallback( |
364 | this.DoOnRezScriptQueue), new Object[0]); | 364 | this.DoOnRezScriptQueue), new Object[0]); |
365 | } | 365 | } |
366 | else | 366 | else |
367 | { | 367 | { |
368 | m_CurrentCompile = null; | 368 | m_CurrentCompile = null; |
369 | } | 369 | } |
@@ -394,7 +394,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
394 | new WorkItemCallback( | 394 | new WorkItemCallback( |
395 | this.DoOnRezScriptQueue), new Object[0]); | 395 | this.DoOnRezScriptQueue), new Object[0]); |
396 | } | 396 | } |
397 | else | 397 | else |
398 | { | 398 | { |
399 | m_CurrentCompile = null; | 399 | m_CurrentCompile = null; |
400 | } | 400 | } |
@@ -1113,7 +1113,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1113 | { | 1113 | { |
1114 | string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly), | 1114 | string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly), |
1115 | m_ItemID.ToString() + ".state"); | 1115 | m_ItemID.ToString() + ".state"); |
1116 | 1116 | ||
1117 | try | 1117 | try |
1118 | { | 1118 | { |
1119 | File.Delete(savedState); | 1119 | File.Delete(savedState); |