Added delay for llSetPrimitiveParams() and llSetLinkPrimitiveParams() functions per the LSL wiki.

Signed-off-by: Melanie <melanie@t-data.com>

This patch also fixes a large amount of trailing whitespace. While this is
beneficial, it should really be in a separate patch that fixes whitespace only.
Just good practice.
viewer-2-initial-appearance
Kevin Cozens 2010-09-24 10:26:53 -04:00 committed by Melanie
parent acd5bbdb71
commit 8dc59f5b59
1 changed files with 104 additions and 100 deletions

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -252,9 +252,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_OTHERS: case ScriptBaseClass.LINK_ALL_OTHERS:
if (m_host.ParentGroup == null) if (m_host.ParentGroup == null)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host)) if (ret.Contains(m_host))
ret.Remove(m_host); ret.Remove(m_host);
return ret; return ret;
@ -262,9 +262,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_CHILDREN: case ScriptBaseClass.LINK_ALL_CHILDREN:
if (m_host.ParentGroup == null) if (m_host.ParentGroup == null)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host.ParentGroup.RootPart)) if (ret.Contains(m_host.ParentGroup.RootPart))
ret.Remove(m_host.ParentGroup.RootPart); ret.Remove(m_host.ParentGroup.RootPart);
return ret; return ret;
@ -1404,7 +1404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES; face = SceneObjectPart.ALL_SIDES;
m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
} }
@ -2039,7 +2039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type //KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; // part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
// So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
// is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
// It's perfectly okay when the object is not an active physical body though. // It's perfectly okay when the object is not an active physical body though.
@ -4009,7 +4009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case 1: // DATA_ONLINE (0|1) case 1: // DATA_ONLINE (0|1)
if (pinfo != null && pinfo.RegionID != UUID.Zero) if (pinfo != null && pinfo.RegionID != UUID.Zero)
reply = "1"; reply = "1";
else else
reply = "0"; reply = "0";
break; break;
case 2: // DATA_NAME (First Last) case 2: // DATA_NAME (First Last)
@ -4202,7 +4202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return currentAnimationState; return currentAnimationState;
} }
} }
return String.Empty; return String.Empty;
} }
@ -4317,7 +4317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
// Need provisions for Group Owned here // Need provisions for Group Owned here
if (m_host.OwnerID == targetlandObj.LandData.OwnerID || if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID) targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID)
{ {
pushAllowed = true; pushAllowed = true;
@ -4337,8 +4337,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject) if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject)
{ {
// Need provisions for Group Owned here // Need provisions for Group Owned here
if (m_host.OwnerID == targetlandObj.LandData.OwnerID || if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
targetlandObj.LandData.IsGroupOwned || targetlandObj.LandData.IsGroupOwned ||
m_host.OwnerID == targetID) m_host.OwnerID == targetID)
{ {
pushAllowed = true; pushAllowed = true;
@ -4463,7 +4463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return sides; return sides;
} }
/* The new / changed functions were tested with the following LSL script: /* The new / changed functions were tested with the following LSL script:
@ -5470,7 +5470,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
flags |= ScriptBaseClass.AGENT_SITTING; flags |= ScriptBaseClass.AGENT_SITTING;
} }
if (agent.Animator.Animations.DefaultAnimation.AnimID if (agent.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{ {
flags |= ScriptBaseClass.AGENT_SITTING; flags |= ScriptBaseClass.AGENT_SITTING;
@ -5837,7 +5837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return World.SimulatorFPS; return World.SimulatorFPS;
} }
/* particle system rules should be coming into this routine as doubles, that is /* particle system rules should be coming into this routine as doubles, that is
rule[0] should be an integer from this list and rule[1] should be the arg 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
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
if (rules.Length == 0) if (rules.Length == 0)
{ {
part.RemoveParticleSystem(); part.RemoveParticleSystem();
@ -6091,7 +6091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.PhysActor != null) if (m_host.PhysActor != null)
{ {
float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0));
PIDHoverType hoverType = PIDHoverType.Ground; PIDHoverType hoverType = PIDHoverType.Ground;
if (water != 0) if (water != 0)
{ {
@ -6105,7 +6105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
height += ground; height += ground;
} }
m_host.SetHoverHeight((float)height, hoverType, (float)tau); m_host.SetHoverHeight((float)height, hoverType, (float)tau);
} }
} }
@ -6487,19 +6487,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (xmlRpcRouter != null) if (xmlRpcRouter != null)
{ {
string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
xmlrpcMod.Port.ToString())); xmlrpcMod.Port.ToString()));
} }
object[] resobj = new object[] object[] resobj = new object[]
{ {
new LSL_Integer(1), new LSL_Integer(1),
new LSL_String(channelID.ToString()), new LSL_String(channelID.ToString()),
new LSL_String(UUID.Zero.ToString()), new LSL_String(UUID.Zero.ToString()),
new LSL_String(String.Empty), new LSL_String(String.Empty),
new LSL_Integer(0), new LSL_Integer(0),
new LSL_String(String.Empty) new LSL_String(String.Empty)
}; };
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
new DetectParams[0])); new DetectParams[0]));
@ -6874,6 +6874,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
SetPrimParams(m_host, rules); SetPrimParams(m_host, rules);
ScriptSleep(200);
} }
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
@ -6884,6 +6886,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
foreach (SceneObjectPart part in parts) foreach (SceneObjectPart part in parts)
SetPrimParams(part, rules); SetPrimParams(part, rules);
ScriptSleep(200);
} }
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@ -7041,7 +7045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 0); revolutions, radiusoffset, skew, 0);
break; break;
@ -7061,7 +7065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 1); revolutions, radiusoffset, skew, 1);
break; break;
@ -7081,7 +7085,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 3); revolutions, radiusoffset, skew, 3);
break; break;
@ -7127,7 +7131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetAlpha(part, alpha, face); SetAlpha(part, alpha, face);
break; break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE: case (int)ScriptBaseClass.PRIM_FLEXIBLE:
if (remain < 7) if (remain < 7)
return; return;
@ -7143,7 +7147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
break; break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT: case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
if (remain < 5) if (remain < 5)
return; return;
@ -7156,7 +7160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetPointLight(part, light, lightcolor, intensity, radius, falloff); SetPointLight(part, light, lightcolor, intensity, radius, falloff);
break; break;
case (int)ScriptBaseClass.PRIM_GLOW: case (int)ScriptBaseClass.PRIM_GLOW:
if (remain < 2) if (remain < 2)
return; return;
@ -7166,7 +7170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetGlow(part, face, glow); SetGlow(part, face, glow);
break; break;
case (int)ScriptBaseClass.PRIM_BUMP_SHINY: case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
if (remain < 3) if (remain < 3)
return; return;
@ -7177,7 +7181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetShiny(part, face, shiny, bump); SetShiny(part, face, shiny, bump);
break; break;
case (int)ScriptBaseClass.PRIM_FULLBRIGHT: case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
if (remain < 2) if (remain < 2)
return; return;
@ -7185,7 +7189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool st = rules.GetLSLIntegerItem(idx++); bool st = rules.GetLSLIntegerItem(idx++);
SetFullBright(part, face , st); SetFullBright(part, face , st);
break; break;
case (int)ScriptBaseClass.PRIM_MATERIAL: case (int)ScriptBaseClass.PRIM_MATERIAL:
if (remain < 1) if (remain < 1)
return; return;
@ -7195,7 +7199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.Material = Convert.ToByte(mat); part.Material = Convert.ToByte(mat);
break; break;
case (int)ScriptBaseClass.PRIM_PHANTOM: case (int)ScriptBaseClass.PRIM_PHANTOM:
if (remain < 1) if (remain < 1)
return; return;
@ -7210,7 +7214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.ScriptSetPhantomStatus(phantom); part.ScriptSetPhantomStatus(phantom);
break; break;
case (int)ScriptBaseClass.PRIM_PHYSICS: case (int)ScriptBaseClass.PRIM_PHYSICS:
if (remain < 1) if (remain < 1)
return; return;
@ -7224,7 +7228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.ScriptSetPhysicsStatus(physics); part.ScriptSetPhysicsStatus(physics);
break; break;
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
if (remain < 1) if (remain < 1)
return; return;
@ -7350,7 +7354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetRootPosition() public LSL_Vector llGetRootPosition()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
m_host.ParentGroup.AbsolutePosition.Z); m_host.ParentGroup.AbsolutePosition.Z);
} }
@ -7444,7 +7448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
LSL_Vector lower; LSL_Vector lower;
LSL_Vector upper; LSL_Vector upper;
if (presence.Animator.Animations.DefaultAnimation.AnimID if (presence.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{ {
// This is for ground sitting avatars // This is for ground sitting avatars
@ -7643,8 +7647,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
// byte is being used to represent the entire // byte is being used to represent the entire
// range of floating-point values from 1.0 // range of floating-point values from 1.0
// through 4.0 (which is how SL does it). // through 4.0 (which is how SL does it).
// float radiusoffset // float radiusoffset
res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
@ -7819,104 +7823,104 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Assuming silently fail means give back an empty list. Ideally, need to check this. // Assuming silently fail means give back an empty list. Ideally, need to check this.
if (face < 0 || face > m_host.GetNumberOfSides() - 1) if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return new LSL_List(); return new LSL_List();
return GetPrimMediaParams(face, rules); return GetPrimMediaParams(face, rules);
} }
private LSL_List GetPrimMediaParams(int face, LSL_List rules) private LSL_List GetPrimMediaParams(int face, LSL_List rules)
{ {
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module) if (null == module)
throw new Exception("Media on a prim functions not available"); throw new Exception("Media on a prim functions not available");
MediaEntry me = module.GetMediaEntry(m_host, face); MediaEntry me = module.GetMediaEntry(m_host, face);
// As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
if (null == me) if (null == me)
return new LSL_List(); return new LSL_List();
LSL_List res = new LSL_List(); LSL_List res = new LSL_List();
for (int i = 0; i < rules.Length; i++) for (int i = 0; i < rules.Length; i++)
{ {
int code = (int)rules.GetLSLIntegerItem(i); int code = (int)rules.GetLSLIntegerItem(i);
switch (code) switch (code)
{ {
case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
// Not implemented // Not implemented
res.Add(new LSL_Integer(0)); res.Add(new LSL_Integer(0));
break; break;
case ScriptBaseClass.PRIM_MEDIA_CONTROLS: case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
if (me.Controls == MediaControls.Standard) if (me.Controls == MediaControls.Standard)
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD));
else else
res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI));
break; break;
case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
res.Add(new LSL_String(me.CurrentURL)); res.Add(new LSL_String(me.CurrentURL));
break; break;
case ScriptBaseClass.PRIM_MEDIA_HOME_URL: case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
res.Add(new LSL_String(me.HomeURL)); res.Add(new LSL_String(me.HomeURL));
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
res.Add(new LSL_Integer(me.Width)); res.Add(new LSL_Integer(me.Width));
break; break;
case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
res.Add(new LSL_Integer(me.Height)); res.Add(new LSL_Integer(me.Height));
break; break;
case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE);
break; break;
case ScriptBaseClass.PRIM_MEDIA_WHITELIST: case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
string[] urls = (string[])me.WhiteList.Clone(); string[] urls = (string[])me.WhiteList.Clone();
for (int j = 0; j < urls.Length; j++) for (int j = 0; j < urls.Length; j++)
urls[j] = Uri.EscapeDataString(urls[j]); urls[j] = Uri.EscapeDataString(urls[j]);
res.Add(new LSL_String(string.Join(", ", urls))); res.Add(new LSL_String(string.Join(", ", urls)));
break; break;
case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
res.Add(new LSL_Integer((int)me.InteractPermissions)); res.Add(new LSL_Integer((int)me.InteractPermissions));
break; break;
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
res.Add(new LSL_Integer((int)me.ControlPermissions)); res.Add(new LSL_Integer((int)me.ControlPermissions));
break; break;
} }
} }
return res; return res;
} }
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -7927,32 +7931,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Don't perform the media check directly // Don't perform the media check directly
if (face < 0 || face > m_host.GetNumberOfSides() - 1) if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_OK; return ScriptBaseClass.LSL_STATUS_OK;
return SetPrimMediaParams(face, rules); return SetPrimMediaParams(face, rules);
} }
private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
{ {
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module) if (null == module)
throw new Exception("Media on a prim functions not available"); throw new Exception("Media on a prim functions not available");
MediaEntry me = module.GetMediaEntry(m_host, face); MediaEntry me = module.GetMediaEntry(m_host, face);
if (null == me) if (null == me)
me = new MediaEntry(); me = new MediaEntry();
int i = 0; int i = 0;
while (i < rules.Length - 1) while (i < rules.Length - 1)
{ {
int code = rules.GetLSLIntegerItem(i++); int code = rules.GetLSLIntegerItem(i++);
switch (code) switch (code)
{ {
case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE:
me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false); me.EnableAlterntiveImage = (rules.GetLSLIntegerItem(i++) != 0 ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_CONTROLS: case ScriptBaseClass.PRIM_MEDIA_CONTROLS:
int v = rules.GetLSLIntegerItem(i++); int v = rules.GetLSLIntegerItem(i++);
if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v) if (ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD == v)
@ -7960,47 +7964,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
me.Controls = MediaControls.Mini; me.Controls = MediaControls.Mini;
break; break;
case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL:
me.CurrentURL = rules.GetLSLStringItem(i++); me.CurrentURL = rules.GetLSLStringItem(i++);
break; break;
case ScriptBaseClass.PRIM_MEDIA_HOME_URL: case ScriptBaseClass.PRIM_MEDIA_HOME_URL:
me.HomeURL = rules.GetLSLStringItem(i++); me.HomeURL = rules.GetLSLStringItem(i++);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP:
me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.AutoLoop = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY:
me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.AutoPlay = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE:
me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.AutoScale = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM:
me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.AutoZoom = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT:
me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.InteractOnFirstClick = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS:
me.Width = (int)rules.GetLSLIntegerItem(i++); me.Width = (int)rules.GetLSLIntegerItem(i++);
break; break;
case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS:
me.Height = (int)rules.GetLSLIntegerItem(i++); me.Height = (int)rules.GetLSLIntegerItem(i++);
break; break;
case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE:
me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false); me.EnableWhiteList = (ScriptBaseClass.TRUE == rules.GetLSLIntegerItem(i++) ? true : false);
break; break;
case ScriptBaseClass.PRIM_MEDIA_WHITELIST: case ScriptBaseClass.PRIM_MEDIA_WHITELIST:
string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' }); string[] rawWhiteListUrls = rules.GetLSLStringItem(i++).ToString().Split(new char[] { ',' });
List<string> whiteListUrls = new List<string>(); List<string> whiteListUrls = new List<string>();
@ -8008,22 +8012,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); }); rawWhiteListUrls, delegate(string rawUrl) { whiteListUrls.Add(rawUrl.Trim()); });
me.WhiteList = whiteListUrls.ToArray(); me.WhiteList = whiteListUrls.ToArray();
break; break;
case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT:
me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); me.InteractPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
break; break;
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
break; break;
} }
} }
module.SetMediaEntry(m_host, face, me); module.SetMediaEntry(m_host, face, me);
return ScriptBaseClass.LSL_STATUS_OK; return ScriptBaseClass.LSL_STATUS_OK;
} }
public LSL_Integer llClearPrimMedia(LSL_Integer face) public LSL_Integer llClearPrimMedia(LSL_Integer face)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -8034,16 +8038,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// FIXME: Don't perform the media check directly // FIXME: Don't perform the media check directly
if (face < 0 || face > m_host.GetNumberOfSides() - 1) if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_OK; return ScriptBaseClass.LSL_STATUS_OK;
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
if (null == module) if (null == module)
throw new Exception("Media on a prim functions not available"); throw new Exception("Media on a prim functions not available");
module.ClearMediaEntry(m_host, face); module.ClearMediaEntry(m_host, face);
return ScriptBaseClass.LSL_STATUS_OK; return ScriptBaseClass.LSL_STATUS_OK;
} }
// <remarks> // <remarks>
// <para> // <para>
// The .NET definition of base 64 is: // The .NET definition of base 64 is:
@ -8303,7 +8307,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_UrlModule != null) if (m_UrlModule != null)
return m_UrlModule.GetHttpHeader(new UUID(request_id), header); return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
return String.Empty; return String.Empty;
@ -8492,19 +8496,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return tokens; return tokens;
} }
public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers) public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return this.ParseString(src, separators, spacers, false); return this.ParseString(src, separators, spacers, false);
} }
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return this.ParseString(src, separators, spacers, true); return this.ParseString(src, separators, spacers, true);
} }
public LSL_Integer llGetObjectPermMask(int mask) public LSL_Integer llGetObjectPermMask(int mask)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);