Formatting cleanup.

This commit is contained in:
Jeff Ames
2008-08-18 00:39:10 +00:00
parent 531f6c01eb
commit 6ef9d4da90
208 changed files with 2980 additions and 3163 deletions

View File

@@ -348,23 +348,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting
vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis.
*/
/* How we arrived at this llEuler2Rot
*
*
* Experiment in SL to determine conventions:
* llEuler2Rot(<PI,0,0>)=<1,0,0,0>
* llEuler2Rot(<0,PI,0>)=<0,1,0,0>
* llEuler2Rot(<0,0,PI>)=<0,0,1,0>
*
*
* Important facts about Quaternions
* - multiplication is non-commutative (a*b != b*a)
* - http://en.wikipedia.org/wiki/Quaternion#Basis_multiplication
*
*
* Above SL experiment gives (c1,c2,c3,s1,s2,s3 as defined in our llEuler2Rot):
* Qx = c1+i*s1
* Qy = c2+j*s2;
* Qz = c3+k*s3;
*
*
* Rotations applied in order (from above) Z, Y, X
* Q = (Qz * Qy) * Qx
* ((c1+i*s1)*(c2+j*s2))*(c3+k*s3)
@@ -376,23 +376,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
* y=j*(c1*s2*c3-s1*c2*s3)
* z=k*(s1*s2*c3+c1*c2*s3)
* s= c1*c2*c3-s1*s2*s3
*
*
* This implementation agrees with the functions found here:
* http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions
* And with the results in SL.
*
*
* It's also possible to calculate llEuler2Rot by direct multiplication of
* the Qz, Qy, and Qx vectors (as above - and done in the "accurate" function
* from the wiki).
* Apparently in some cases this is better from a numerical precision perspective?
*/
* from the wiki).
* Apparently in some cases this is better from a numerical precision perspective?
*/
public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
{
m_host.AddScriptLPS(1);
double x,y,z,s;
double c1 = Math.Cos(v.x/2.0);
double c2 = Math.Cos(v.y/2.0);
double c3 = Math.Cos(v.z/2.0);
@@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
y = c1*s2*c3-s1*c2*s3;
z = s1*s2*c3+c1*c2*s3;
s = c1*c2*c3-s1*s2*s3;
return new LSL_Types.Quaternion(x, y, z, s);
}
@@ -414,7 +414,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
double x, y, z, s;
int f = 0;
// Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s>
// Computing quaternion x,y,z,s values
// Computing quaternion x,y,z,s values
x = ((fwd.x - left.y - up.z + 1) / 4);
x *= x;
x = Math.Sqrt(Math.Sqrt(x));
@@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
s *= s;
s = Math.Sqrt(Math.Sqrt(s));
// Set f for signs detection
// Set f for signs detection
if (fwd.y + left.x >= 0) { f += 1; }
if (fwd.z + up.x >= 0) { f += 2; }
if (left.z - up.y >= 0) { f += 4; }
@@ -1013,9 +1013,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
}
public void SetGlow(SceneObjectPart part, int face, float glow)
{
public void SetGlow(SceneObjectPart part, int face, float glow)
{
LLObject.TextureEntry tex = part.Shape.Textures;
if (face > -1)
{
@@ -1023,7 +1023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.FaceTextures[face].Glow = glow;
part.UpdateTexture(tex);
return;
}
}
else if (face == -1)
{
for (uint i = 0; i < 32; i++)
@@ -1038,15 +1038,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
}
public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
{
Shininess sval = new Shininess();
switch (shiny)
{
case 0:
case 0:
sval = Shininess.None;
break;
case 1:
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sval = Shininess.None;
break;
}
LLObject.TextureEntry tex = part.Shape.Textures;
if (face > -1)
{
@@ -1070,8 +1070,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.FaceTextures[face].Shiny = sval;
tex.FaceTextures[face].Bump = bump;
part.UpdateTexture(tex);
return;
}
return;
}
else if (face == -1)
{
for (uint i = 0; i < 32; i++)
@@ -1088,8 +1088,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
}
public void SetFullBright(SceneObjectPart part, int face, bool bright)
public void SetFullBright(SceneObjectPart part, int face, bool bright)
{
LLObject.TextureEntry tex = part.Shape.Textures;
if (face > -1)
@@ -1106,14 +1106,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].Fullbright = bright;
}
}
}
tex.DefaultTexture.Fullbright = bright;
part.UpdateTexture(tex);
return;
}
}
public double llGetAlpha(int face)
{
m_host.AddScriptLPS(1);
@@ -1169,7 +1169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary>
/// Set flexi parameters of a part.
///
///
/// FIXME: Much of this code should probably be within the part itself.
/// </summary>
/// <param name="part"></param>
@@ -1179,7 +1179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <param name="friction"></param>
/// <param name="wind"></param>
/// <param name="tension"></param>
/// <param name="Force"></param>
/// <param name="Force"></param>
private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
float wind, float tension, LSL_Types.Vector3 Force)
{
@@ -1230,7 +1230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary>
/// Set a light point on a part
///
///
/// FIXME: Much of this code should probably be in SceneObjectGroup
/// </summary>
/// <param name="part"></param>
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <param name="color"></param>
/// <param name="intensity"></param>
/// <param name="radius"></param>
/// <param name="falloff"></param>
/// <param name="falloff"></param>
private void SetPointLight(SceneObjectPart part, bool light, LSL_Types.Vector3 color, float intensity, float radius, float falloff)
{
if (part == null)
@@ -2880,13 +2880,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool found = false;
LLUUID destId = LLUUID.Zero;
LLUUID objId = LLUUID.Zero;
if (!LLUUID.TryParse(destination, out destId))
{
llSay(0, "Could not parse key " + destination);
return;
}
// move the first object found with this inventory name
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
@@ -4451,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private Primitive.ParticleSystem getNewParticleSystemWithSLDefaultValues()
{
Primitive.ParticleSystem ps = new Primitive.ParticleSystem();
// TODO find out about the other defaults and add them here
ps.PartStartColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f);
ps.PartEndColor = new LLColor(1.0f, 1.0f, 1.0f, 1.0f);
@@ -4465,7 +4465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ps.PartMaxAge = 10.0f;
return ps;
}
public void llParticleSystem(LSL_Types.list rules)
{
m_host.AddScriptLPS(1);
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
itemList.Add(itemID);
}
}
if (itemList.Count == 0)
return;
@@ -4936,11 +4936,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
return Util.Md5Hash(src + ":" + nonce.ToString());
}
private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE &&
@@ -4998,23 +4998,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x);
shapeBlock.PathTwist = (sbyte)(200 * twist.y);
shapeBlock.ObjectLocalID = m_host.LocalId;
// retain pathcurve
shapeBlock.PathCurve = m_host.Shape.PathCurve;
shapeBlock.PathCurve = m_host.Shape.PathCurve;
return shapeBlock;
}
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge)
{
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist);
shapeBlock.ProfileCurve += fudge;
if (taper_b.x < 0f)
{
taper_b.x = 0f;
@@ -5051,25 +5051,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
shapeBlock.PathShearX = (byte)(100 * topshear.x);
shapeBlock.PathShearY = (byte)(100 * topshear.y);
m_host.UpdateShape(shapeBlock);
}
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge)
{
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist);
// profile/path swapped for a sphere
shapeBlock.PathBegin = shapeBlock.ProfileBegin;
shapeBlock.PathEnd = shapeBlock.ProfileEnd;
shapeBlock.ProfileCurve += fudge;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 100;
if (dimple.x < 0f)
{
dimple.x = 0f;
@@ -5092,22 +5092,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
m_host.UpdateShape(shapeBlock);
}
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
{
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist);
shapeBlock.ProfileCurve += fudge;
// profile/path swapped for a torrus, tube, ring
shapeBlock.PathBegin = shapeBlock.ProfileBegin;
shapeBlock.PathEnd = shapeBlock.ProfileEnd;
if (holesize.x < 0.05f)
{
holesize.x = 0.05f;
@@ -5212,15 +5212,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
skew = 0.95f;
}
shapeBlock.PathSkew = (sbyte)(100 * skew);
m_host.UpdateShape(shapeBlock);
}
private void SetPrimitiveShapeParams(string map, int type)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
LLUUID sculptId;
if (!LLUUID.TryParse(map, out sculptId))
{
llSay(0, "Could not parse key " + map);
@@ -5230,7 +5230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.ObjectLocalID = m_host.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER &&
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE &&
@@ -5239,7 +5239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// default
type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
// retain pathcurve
shapeBlock.PathCurve = m_host.Shape.PathCurve;
@@ -5256,7 +5256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules)
{
m_host.AddScriptLPS(1);
if (m_host.ParentGroup == null)
return;
@@ -5302,13 +5302,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetRot(part, q);
break;
case (int)ScriptBaseClass.PRIM_TYPE:
if (remain < 3)
return;
code = Convert.ToInt32(rules.Data[idx++]);
remain = rules.Length - idx;
float hollow;
LSL_Types.Vector3 twist;
@@ -5319,9 +5319,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float skew;
LSL_Types.Vector3 holesize;
LSL_Types.Vector3 profilecut;
switch (code)
{
{
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
if (remain < 6)
return;
@@ -5335,7 +5335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Straight;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1);
break;
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
if (remain < 6)
return;
@@ -5350,12 +5350,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Straight;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0);
break;
case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
if (remain < 6)
return;
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut
hollow = (float)Convert.ToDouble(rules.Data[idx++]);
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
@@ -5377,12 +5377,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5);
break;
case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
if (remain < 11)
return;
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut
hollow = (float)Convert.ToDouble(rules.Data[idx++]);
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
@@ -5396,12 +5396,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0);
break;
case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
if (remain < 11)
return;
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut
hollow = (float)Convert.ToDouble(rules.Data[idx++]);
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
@@ -5415,12 +5415,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1);
break;
case (int)ScriptBaseClass.PRIM_TYPE_RING:
if (remain < 11)
return;
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
face = Convert.ToInt32(rules.Data[idx++]); // holeshape
v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut
hollow = (float)Convert.ToDouble(rules.Data[idx++]);
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
@@ -5434,7 +5434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Shape.PathCurve = (byte) Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3);
break;
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
if (remain < 2)
return;
@@ -5445,7 +5445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetPrimitiveShapeParams(map, face);
break;
}
break;
case (int)ScriptBaseClass.PRIM_TEXTURE:
@@ -5509,31 +5509,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
face = Convert.ToInt32(rules.Data[idx++]);
float glow = (float)Convert.ToDouble(rules.Data[idx++]);
SetGlow(part, face, glow);
break;
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
if (remain < 3)
return;
return;
face = Convert.ToInt32(rules.Data[idx++]);
int shiny = Convert.ToInt32(rules.Data[idx++]);
Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]);
SetShiny(part, face, shiny, bump);
break;
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
if (remain < 2)
return;
face = Convert.ToInt32(rules.Data[idx++]);
face = Convert.ToInt32(rules.Data[idx++]);
string bv = rules.Data[idx++].ToString();
bool st;
if (bv.Equals("1"))
st = true;
else
st = false;
SetFullBright(part, face , st);
break;
case (int)ScriptBaseClass.PRIM_MATERIAL:
@@ -5552,29 +5552,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_PHANTOM:
if (remain < 1)
return;
string ph = rules.Data[idx++].ToString();
bool phantom;
if (ph.Equals("1"))
phantom = true;
else
phantom = false;
part.ScriptSetPhantomStatus(phantom);
part.ScheduleFullUpdate();
break;
case (int)ScriptBaseClass.PRIM_PHYSICS:
if (remain < 1)
return;
return;
string phy = rules.Data[idx++].ToString();
bool physics;
if (phy.Equals("1"))
physics = true;
else
physics = false;
m_host.ScriptSetPhysicsStatus(physics);
part.ScheduleFullUpdate();
break;
@@ -5645,7 +5645,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Types.list llGetAnimationList( string id )
{
m_host.AddScriptLPS(1);
LSL_Types.list l = new LSL_Types.list();
ScenePresence av = World.GetScenePresence(id);
if (av == null)
@@ -6758,7 +6758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
m_host.AddScriptLPS(1);
for (int i = 0; i < commandList.Data.Length; i++)
{
{
switch ((ParcelMediaCommandEnum)commandList.Data[i])
{
case ParcelMediaCommandEnum.Play:
@@ -6768,7 +6768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!agent.IsChildAgent)
{
agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0);
}
}
}
break;
case ParcelMediaCommandEnum.Stop:
@@ -6799,7 +6799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
//Set the new media URL only if the user is the owner of the land
osSetParcelMediaURL(commandList.Data[i + 1].ToString());
List<ScenePresence> scenePresenceList = World.GetScenePresences();
LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
//Send an update of the mediaURL to all the clients that are in the parcel
@@ -6810,8 +6810,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//Send parcel media update to the client
agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1);
}
}
}
}
i++;
}
@@ -6821,7 +6821,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString());
break;
}//end switch
}
@@ -6864,7 +6864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
return list;
}
public LSL_Types.LSLInteger llModPow(int a, int b, int c)
@@ -6908,7 +6908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
LLUUID invItemID=InventorySelf();
if (invItemID == LLUUID.Zero)
if (invItemID == LLUUID.Zero)
return new LSL_Types.Vector3();
if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
return new LSL_Types.Vector3();
@@ -7036,8 +7036,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraParams(LSL_Types.list rules)
{
m_host.AddScriptLPS(1);
// our key in the object we are in
// our key in the object we are in
LLUUID invItemID=InventorySelf();
if (invItemID == LLUUID.Zero) return;
@@ -7051,10 +7051,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
ScenePresence presence = World.GetScenePresence(agentID);
// we are not interested in child-agents
if (presence.IsChildAgent) return;
SortedDictionary<int, float> parameters = new SortedDictionary<int, float>();
object[] data = rules.Data;
for (int i = 0; i < data.Length; ++i) {
@@ -7067,8 +7067,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
case ScriptBaseClass.CAMERA_POSITION:
LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i];
parameters.Add(type + 1, (float)v.x);
parameters.Add(type + 2, (float)v.y);
parameters.Add(type + 1, (float)v.x);
parameters.Add(type + 2, (float)v.y);
parameters.Add(type + 3, (float)v.z);
break;
default:
@@ -7088,7 +7088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
// our key in the object we are in
// our key in the object we are in
LLUUID invItemID=InventorySelf();
if (invItemID == LLUUID.Zero) return;
@@ -7102,10 +7102,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
ScenePresence presence = World.GetScenePresence(agentID);
// we are not interested in child-agents
if (presence.IsChildAgent) return;
presence.ControllingClient.SendClearFollowCamProperties(objectID);
}

