aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2010-09-25 06:19:26 +0100
committerMelanie2010-09-25 06:19:26 +0100
commit4fbdcb95a078d8a7b9c90bb3d3b56f955512bccd (patch)
tree1e69a75f208cc7065bdd196bb99d13adfb5003b5 /OpenSim/Region/ScriptEngine
parentExperimental locking of taint processing (diff)
parentFix a minor economy issue (diff)
downloadopensim-SC_OLD-4fbdcb95a078d8a7b9c90bb3d3b56f955512bccd.zip
opensim-SC_OLD-4fbdcb95a078d8a7b9c90bb3d3b56f955512bccd.tar.gz
opensim-SC_OLD-4fbdcb95a078d8a7b9c90bb3d3b56f955512bccd.tar.bz2
opensim-SC_OLD-4fbdcb95a078d8a7b9c90bb3d3b56f955512bccd.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs194
1 files changed, 98 insertions, 96 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index caa39ba..e94790f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -24,7 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
@@ -310,9 +310,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
310 case ScriptBaseClass.LINK_ALL_OTHERS: 310 case ScriptBaseClass.LINK_ALL_OTHERS:
311 if (m_host.ParentGroup == null) 311 if (m_host.ParentGroup == null)
312 return new List<SceneObjectPart>(); 312 return new List<SceneObjectPart>();
313 313
314 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 314 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
315 315
316 if (ret.Contains(m_host)) 316 if (ret.Contains(m_host))
317 ret.Remove(m_host); 317 ret.Remove(m_host);
318 return ret; 318 return ret;
@@ -320,9 +320,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
320 case ScriptBaseClass.LINK_ALL_CHILDREN: 320 case ScriptBaseClass.LINK_ALL_CHILDREN:
321 if (m_host.ParentGroup == null) 321 if (m_host.ParentGroup == null)
322 return new List<SceneObjectPart>(); 322 return new List<SceneObjectPart>();
323 323
324 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 324 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
325 325
326 if (ret.Contains(m_host.ParentGroup.RootPart)) 326 if (ret.Contains(m_host.ParentGroup.RootPart))
327 ret.Remove(m_host.ParentGroup.RootPart); 327 ret.Remove(m_host.ParentGroup.RootPart);
328 return ret; 328 return ret;
@@ -1540,7 +1540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1540 1540
1541 if (face == ScriptBaseClass.ALL_SIDES) 1541 if (face == ScriptBaseClass.ALL_SIDES)
1542 face = SceneObjectPart.ALL_SIDES; 1542 face = SceneObjectPart.ALL_SIDES;
1543 1543
1544 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 1544 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
1545 } 1545 }
1546 1546
@@ -2226,7 +2226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2226 2226
2227//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type 2227//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
2228// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 2228// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
2229 2229
2230 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line 2230 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
2231 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt 2231 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
2232 // It's perfectly okay when the object is not an active physical body though. 2232 // It's perfectly okay when the object is not an active physical body though.
@@ -4338,7 +4338,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4338 case 1: // DATA_ONLINE (0|1) 4338 case 1: // DATA_ONLINE (0|1)
4339 if (pinfo != null && pinfo.RegionID != UUID.Zero) 4339 if (pinfo != null && pinfo.RegionID != UUID.Zero)
4340 reply = "1"; 4340 reply = "1";
4341 else 4341 else
4342 reply = "0"; 4342 reply = "0";
4343 break; 4343 break;
4344 case 2: // DATA_NAME (First Last) 4344 case 2: // DATA_NAME (First Last)
@@ -4534,7 +4534,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4534 return currentAnimationState; 4534 return currentAnimationState;
4535 } 4535 }
4536 } 4536 }
4537 4537
4538 return String.Empty; 4538 return String.Empty;
4539 } 4539 }
4540 4540
@@ -4650,7 +4650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4650 return; 4650 return;
4651 4651
4652 // Need provisions for Group Owned here 4652 // Need provisions for Group Owned here
4653 if (m_host.OwnerID == targetlandObj.LandData.OwnerID || 4653 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4654 targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID) 4654 targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID)
4655 { 4655 {
4656 pushAllowed = true; 4656 pushAllowed = true;
@@ -4670,8 +4670,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4670 if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject) 4670 if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject)
4671 { 4671 {
4672 // Need provisions for Group Owned here 4672 // Need provisions for Group Owned here
4673 if (m_host.OwnerID == targetlandObj.LandData.OwnerID || 4673 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4674 targetlandObj.LandData.IsGroupOwned || 4674 targetlandObj.LandData.IsGroupOwned ||
4675 m_host.OwnerID == targetID) 4675 m_host.OwnerID == targetID)
4676 { 4676 {
4677 pushAllowed = true; 4677 pushAllowed = true;
@@ -4795,7 +4795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4795 4795
4796 return sides; 4796 return sides;
4797 } 4797 }
4798 4798
4799 4799
4800 /* The new / changed functions were tested with the following LSL script: 4800 /* The new / changed functions were tested with the following LSL script:
4801 4801
@@ -5809,7 +5809,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5809 flags |= ScriptBaseClass.AGENT_SITTING; 5809 flags |= ScriptBaseClass.AGENT_SITTING;
5810 } 5810 }
5811 5811
5812 if (agent.Animator.Animations.DefaultAnimation.AnimID 5812 if (agent.Animator.Animations.DefaultAnimation.AnimID
5813 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5813 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5814 { 5814 {
5815 flags |= ScriptBaseClass.AGENT_SITTING; 5815 flags |= ScriptBaseClass.AGENT_SITTING;
@@ -6190,7 +6190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6190 m_host.AddScriptLPS(1); 6190 m_host.AddScriptLPS(1);
6191 return World.SimulatorFPS; 6191 return World.SimulatorFPS;
6192 } 6192 }
6193 6193
6194 6194
6195 /* particle system rules should be coming into this routine as doubles, that is 6195 /* particle system rules should be coming into this routine as doubles, that is
6196 rule[0] should be an integer from this list and rule[1] should be the arg 6196 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -6273,7 +6273,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6273 6273
6274 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { 6274 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
6275 6275
6276 6276
6277 if (rules.Length == 0) 6277 if (rules.Length == 0)
6278 { 6278 {
6279 part.RemoveParticleSystem(); 6279 part.RemoveParticleSystem();
@@ -6444,7 +6444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6444 if (m_host.PhysActor != null) 6444 if (m_host.PhysActor != null)
6445 { 6445 {
6446 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); 6446 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
6447 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); 6447 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0));
6448 PIDHoverType hoverType = PIDHoverType.Ground; 6448 PIDHoverType hoverType = PIDHoverType.Ground;
6449 if (water != 0) 6449 if (water != 0)
6450 { 6450 {
@@ -6458,7 +6458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6458 { 6458 {
6459 height += ground; 6459 height += ground;
6460 } 6460 }
6461 6461
6462 m_host.SetHoverHeight((float)height, hoverType, (float)tau); 6462 m_host.SetHoverHeight((float)height, hoverType, (float)tau);
6463 } 6463 }
6464 } 6464 }
@@ -6841,19 +6841,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6841 if (xmlRpcRouter != null) 6841 if (xmlRpcRouter != null)
6842 { 6842 {
6843 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; 6843 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
6844 6844
6845 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, 6845 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
6846 m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, 6846 m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
6847 xmlrpcMod.Port.ToString())); 6847 xmlrpcMod.Port.ToString()));
6848 } 6848 }
6849 object[] resobj = new object[] 6849 object[] resobj = new object[]
6850 { 6850 {
6851 new LSL_Integer(1), 6851 new LSL_Integer(1),
6852 new LSL_String(channelID.ToString()), 6852 new LSL_String(channelID.ToString()),
6853 new LSL_String(UUID.Zero.ToString()), 6853 new LSL_String(UUID.Zero.ToString()),
6854 new LSL_String(String.Empty), 6854 new LSL_String(String.Empty),
6855 new LSL_Integer(0), 6855 new LSL_Integer(0),
6856 new LSL_String(String.Empty) 6856 new LSL_String(String.Empty)
6857 }; 6857 };
6858 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, 6858 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
6859 new DetectParams[0])); 6859 new DetectParams[0]));
@@ -7242,6 +7242,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7242 { 7242 {
7243 m_host.AddScriptLPS(1); 7243 m_host.AddScriptLPS(1);
7244 SetPrimParams(m_host, rules); 7244 SetPrimParams(m_host, rules);
7245
7246 ScriptSleep(200);
7245 } 7247 }
7246 7248
7247 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 7249 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@@ -7469,7 +7471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7469 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7471 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7470 skew = (float)rules.GetLSLFloatItem(idx++); 7472 skew = (float)rules.GetLSLFloatItem(idx++);
7471 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7473 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7472 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7474 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7473 revolutions, radiusoffset, skew, 0); 7475 revolutions, radiusoffset, skew, 0);
7474 break; 7476 break;
7475 7477
@@ -7489,7 +7491,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7489 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7491 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7490 skew = (float)rules.GetLSLFloatItem(idx++); 7492 skew = (float)rules.GetLSLFloatItem(idx++);
7491 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7493 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7492 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7494 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7493 revolutions, radiusoffset, skew, 1); 7495 revolutions, radiusoffset, skew, 1);
7494 break; 7496 break;
7495 7497
@@ -7509,7 +7511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7509 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7511 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7510 skew = (float)rules.GetLSLFloatItem(idx++); 7512 skew = (float)rules.GetLSLFloatItem(idx++);
7511 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7513 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7512 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7514 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7513 revolutions, radiusoffset, skew, 3); 7515 revolutions, radiusoffset, skew, 3);
7514 break; 7516 break;
7515 7517
@@ -7555,7 +7557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7555 SetAlpha(part, alpha, face); 7557 SetAlpha(part, alpha, face);
7556 7558
7557 break; 7559 break;
7558 7560
7559 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 7561 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
7560 if (remain < 7) 7562 if (remain < 7)
7561 return; 7563 return;
@@ -7571,7 +7573,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7571 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); 7573 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
7572 7574
7573 break; 7575 break;
7574 7576
7575 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 7577 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
7576 if (remain < 5) 7578 if (remain < 5)
7577 return; 7579 return;
@@ -7584,7 +7586,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7584 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 7586 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
7585 7587
7586 break; 7588 break;
7587 7589
7588 case (int)ScriptBaseClass.PRIM_GLOW: 7590 case (int)ScriptBaseClass.PRIM_GLOW:
7589 if (remain < 2) 7591 if (remain < 2)
7590 return; 7592 return;
@@ -7594,7 +7596,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7594 SetGlow(part, face, glow); 7596 SetGlow(part, face, glow);
7595 7597
7596 break; 7598 break;
7597 7599
7598 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 7600 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
7599 if (remain < 3) 7601 if (remain < 3)
7600 return; 7602 return;
@@ -7605,7 +7607,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7605 SetShiny(part, face, shiny, bump); 7607 SetShiny(part, face, shiny, bump);
7606 7608
7607 break; 7609 break;
7608 7610
7609 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 7611 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7610 if (remain < 2) 7612 if (remain < 2)
7611 return; 7613 return;
@@ -7613,7 +7615,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7613 bool st = rules.GetLSLIntegerItem(idx++); 7615 bool st = rules.GetLSLIntegerItem(idx++);
7614 SetFullBright(part, face , st); 7616 SetFullBright(part, face , st);
7615 break; 7617 break;
7616 7618
7617 case (int)ScriptBaseClass.PRIM_MATERIAL: 7619 case (int)ScriptBaseClass.PRIM_MATERIAL:
7618 if (remain < 1) 7620 if (remain < 1)
7619 return; 7621 return;
@@ -7623,7 +7625,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7623 7625
7624 part.Material = Convert.ToByte(mat); 7626 part.Material = Convert.ToByte(mat);
7625 break; 7627 break;
7626 7628
7627 case (int)ScriptBaseClass.PRIM_PHANTOM: 7629 case (int)ScriptBaseClass.PRIM_PHANTOM:
7628 if (remain < 1) 7630 if (remain < 1)
7629 return; 7631 return;
@@ -7638,7 +7640,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7638 7640
7639 part.ScriptSetPhantomStatus(phantom); 7641 part.ScriptSetPhantomStatus(phantom);
7640 break; 7642 break;
7641 7643
7642 case (int)ScriptBaseClass.PRIM_PHYSICS: 7644 case (int)ScriptBaseClass.PRIM_PHYSICS:
7643 if (remain < 1) 7645 if (remain < 1)
7644 return; 7646 return;
@@ -7652,7 +7654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7652 7654
7653 part.ScriptSetPhysicsStatus(physics); 7655 part.ScriptSetPhysicsStatus(physics);
7654 break; 7656 break;
7655 7657
7656 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7658 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7657 if (remain < 1) 7659 if (remain < 1)
7658 return; 7660 return;
@@ -7778,7 +7780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7778 public LSL_Vector llGetRootPosition() 7780 public LSL_Vector llGetRootPosition()
7779 { 7781 {
7780 m_host.AddScriptLPS(1); 7782 m_host.AddScriptLPS(1);
7781 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, 7783 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
7782 m_host.ParentGroup.AbsolutePosition.Z); 7784 m_host.ParentGroup.AbsolutePosition.Z);
7783 } 7785 }
7784 7786
@@ -8109,8 +8111,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8109 res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned 8111 res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
8110 // byte is being used to represent the entire 8112 // byte is being used to represent the entire
8111 // range of floating-point values from 1.0 8113 // range of floating-point values from 1.0
8112 // through 4.0 (which is how SL does it). 8114 // through 4.0 (which is how SL does it).
8113 8115
8114 // float radiusoffset 8116 // float radiusoffset
8115 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); 8117 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
8116 8118
@@ -8391,104 +8393,104 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8391 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8393 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8392 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8394 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8393 return new LSL_List(); 8395 return new LSL_List();
8394 8396
8395 return GetPrimMediaParams(face, rules); 8397 return GetPrimMediaParams(face, rules);
8396 } 8398 }
8397 8399
8398 private LSL_List GetPrimMediaParams(int face, LSL_List rules) 8400 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8399 { 8401 {
8400 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8402 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8401 if (null == module) 8403 if (null == module)
8402 throw new Exception("Media on a prim functions not available"); 8404 throw new Exception("Media on a prim functions not available");
8403 8405
8404 MediaEntry me = module.GetMediaEntry(m_host, face); 8406 MediaEntry me = module.GetMediaEntry(m_host, face);
8405 8407
8406 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8408 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8407 if (null == me) 8409 if (null == me)
8408 return new LSL_List(); 8410 return new LSL_List();
8409 8411
8410 LSL_List res = new LSL_List(); 8412 LSL_List res = new LSL_List();
8411 8413
8412 for (int i = 0; i < rules.Length; i++) 8414 for (int i = 0; i < rules.Length; i++)
8413 { 8415 {
8414 int code = (int)rules.GetLSLIntegerItem(i); 8416 int code = (int)rules.GetLSLIntegerItem(i);
8415 8417
8416 switch (code) 8418 switch (code)
8417 { 8419 {
8418 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: 8420 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
8419 // Not implemented 8421 // Not implemented
8420 res.Add(new LSL_Integer(0)); 8422 res.Add(new LSL_Integer(0));
8421 break; 8423 break;
8422 8424
8423 case ScriptBaseClass.PRIM_MEDIA_CONTROLS: 8425 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
8424 if (me.Controls == MediaControls.Standard) 8426 if (me.Controls == MediaControls.Standard)
8425 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); 8427 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
8426 else 8428 else
8427 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); 8429 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
8428 break; 8430 break;
8429 8431
8430 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: 8432 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
8431 res.Add(new LSL_String(me.CurrentURL)); 8433 res.Add(new LSL_String(me.CurrentURL));
8432 break; 8434 break;
8433 8435
8434 case ScriptBaseClass.PRIM_MEDIA_HOME_URL: 8436 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
8435 res.Add(new LSL_String(me.HomeURL)); 8437 res.Add(new LSL_String(me.HomeURL));
8436 break; 8438 break;
8437 8439
8438 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: 8440 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
8439 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8441 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8440 break; 8442 break;
8441 8443
8442 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: 8444 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
8443 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8445 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8444 break; 8446 break;
8445 8447
8446 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: 8448 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
8447 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8449 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8448 break; 8450 break;
8449 8451
8450 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: 8452 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
8451 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8453 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8452 break; 8454 break;
8453 8455
8454 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: 8456 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
8455 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8457 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8456 break; 8458 break;
8457 8459
8458 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: 8460 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
8459 res.Add(new LSL_Integer(me.Width)); 8461 res.Add(new LSL_Integer(me.Width));
8460 break; 8462 break;
8461 8463
8462 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: 8464 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
8463 res.Add(new LSL_Integer(me.Height)); 8465 res.Add(new LSL_Integer(me.Height));
8464 break; 8466 break;
8465 8467
8466 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: 8468 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8467 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 8469 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
8468 break; 8470 break;
8469 8471
8470 case ScriptBaseClass.PRIM_MEDIA_WHITELIST: 8472 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8471 string[] urls = (string[])me.WhiteList.Clone(); 8473 string[] urls = (string[])me.WhiteList.Clone();
8472 8474
8473 for (int j = 0; j < urls.Length; j++) 8475 for (int j = 0; j < urls.Length; j++)
8474 urls[j] = Uri.EscapeDataString(urls[j]); 8476 urls[j] = Uri.EscapeDataString(urls[j]);
8475 8477
8476 res.Add(new LSL_String(string.Join(", ", urls))); 8478 res.Add(new LSL_String(string.Join(", ", urls)));
8477 break; 8479 break;
8478 8480
8479 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: 8481 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8480 res.Add(new LSL_Integer((int)me.InteractPermissions)); 8482 res.Add(new LSL_Integer((int)me.InteractPermissions));
8481 break; 8483 break;
8482 8484
8483 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8485 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8484 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8486 res.Add(new LSL_Integer((int)me.ControlPermissions));
8485 break; 8487 break;
8486 } 8488 }
8487 } 8489 }
8488 8490
8489 return res; 8491 return res;
8490 } 8492 }
8491 8493
8492 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8494 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
8493 { 8495 {
8494 m_host.AddScriptLPS(1); 8496 m_host.AddScriptLPS(1);
@@ -8499,32 +8501,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8499 // Don't perform the media check directly 8501 // Don't perform the media check directly
8500 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8502 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8501 return ScriptBaseClass.LSL_STATUS_OK; 8503 return ScriptBaseClass.LSL_STATUS_OK;
8502 8504
8503 return SetPrimMediaParams(face, rules); 8505 return SetPrimMediaParams(face, rules);
8504 } 8506 }
8505 8507
8506 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8508 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
8507 { 8509 {
8508 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8510 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8509 if (null == module) 8511 if (null == module)
8510 throw new Exception("Media on a prim functions not available"); 8512 throw new Exception("Media on a prim functions not available");
8511 8513
8512 MediaEntry me = module.GetMediaEntry(m_host, face); 8514 MediaEntry me = module.GetMediaEntry(m_host, face);
8513 if (null == me) 8515 if (null == me)
8514 me = new MediaEntry(); 8516 me = new MediaEntry();
8515 8517
8516 int i = 0; 8518 int i = 0;
8517 8519
8518 while (i < rules.Length - 1) 8520 while (i < rules.Length - 1)
8519 { 8521 {
8520 int code = rules.GetLSLIntegerItem(i++); 8522 int code = rules.GetLSLIntegerItem(i++);
8521 8523
8522 switch (code) 8524 switch (code)
8523 { 8525 {
8524 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: 8526 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
8525 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false); 8527 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
8526 break; 8528 break;
8527 8529
8528 case ScriptBaseClass.PRIM_MEDIA_CONTROLS: 8530 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
8529 int v = rules.GetLSLIntegerItem(i++); 8531 int v = rules.GetLSLIntegerItem(i++);
8530 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v) 8532 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
@@ -8532,47 +8534,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8532 else 8534 else
8533 me.Controls = MediaControls.Mini; 8535 me.Controls = MediaControls.Mini;
8534 break; 8536 break;
8535 8537
8536 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: 8538 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
8537 me.CurrentURL = rules.GetLSLStringItem(i++); 8539 me.CurrentURL = rules.GetLSLStringItem(i++);
8538 break; 8540 break;
8539 8541
8540 case ScriptBaseClass.PRIM_MEDIA_HOME_URL: 8542 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
8541 me.HomeURL = rules.GetLSLStringItem(i++); 8543 me.HomeURL = rules.GetLSLStringItem(i++);
8542 break; 8544 break;
8543 8545
8544 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: 8546 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
8545 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8547 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8546 break; 8548 break;
8547 8549
8548 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: 8550 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
8549 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8551 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8550 break; 8552 break;
8551 8553
8552 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: 8554 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
8553 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8555 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8554 break; 8556 break;
8555 8557
8556 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: 8558 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
8557 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8559 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8558 break; 8560 break;
8559 8561
8560 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: 8562 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
8561 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8563 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8562 break; 8564 break;
8563 8565
8564 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: 8566 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
8565 me.Width = (int)rules.GetLSLIntegerItem(i++); 8567 me.Width = (int)rules.GetLSLIntegerItem(i++);
8566 break; 8568 break;
8567 8569
8568 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: 8570 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
8569 me.Height = (int)rules.GetLSLIntegerItem(i++); 8571 me.Height = (int)rules.GetLSLIntegerItem(i++);
8570 break; 8572 break;
8571 8573
8572 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: 8574 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8573 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8575 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8574 break; 8576 break;
8575 8577
8576 case ScriptBaseClass.PRIM_MEDIA_WHITELIST: 8578 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8577 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' }); 8579 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
8578 List<string> whiteListUrls = new List<string>(); 8580 List<string> whiteListUrls = new List<string>();
@@ -8580,22 +8582,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8580 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); }); 8582 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
8581 me.WhiteList = whiteListUrls.ToArray(); 8583 me.WhiteList = whiteListUrls.ToArray();
8582 break; 8584 break;
8583 8585
8584 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: 8586 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8585 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8587 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8586 break; 8588 break;
8587 8589
8588 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8590 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8589 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8591 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8590 break; 8592 break;
8591 } 8593 }
8592 } 8594 }
8593 8595
8594 module.SetMediaEntry(m_host, face, me); 8596 module.SetMediaEntry(m_host, face, me);
8595 8597
8596 return ScriptBaseClass.LSL_STATUS_OK; 8598 return ScriptBaseClass.LSL_STATUS_OK;
8597 } 8599 }
8598 8600
8599 public LSL_Integer llClearPrimMedia(LSL_Integer face) 8601 public LSL_Integer llClearPrimMedia(LSL_Integer face)
8600 { 8602 {
8601 m_host.AddScriptLPS(1); 8603 m_host.AddScriptLPS(1);
@@ -8606,16 +8608,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8606 // FIXME: Don't perform the media check directly 8608 // FIXME: Don't perform the media check directly
8607 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8609 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8608 return ScriptBaseClass.LSL_STATUS_OK; 8610 return ScriptBaseClass.LSL_STATUS_OK;
8609 8611
8610 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8612 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8611 if (null == module) 8613 if (null == module)
8612 throw new Exception("Media on a prim functions not available"); 8614 throw new Exception("Media on a prim functions not available");
8613 8615
8614 module.ClearMediaEntry(m_host, face); 8616 module.ClearMediaEntry(m_host, face);
8615 8617
8616 return ScriptBaseClass.LSL_STATUS_OK; 8618 return ScriptBaseClass.LSL_STATUS_OK;
8617 } 8619 }
8618 8620
8619 // <remarks> 8621 // <remarks>
8620 // <para> 8622 // <para>
8621 // The .NET definition of base 64 is: 8623 // The .NET definition of base 64 is:
@@ -8875,7 +8877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8875 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) 8877 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
8876 { 8878 {
8877 m_host.AddScriptLPS(1); 8879 m_host.AddScriptLPS(1);
8878 8880
8879 if (m_UrlModule != null) 8881 if (m_UrlModule != null)
8880 return m_UrlModule.GetHttpHeader(new UUID(request_id), header); 8882 return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
8881 return String.Empty; 8883 return String.Empty;