aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs204
1 files changed, 104 insertions, 100 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a6ca171..8bf9482 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;
@@ -252,9 +252,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
252 case ScriptBaseClass.LINK_ALL_OTHERS: 252 case ScriptBaseClass.LINK_ALL_OTHERS:
253 if (m_host.ParentGroup == null) 253 if (m_host.ParentGroup == null)
254 return new List<SceneObjectPart>(); 254 return new List<SceneObjectPart>();
255 255
256 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 256 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
257 257
258 if (ret.Contains(m_host)) 258 if (ret.Contains(m_host))
259 ret.Remove(m_host); 259 ret.Remove(m_host);
260 return ret; 260 return ret;
@@ -262,9 +262,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
262 case ScriptBaseClass.LINK_ALL_CHILDREN: 262 case ScriptBaseClass.LINK_ALL_CHILDREN:
263 if (m_host.ParentGroup == null) 263 if (m_host.ParentGroup == null)
264 return new List<SceneObjectPart>(); 264 return new List<SceneObjectPart>();
265 265
266 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 266 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
267 267
268 if (ret.Contains(m_host.ParentGroup.RootPart)) 268 if (ret.Contains(m_host.ParentGroup.RootPart))
269 ret.Remove(m_host.ParentGroup.RootPart); 269 ret.Remove(m_host.ParentGroup.RootPart);
270 return ret; 270 return ret;
@@ -1404,7 +1404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1404 1404
1405 if (face == ScriptBaseClass.ALL_SIDES) 1405 if (face == ScriptBaseClass.ALL_SIDES)
1406 face = SceneObjectPart.ALL_SIDES; 1406 face = SceneObjectPart.ALL_SIDES;
1407 1407
1408 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 1408 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
1409 } 1409 }
1410 1410
@@ -2039,7 +2039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2039 2039
2040//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type 2040//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
2041// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 2041// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
2042 2042
2043 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line 2043 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
2044 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt 2044 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
2045 // It's perfectly okay when the object is not an active physical body though. 2045 // It's perfectly okay when the object is not an active physical body though.
@@ -4009,7 +4009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4009 case 1: // DATA_ONLINE (0|1) 4009 case 1: // DATA_ONLINE (0|1)
4010 if (pinfo != null && pinfo.RegionID != UUID.Zero) 4010 if (pinfo != null && pinfo.RegionID != UUID.Zero)
4011 reply = "1"; 4011 reply = "1";
4012 else 4012 else
4013 reply = "0"; 4013 reply = "0";
4014 break; 4014 break;
4015 case 2: // DATA_NAME (First Last) 4015 case 2: // DATA_NAME (First Last)
@@ -4202,7 +4202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4202 return currentAnimationState; 4202 return currentAnimationState;
4203 } 4203 }
4204 } 4204 }
4205 4205
4206 return String.Empty; 4206 return String.Empty;
4207 } 4207 }
4208 4208
@@ -4317,7 +4317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4317 return; 4317 return;
4318 4318
4319 // Need provisions for Group Owned here 4319 // Need provisions for Group Owned here
4320 if (m_host.OwnerID == targetlandObj.LandData.OwnerID || 4320 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4321 targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID) 4321 targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID)
4322 { 4322 {
4323 pushAllowed = true; 4323 pushAllowed = true;
@@ -4337,8 +4337,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4337 if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject) 4337 if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject)
4338 { 4338 {
4339 // Need provisions for Group Owned here 4339 // Need provisions for Group Owned here
4340 if (m_host.OwnerID == targetlandObj.LandData.OwnerID || 4340 if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
4341 targetlandObj.LandData.IsGroupOwned || 4341 targetlandObj.LandData.IsGroupOwned ||
4342 m_host.OwnerID == targetID) 4342 m_host.OwnerID == targetID)
4343 { 4343 {
4344 pushAllowed = true; 4344 pushAllowed = true;
@@ -4463,7 +4463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4463 4463
4464 return sides; 4464 return sides;
4465 } 4465 }
4466 4466
4467 4467
4468 /* The new / changed functions were tested with the following LSL script: 4468 /* The new / changed functions were tested with the following LSL script:
4469 4469
@@ -5470,7 +5470,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5470 flags |= ScriptBaseClass.AGENT_SITTING; 5470 flags |= ScriptBaseClass.AGENT_SITTING;
5471 } 5471 }
5472 5472
5473 if (agent.Animator.Animations.DefaultAnimation.AnimID 5473 if (agent.Animator.Animations.DefaultAnimation.AnimID
5474 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5474 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5475 { 5475 {
5476 flags |= ScriptBaseClass.AGENT_SITTING; 5476 flags |= ScriptBaseClass.AGENT_SITTING;
@@ -5837,7 +5837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5837 m_host.AddScriptLPS(1); 5837 m_host.AddScriptLPS(1);
5838 return World.SimulatorFPS; 5838 return World.SimulatorFPS;
5839 } 5839 }
5840 5840
5841 5841
5842 /* particle system rules should be coming into this routine as doubles, that is 5842 /* particle system rules should be coming into this routine as doubles, that is
5843 rule[0] should be an integer from this list and rule[1] should be the arg 5843 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -5920,7 +5920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5920 5920
5921 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { 5921 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
5922 5922
5923 5923
5924 if (rules.Length == 0) 5924 if (rules.Length == 0)
5925 { 5925 {
5926 part.RemoveParticleSystem(); 5926 part.RemoveParticleSystem();
@@ -6091,7 +6091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6091 if (m_host.PhysActor != null) 6091 if (m_host.PhysActor != null)
6092 { 6092 {
6093 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); 6093 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
6094 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); 6094 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0));
6095 PIDHoverType hoverType = PIDHoverType.Ground; 6095 PIDHoverType hoverType = PIDHoverType.Ground;
6096 if (water != 0) 6096 if (water != 0)
6097 { 6097 {
@@ -6105,7 +6105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6105 { 6105 {
6106 height += ground; 6106 height += ground;
6107 } 6107 }
6108 6108
6109 m_host.SetHoverHeight((float)height, hoverType, (float)tau); 6109 m_host.SetHoverHeight((float)height, hoverType, (float)tau);
6110 } 6110 }
6111 } 6111 }
@@ -6487,19 +6487,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6487 if (xmlRpcRouter != null) 6487 if (xmlRpcRouter != null)
6488 { 6488 {
6489 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; 6489 string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
6490 6490
6491 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, 6491 xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
6492 m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, 6492 m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
6493 xmlrpcMod.Port.ToString())); 6493 xmlrpcMod.Port.ToString()));
6494 } 6494 }
6495 object[] resobj = new object[] 6495 object[] resobj = new object[]
6496 { 6496 {
6497 new LSL_Integer(1), 6497 new LSL_Integer(1),
6498 new LSL_String(channelID.ToString()), 6498 new LSL_String(channelID.ToString()),
6499 new LSL_String(UUID.Zero.ToString()), 6499 new LSL_String(UUID.Zero.ToString()),
6500 new LSL_String(String.Empty), 6500 new LSL_String(String.Empty),
6501 new LSL_Integer(0), 6501 new LSL_Integer(0),
6502 new LSL_String(String.Empty) 6502 new LSL_String(String.Empty)
6503 }; 6503 };
6504 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, 6504 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
6505 new DetectParams[0])); 6505 new DetectParams[0]));
@@ -6874,6 +6874,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6874 { 6874 {
6875 m_host.AddScriptLPS(1); 6875 m_host.AddScriptLPS(1);
6876 SetPrimParams(m_host, rules); 6876 SetPrimParams(m_host, rules);
6877
6878 ScriptSleep(200);
6877 } 6879 }
6878 6880
6879 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) 6881 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
@@ -6884,6 +6886,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6884 6886
6885 foreach (SceneObjectPart part in parts) 6887 foreach (SceneObjectPart part in parts)
6886 SetPrimParams(part, rules); 6888 SetPrimParams(part, rules);
6889
6890 ScriptSleep(200);
6887 } 6891 }
6888 6892
6889 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 6893 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@@ -7041,7 +7045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7041 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7045 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7042 skew = (float)rules.GetLSLFloatItem(idx++); 7046 skew = (float)rules.GetLSLFloatItem(idx++);
7043 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7047 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7044 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7048 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7045 revolutions, radiusoffset, skew, 0); 7049 revolutions, radiusoffset, skew, 0);
7046 break; 7050 break;
7047 7051
@@ -7061,7 +7065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7061 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7065 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7062 skew = (float)rules.GetLSLFloatItem(idx++); 7066 skew = (float)rules.GetLSLFloatItem(idx++);
7063 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7067 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7064 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7068 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7065 revolutions, radiusoffset, skew, 1); 7069 revolutions, radiusoffset, skew, 1);
7066 break; 7070 break;
7067 7071
@@ -7081,7 +7085,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7081 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7085 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7082 skew = (float)rules.GetLSLFloatItem(idx++); 7086 skew = (float)rules.GetLSLFloatItem(idx++);
7083 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7087 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7084 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7088 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7085 revolutions, radiusoffset, skew, 3); 7089 revolutions, radiusoffset, skew, 3);
7086 break; 7090 break;
7087 7091
@@ -7127,7 +7131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7127 SetAlpha(part, alpha, face); 7131 SetAlpha(part, alpha, face);
7128 7132
7129 break; 7133 break;
7130 7134
7131 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 7135 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
7132 if (remain < 7) 7136 if (remain < 7)
7133 return; 7137 return;
@@ -7143,7 +7147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7143 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); 7147 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
7144 7148
7145 break; 7149 break;
7146 7150
7147 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 7151 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
7148 if (remain < 5) 7152 if (remain < 5)
7149 return; 7153 return;
@@ -7156,7 +7160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7156 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 7160 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
7157 7161
7158 break; 7162 break;
7159 7163
7160 case (int)ScriptBaseClass.PRIM_GLOW: 7164 case (int)ScriptBaseClass.PRIM_GLOW:
7161 if (remain < 2) 7165 if (remain < 2)
7162 return; 7166 return;
@@ -7166,7 +7170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7166 SetGlow(part, face, glow); 7170 SetGlow(part, face, glow);
7167 7171
7168 break; 7172 break;
7169 7173
7170 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 7174 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
7171 if (remain < 3) 7175 if (remain < 3)
7172 return; 7176 return;
@@ -7177,7 +7181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7177 SetShiny(part, face, shiny, bump); 7181 SetShiny(part, face, shiny, bump);
7178 7182
7179 break; 7183 break;
7180 7184
7181 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 7185 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7182 if (remain < 2) 7186 if (remain < 2)
7183 return; 7187 return;
@@ -7185,7 +7189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7185 bool st = rules.GetLSLIntegerItem(idx++); 7189 bool st = rules.GetLSLIntegerItem(idx++);
7186 SetFullBright(part, face , st); 7190 SetFullBright(part, face , st);
7187 break; 7191 break;
7188 7192
7189 case (int)ScriptBaseClass.PRIM_MATERIAL: 7193 case (int)ScriptBaseClass.PRIM_MATERIAL:
7190 if (remain < 1) 7194 if (remain < 1)
7191 return; 7195 return;
@@ -7195,7 +7199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7195 7199
7196 part.Material = Convert.ToByte(mat); 7200 part.Material = Convert.ToByte(mat);
7197 break; 7201 break;
7198 7202
7199 case (int)ScriptBaseClass.PRIM_PHANTOM: 7203 case (int)ScriptBaseClass.PRIM_PHANTOM:
7200 if (remain < 1) 7204 if (remain < 1)
7201 return; 7205 return;
@@ -7210,7 +7214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7210 7214
7211 part.ScriptSetPhantomStatus(phantom); 7215 part.ScriptSetPhantomStatus(phantom);
7212 break; 7216 break;
7213 7217
7214 case (int)ScriptBaseClass.PRIM_PHYSICS: 7218 case (int)ScriptBaseClass.PRIM_PHYSICS:
7215 if (remain < 1) 7219 if (remain < 1)
7216 return; 7220 return;
@@ -7224,7 +7228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7224 7228
7225 part.ScriptSetPhysicsStatus(physics); 7229 part.ScriptSetPhysicsStatus(physics);
7226 break; 7230 break;
7227 7231
7228 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7232 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7229 if (remain < 1) 7233 if (remain < 1)
7230 return; 7234 return;
@@ -7350,7 +7354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7350 public LSL_Vector llGetRootPosition() 7354 public LSL_Vector llGetRootPosition()
7351 { 7355 {
7352 m_host.AddScriptLPS(1); 7356 m_host.AddScriptLPS(1);
7353 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, 7357 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
7354 m_host.ParentGroup.AbsolutePosition.Z); 7358 m_host.ParentGroup.AbsolutePosition.Z);
7355 } 7359 }
7356 7360
@@ -7444,7 +7448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7444 { 7448 {
7445 LSL_Vector lower; 7449 LSL_Vector lower;
7446 LSL_Vector upper; 7450 LSL_Vector upper;
7447 if (presence.Animator.Animations.DefaultAnimation.AnimID 7451 if (presence.Animator.Animations.DefaultAnimation.AnimID
7448 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7452 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7449 { 7453 {
7450 // This is for ground sitting avatars 7454 // This is for ground sitting avatars
@@ -7643,8 +7647,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7643 res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned 7647 res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
7644 // byte is being used to represent the entire 7648 // byte is being used to represent the entire
7645 // range of floating-point values from 1.0 7649 // range of floating-point values from 1.0
7646 // through 4.0 (which is how SL does it). 7650 // through 4.0 (which is how SL does it).
7647 7651
7648 // float radiusoffset 7652 // float radiusoffset
7649 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); 7653 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
7650 7654
@@ -7819,104 +7823,104 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7819 // Assuming silently fail means give back an empty list. Ideally, need to check this. 7823 // Assuming silently fail means give back an empty list. Ideally, need to check this.
7820 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 7824 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7821 return new LSL_List(); 7825 return new LSL_List();
7822 7826
7823 return GetPrimMediaParams(face, rules); 7827 return GetPrimMediaParams(face, rules);
7824 } 7828 }
7825 7829
7826 private LSL_List GetPrimMediaParams(int face, LSL_List rules) 7830 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
7827 { 7831 {
7828 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 7832 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7829 if (null == module) 7833 if (null == module)
7830 throw new Exception("Media on a prim functions not available"); 7834 throw new Exception("Media on a prim functions not available");
7831 7835
7832 MediaEntry me = module.GetMediaEntry(m_host, face); 7836 MediaEntry me = module.GetMediaEntry(m_host, face);
7833 7837
7834 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 7838 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
7835 if (null == me) 7839 if (null == me)
7836 return new LSL_List(); 7840 return new LSL_List();
7837 7841
7838 LSL_List res = new LSL_List(); 7842 LSL_List res = new LSL_List();
7839 7843
7840 for (int i = 0; i < rules.Length; i++) 7844 for (int i = 0; i < rules.Length; i++)
7841 { 7845 {
7842 int code = (int)rules.GetLSLIntegerItem(i); 7846 int code = (int)rules.GetLSLIntegerItem(i);
7843 7847
7844 switch (code) 7848 switch (code)
7845 { 7849 {
7846 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: 7850 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7847 // Not implemented 7851 // Not implemented
7848 res.Add(new LSL_Integer(0)); 7852 res.Add(new LSL_Integer(0));
7849 break; 7853 break;
7850 7854
7851 case ScriptBaseClass.PRIM_MEDIA_CONTROLS: 7855 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7852 if (me.Controls == MediaControls.Standard) 7856 if (me.Controls == MediaControls.Standard)
7853 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); 7857 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
7854 else 7858 else
7855 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); 7859 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
7856 break; 7860 break;
7857 7861
7858 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: 7862 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7859 res.Add(new LSL_String(me.CurrentURL)); 7863 res.Add(new LSL_String(me.CurrentURL));
7860 break; 7864 break;
7861 7865
7862 case ScriptBaseClass.PRIM_MEDIA_HOME_URL: 7866 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
7863 res.Add(new LSL_String(me.HomeURL)); 7867 res.Add(new LSL_String(me.HomeURL));
7864 break; 7868 break;
7865 7869
7866 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: 7870 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
7867 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7871 res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7868 break; 7872 break;
7869 7873
7870 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: 7874 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
7871 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7875 res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7872 break; 7876 break;
7873 7877
7874 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: 7878 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
7875 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7879 res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7876 break; 7880 break;
7877 7881
7878 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: 7882 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
7879 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7883 res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7880 break; 7884 break;
7881 7885
7882 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: 7886 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
7883 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7887 res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7884 break; 7888 break;
7885 7889
7886 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: 7890 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
7887 res.Add(new LSL_Integer(me.Width)); 7891 res.Add(new LSL_Integer(me.Width));
7888 break; 7892 break;
7889 7893
7890 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: 7894 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
7891 res.Add(new LSL_Integer(me.Height)); 7895 res.Add(new LSL_Integer(me.Height));
7892 break; 7896 break;
7893 7897
7894 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: 7898 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
7895 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); 7899 res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
7896 break; 7900 break;
7897 7901
7898 case ScriptBaseClass.PRIM_MEDIA_WHITELIST: 7902 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
7899 string[] urls = (string[])me.WhiteList.Clone(); 7903 string[] urls = (string[])me.WhiteList.Clone();
7900 7904
7901 for (int j = 0; j < urls.Length; j++) 7905 for (int j = 0; j < urls.Length; j++)
7902 urls[j] = Uri.EscapeDataString(urls[j]); 7906 urls[j] = Uri.EscapeDataString(urls[j]);
7903 7907
7904 res.Add(new LSL_String(string.Join(", ", urls))); 7908 res.Add(new LSL_String(string.Join(", ", urls)));
7905 break; 7909 break;
7906 7910
7907 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: 7911 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
7908 res.Add(new LSL_Integer((int)me.InteractPermissions)); 7912 res.Add(new LSL_Integer((int)me.InteractPermissions));
7909 break; 7913 break;
7910 7914
7911 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 7915 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
7912 res.Add(new LSL_Integer((int)me.ControlPermissions)); 7916 res.Add(new LSL_Integer((int)me.ControlPermissions));
7913 break; 7917 break;
7914 } 7918 }
7915 } 7919 }
7916 7920
7917 return res; 7921 return res;
7918 } 7922 }
7919 7923
7920 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 7924 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
7921 { 7925 {
7922 m_host.AddScriptLPS(1); 7926 m_host.AddScriptLPS(1);
@@ -7927,32 +7931,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7927 // Don't perform the media check directly 7931 // Don't perform the media check directly
7928 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 7932 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
7929 return ScriptBaseClass.LSL_STATUS_OK; 7933 return ScriptBaseClass.LSL_STATUS_OK;
7930 7934
7931 return SetPrimMediaParams(face, rules); 7935 return SetPrimMediaParams(face, rules);
7932 } 7936 }
7933 7937
7934 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 7938 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
7935 { 7939 {
7936 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 7940 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
7937 if (null == module) 7941 if (null == module)
7938 throw new Exception("Media on a prim functions not available"); 7942 throw new Exception("Media on a prim functions not available");
7939 7943
7940 MediaEntry me = module.GetMediaEntry(m_host, face); 7944 MediaEntry me = module.GetMediaEntry(m_host, face);
7941 if (null == me) 7945 if (null == me)
7942 me = new MediaEntry(); 7946 me = new MediaEntry();
7943 7947
7944 int i = 0; 7948 int i = 0;
7945 7949
7946 while (i < rules.Length - 1) 7950 while (i < rules.Length - 1)
7947 { 7951 {
7948 int code = rules.GetLSLIntegerItem(i++); 7952 int code = rules.GetLSLIntegerItem(i++);
7949 7953
7950 switch (code) 7954 switch (code)
7951 { 7955 {
7952 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: 7956 case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
7953 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false); 7957 me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
7954 break; 7958 break;
7955 7959
7956 case ScriptBaseClass.PRIM_MEDIA_CONTROLS: 7960 case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
7957 int v = rules.GetLSLIntegerItem(i++); 7961 int v = rules.GetLSLIntegerItem(i++);
7958 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v) 7962 if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
@@ -7960,47 +7964,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7960 else 7964 else
7961 me.Controls = MediaControls.Mini; 7965 me.Controls = MediaControls.Mini;
7962 break; 7966 break;
7963 7967
7964 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: 7968 case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
7965 me.CurrentURL = rules.GetLSLStringItem(i++); 7969 me.CurrentURL = rules.GetLSLStringItem(i++);
7966 break; 7970 break;
7967 7971
7968 case ScriptBaseClass.PRIM_MEDIA_HOME_URL: 7972 case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
7969 me.HomeURL = rules.GetLSLStringItem(i++); 7973 me.HomeURL = rules.GetLSLStringItem(i++);
7970 break; 7974 break;
7971 7975
7972 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: 7976 case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
7973 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 7977 me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7974 break; 7978 break;
7975 7979
7976 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: 7980 case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
7977 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 7981 me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7978 break; 7982 break;
7979 7983
7980 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: 7984 case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
7981 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 7985 me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7982 break; 7986 break;
7983 7987
7984 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: 7988 case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
7985 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 7989 me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7986 break; 7990 break;
7987 7991
7988 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: 7992 case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
7989 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 7993 me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
7990 break; 7994 break;
7991 7995
7992 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: 7996 case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
7993 me.Width = (int)rules.GetLSLIntegerItem(i++); 7997 me.Width = (int)rules.GetLSLIntegerItem(i++);
7994 break; 7998 break;
7995 7999
7996 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: 8000 case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
7997 me.Height = (int)rules.GetLSLIntegerItem(i++); 8001 me.Height = (int)rules.GetLSLIntegerItem(i++);
7998 break; 8002 break;
7999 8003
8000 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: 8004 case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
8001 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); 8005 me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
8002 break; 8006 break;
8003 8007
8004 case ScriptBaseClass.PRIM_MEDIA_WHITELIST: 8008 case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
8005 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' }); 8009 string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
8006 List<string> whiteListUrls = new List<string>(); 8010 List<string> whiteListUrls = new List<string>();
@@ -8008,22 +8012,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8008 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); }); 8012 rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
8009 me.WhiteList = whiteListUrls.ToArray(); 8013 me.WhiteList = whiteListUrls.ToArray();
8010 break; 8014 break;
8011 8015
8012 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: 8016 case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
8013 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8017 me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8014 break; 8018 break;
8015 8019
8016 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8020 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8017 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8021 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8018 break; 8022 break;
8019 } 8023 }
8020 } 8024 }
8021 8025
8022 module.SetMediaEntry(m_host, face, me); 8026 module.SetMediaEntry(m_host, face, me);
8023 8027
8024 return ScriptBaseClass.LSL_STATUS_OK; 8028 return ScriptBaseClass.LSL_STATUS_OK;
8025 } 8029 }
8026 8030
8027 public LSL_Integer llClearPrimMedia(LSL_Integer face) 8031 public LSL_Integer llClearPrimMedia(LSL_Integer face)
8028 { 8032 {
8029 m_host.AddScriptLPS(1); 8033 m_host.AddScriptLPS(1);
@@ -8034,16 +8038,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8034 // FIXME: Don't perform the media check directly 8038 // FIXME: Don't perform the media check directly
8035 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8039 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8036 return ScriptBaseClass.LSL_STATUS_OK; 8040 return ScriptBaseClass.LSL_STATUS_OK;
8037 8041
8038 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8042 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8039 if (null == module) 8043 if (null == module)
8040 throw new Exception("Media on a prim functions not available"); 8044 throw new Exception("Media on a prim functions not available");
8041 8045
8042 module.ClearMediaEntry(m_host, face); 8046 module.ClearMediaEntry(m_host, face);
8043 8047
8044 return ScriptBaseClass.LSL_STATUS_OK; 8048 return ScriptBaseClass.LSL_STATUS_OK;
8045 } 8049 }
8046 8050
8047 // <remarks> 8051 // <remarks>
8048 // <para> 8052 // <para>
8049 // The .NET definition of base 64 is: 8053 // The .NET definition of base 64 is:
@@ -8303,7 +8307,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8303 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) 8307 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
8304 { 8308 {
8305 m_host.AddScriptLPS(1); 8309 m_host.AddScriptLPS(1);
8306 8310
8307 if (m_UrlModule != null) 8311 if (m_UrlModule != null)
8308 return m_UrlModule.GetHttpHeader(new UUID(request_id), header); 8312 return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
8309 return String.Empty; 8313 return String.Empty;
@@ -8492,19 +8496,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8492 8496
8493 return tokens; 8497 return tokens;
8494 } 8498 }
8495 8499
8496 public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers) 8500 public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers)
8497 { 8501 {
8498 m_host.AddScriptLPS(1); 8502 m_host.AddScriptLPS(1);
8499 return this.ParseString(src, separators, spacers, false); 8503 return this.ParseString(src, separators, spacers, false);
8500 } 8504 }
8501 8505
8502 public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) 8506 public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
8503 { 8507 {
8504 m_host.AddScriptLPS(1); 8508 m_host.AddScriptLPS(1);
8505 return this.ParseString(src, separators, spacers, true); 8509 return this.ParseString(src, separators, spacers, true);
8506 } 8510 }
8507 8511
8508 public LSL_Integer llGetObjectPermMask(int mask) 8512 public LSL_Integer llGetObjectPermMask(int mask)
8509 { 8513 {
8510 m_host.AddScriptLPS(1); 8514 m_host.AddScriptLPS(1);