View File

@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
if (!DataserverRequests.ContainsKey(identifier))
return;
ds=DataserverRequests[identifier];
DataserverRequests.Remove(identifier);
}

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
new LSL_Types.LSLInteger(rInfo.GetIntValue()),
new LSL_Types.LSLString(rInfo.GetStrVal())
};
foreach (AsyncCommandManager m in m_CmdManager.Managers)
{
if (m.m_ScriptEngine.PostScriptEvent(

View File

@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return;
MethodInfo mi = inits[api];
Object[] args = new Object[1];
args[0] = data;

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
_arity = arity;
}
/// <summary>
/// Append the answer to the list and update the indexes, if any.
/// Elements of answer must be ground, since arguments with unbound variables make this

View File

@@ -1,20 +1,20 @@
/*
* Copyright (C) 2007-2008, Jeff Thompson
*
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* * Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding.
/// </summary>
/// <param name="ErrorTerm">the error term of the error</param>
/// <param name="Messsage">the message term of the error. If this is a string, it is converted to an
/// <param name="Messsage">the message term of the error. If this is a string, it is converted to an
/// Atom so it can be used by Prolog code.
/// Message, converted to a string, is use as the printable exception message.
/// </param>
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
_term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore());
}
public class TypeErrorInfo
public class TypeErrorInfo
{
public readonly Atom _Type;
public readonly object _Culprit;
@@ -116,14 +116,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// <returns></returns>
public object getProcedureName()
{
if (!(_Type._name == "procedure" &&
if (!(_Type._name == "procedure" &&
_Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH))
return null;
return ((Functor2)_Culprit)._arg1;
}
/// <summary>
/// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity.
/// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity.
/// Otherwise return -1.
/// </summary>
/// <returns></returns>

View File

@@ -1,20 +1,20 @@
/*
* Copyright (C) 2007-2008, Jeff Thompson
*
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* * Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// <summary>
/// Convert term to an int.
/// If term is a single-element List, use its first element
/// (to handle the char types like "a").
/// (to handle the char types like "a").
/// If can't convert, throw a PrologException for type_error evaluable (because this is only
/// called from arithmetic functions).
/// </summary>
@@ -172,8 +172,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
throw new PrologException
(new Functor2
("type_error", Atom.a("evaluable"),
new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
("type_error", Atom.a("evaluable"),
new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
"Term must be an integer");
}
}
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// <summary>
/// Convert term to a double. This may convert an int to a double, etc.
/// If term is a single-element List, use its first element
/// (to handle the char types like "a").
/// (to handle the char types like "a").
/// If can't convert, throw a PrologException for type_error evaluable (because this is only
/// called from arithmetic functions).
/// </summary>
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// Assume it is a char type like "a".
term = YP.getValue(((Functor2)term)._arg1);
if (term is Variable)
throw new PrologException(Atom.a("instantiation_error"),
throw new PrologException(Atom.a("instantiation_error"),
"Expected a number but the argument is an unbound variable");
try
@@ -776,8 +776,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (term1TypeCode == -2)
{
// Variable.
// We always check for equality first because we want to be sure
// that less than returns false if the terms are equal, in
// We always check for equality first because we want to be sure
// that less than returns false if the terms are equal, in
// case that the less than check really behaves like less than or equal.
if ((Variable)Term1 != (Variable)Term2)
// The hash code should be unique to a Variable object.
@@ -820,8 +820,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
/// <summary>
/// Type code is -2 if term is a Variable, 0 if it is an Atom,
/// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
/// Type code is -2 if term is a Variable, 0 if it is an Atom,
/// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
/// 4 if it is Functor.
/// Otherwise, type code is -1.
/// This does not call YP.getValue(term).
@@ -1167,7 +1167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
"Arg 2 List has an element which is an unbound variable");
if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1))
throw new PrologException
(new Functor2("type_error", Atom.a("character"), listAtom),
(new Functor2("type_error", Atom.a("character"), listAtom),
"Arg 2 List has an element which is not a one character atom");
charArray[i] = ((Atom)listAtom)._name[0];
}
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
int codeInt;
if (!getInt(codeArray[i], out codeInt) || codeInt < 0)
throw new PrologException
(new Functor1("representation_error", Atom.a("character_code")),
(new Functor1("representation_error", Atom.a("character_code")),
"Element of Arg 2 List is not a character code");
charArray[i] = (char)codeInt;
}
@@ -1323,7 +1323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (!YP.number(Number))
throw new PrologException
(new Functor2("type_error", Atom.a("number"), Number),
(new Functor2("type_error", Atom.a("number"), Number),
"Arg 1 Number is not var or number");
// We just checked, so convertDouble shouldn't throw an exception.
numberString = YP.doubleToString(YP.convertDouble(Number));
@@ -1413,7 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (!(Char is Atom) || ((Atom)Char)._name.Length != 1)
throw new PrologException
(new Functor2("type_error", Atom.a("character"), Char),
(new Functor2("type_error", Atom.a("character"), Char),
"Arg 1 Char is not var or one-character atom");
if (Code is Variable)
@@ -1795,7 +1795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
IndexedAnswers indexedAnswers;
if (!_predicatesStore.TryGetValue(nameArity, out clauses))
{
// Create an IndexedAnswers as the only clause of the predicate.
// Create an IndexedAnswers as the only clause of the predicate.
_predicatesStore[nameArity] = (clauses = new List<IClause>());
clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
}
@@ -1826,7 +1826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
IndexedAnswers indexedAnswers;
if (!_predicatesStore.TryGetValue(nameArity, out clauses))
{
// Create an IndexedAnswers as the only clause of the predicate.
// Create an IndexedAnswers as the only clause of the predicate.
_predicatesStore[nameArity] = (clauses = new List<IClause>());
clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
}
@@ -1855,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
List<IClause> clauses;
if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses))
return unknownPredicate(name, arguments.Length,
return unknownPredicate(name, arguments.Length,
"Undefined dynamic predicate: " + name + "/" + arguments.Length);
if (clauses.Count == 1)
@@ -1889,7 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
/// <summary>
/// If _prologFlags["unknown"] is fail then return fail(), else if
/// If _prologFlags["unknown"] is fail then return fail(), else if
/// _prologFlags["unknown"] is warning then write the message to YP.write and
/// return fail(), else throw a PrologException for existence_error. .
/// </summary>
@@ -1917,7 +1917,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
/// <summary>
/// This is deprecated and just calls matchDynamic. This matches all clauses,
/// This is deprecated and just calls matchDynamic. This matches all clauses,
/// not just the ones defined with assertFact.
/// </summary>
/// <param name="name"></param>
@@ -2066,7 +2066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// dynamic predicate.
/// </summary>
/// <param name="NameSlashArity"></param>
/// <param name="declaringClass">if not null, used to resolve references to the default
/// <param name="declaringClass">if not null, used to resolve references to the default
/// module Atom.a("")</param>
/// <returns></returns>
public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass)
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor2 NameArityFunctor = NameSlashArity as Functor2;
if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH))
throw new PrologException
(new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
(new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
"Must be a name/arity predicate indicator");
object name = YP.getValue(NameArityFunctor._arg1);
object arity = YP.getValue(NameArityFunctor._arg2);
@@ -2163,12 +2163,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
/// <summary>
/// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from
/// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from
/// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error.
/// Otherwise, compile the goal as a single clause predicate and invoke it.
/// Otherwise, compile the goal as a single clause predicate and invoke it.
/// </summary>
/// <param name="Goal"></param>
/// <param name="declaringClass">if not null, used to resolve references to the default
/// <param name="declaringClass">if not null, used to resolve references to the default
/// module Atom.a("")</param>
/// <returns></returns>
public static IEnumerable<bool> getIterator(object Goal, Type declaringClass)
@@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
if (!_prologFlags.ContainsKey(((Atom)Key)._name))
throw new PrologException
(new Functor2("domain_error", Atom.a("prolog_flag"), Key),
(new Functor2("domain_error", Atom.a("prolog_flag"), Key),
"Arg 1 Key is not a recognized flag");
foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name]))
@@ -2343,7 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
string results = "";
for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch())
{
//Console.WriteLine( m );
//Console.WriteLine( m );
results += presep+ m + postsep;
}
return results;
@@ -2662,7 +2662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
#pragma warning restore 0168
}
}
/// <summary>
/// CodeListReader extends TextReader and overrides Read to read the next code from
/// the CodeList which is a Prolog list of integer character codes.
@@ -2683,7 +2683,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
/// <returns></returns>
public override int Read()
{
Functor2 CodeListPair = _CodeList as Functor2;
Functor2 CodeListPair = _CodeList as Functor2;
int code;
if (!(CodeListPair != null && CodeListPair._name == Atom.DOT &&
getInt(CodeListPair._arg1, out code)))

View File

@@ -54,11 +54,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
{
string path = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(s, assemblyName))+".dll";
if (File.Exists(path))
return Assembly.LoadFrom(path);
}
return null;
}
}

View File

@@ -412,8 +412,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
private static string CreateYPCompilerScript(string compileScript)
{
compileScript = String.Empty +
"using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
"using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +

View File

@@ -87,9 +87,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
string quote = String.Empty;
bool last_was_escape = false;
int quote_replaced_count = 0;
string removefwnoncomments = nonCommentFwsl.Replace(Script, "\"\";");
string removecomments = conelinecomments.Replace(removefwnoncomments, "");
removecomments = cstylecomments.Replace(removecomments, "");
string[] localscript = removecomments.Split('"');
@@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// checks for alpha.alpha way of referring to objects in C#
// ignores alpha.x alpha.y, alpha.z for refering to vector components
Match SecurityM;
// BROKEN: this check is very wrong. It block's any url in strings.
SecurityM = Regex.Match(checkscript, @"(?:[a-zA-Z])\.(?:[a-rt-wA-Z]|[a-zA-Z][a-zA-Z])", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);

View File

@@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
myCode = myCode.Substring(0, cs_pointer);
}
myCode.Replace("//yp", "%YPCode");
StringWriter myCS_SW = new StringWriter();
StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n");

View File

@@ -1335,22 +1335,22 @@ namespace OpenSim.Region.ScriptEngine.Shared
bool ret = i1.value != i2.value;
return ret;
}
static public LSLInteger operator +(LSLInteger i1, int i2)
{
return new LSLInteger(i1.value + i2);
}
static public LSLInteger operator -(LSLInteger i1, int i2)
{
return new LSLInteger(i1.value - i2);
}
static public LSLInteger operator *(LSLInteger i1, int i2)
{
return new LSLInteger(i1.value * i2);
}
static public LSLInteger operator /(LSLInteger i1, int i2)
{
return new LSLInteger(i1.value / i2);
@@ -1360,22 +1360,22 @@ namespace OpenSim.Region.ScriptEngine.Shared
{
return new LSLFloat((double)i1.value + f);
}
static public LSLFloat operator -(LSLInteger i1, double f)
{
return new LSLFloat((double)i1.value - f);
}
static public LSLFloat operator *(LSLInteger i1, double f)
{
return new LSLFloat((double)i1.value * f);
}
static public LSLFloat operator /(LSLInteger i1, double f)
{
return new LSLFloat((double)i1.value / f);
}
static public LSLInteger operator -(LSLInteger i)
{
return new LSLInteger(-i.value);
@@ -1536,17 +1536,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
f.value--;
return f;
}
static public LSLFloat operator +(LSLFloat f, int i)
{
return new LSLFloat(f.value + (double)i);
}
static public LSLFloat operator -(LSLFloat f, int i)
{
return new LSLFloat(f.value - (double)i);
}
static public LSLFloat operator *(LSLFloat f, int i)
{
return new LSLFloat(f.value * (double)i);