Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
This commit is contained in:
Melanie
2012-08-29 03:31:13 +01:00
21 changed files with 789 additions and 170 deletions

View File

@@ -7701,7 +7701,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules);
setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
ScriptSleep(200);
}
@@ -7710,10 +7710,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
setLinkPrimParams(linknumber, rules);
setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
ScriptSleep(200);
}
private void setLinkPrimParams(int linknumber, LSL_List rules)
private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
{
List<object> parts = new List<object>();
List<SceneObjectPart> prims = GetLinkParts(linknumber);
@@ -7724,15 +7726,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parts.Add(p);
LSL_List remaining = null;
uint rulesParsed = 0;
if (parts.Count > 0)
{
foreach (object part in parts)
{
if (part is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)part, rules);
remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
else
remaining = SetPrimParams((ScenePresence)part, rules);
remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
}
while ((object)remaining != null && remaining.Length > 2)
@@ -7750,9 +7753,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
foreach (object part in parts)
{
if (part is SceneObjectPart)
remaining = SetPrimParams((SceneObjectPart)part, rules);
remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
else
remaining = SetPrimParams((ScenePresence)part, rules);
remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
}
}
}
@@ -7790,6 +7793,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
llSetLinkPrimitiveParamsFast(linknumber, rules);
ScriptSleep(200);
}
@@ -7817,12 +7821,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new Vector3((float)x, (float)y, (float)z);
}
protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules)
protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return null;
int idx = 0;
int idxStart = 0;
SceneObjectGroup parentgrp = part.ParentGroup;
@@ -7833,9 +7838,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
int face;
LSL_Vector v;
@@ -8243,7 +8250,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
catch (InvalidCastException e)
{
ShoutError(e.Message);
ShoutError(string.Format(
"{0} error running rule #{1}: arg #{2} ",
originFunc, rulesParsed, idx - idxStart) + e.Message);
}
finally
{
@@ -11660,7 +11669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return tid.ToString();
}
public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc)
{
SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
if (obj == null)
@@ -11669,14 +11678,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (obj.OwnerID != m_host.OwnerID)
return;
LSL_List remaining = SetPrimParams(obj, rules);
uint rulesParsed = 0;
LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed);
while ((object)remaining != null && remaining.Length > 2)
{
LSL_Integer newLink = remaining.GetLSLIntegerItem(0);
LSL_List newrules = remaining.GetSublist(1, -1);
foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){
remaining = SetPrimParams(part, newrules);
remaining = SetPrimParams(part, newrules, originFunc, ref rulesParsed);
}
}
}
@@ -12640,11 +12650,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules)
protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules, string originFunc, ref uint rulesParsed)
{
//This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
int idx = 0;
int idxStart = 0;
bool positionChanged = false;
Vector3 finalPos = Vector3.Zero;
@@ -12653,9 +12664,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
while (idx < rules.Length)
{
++rulesParsed;
int code = rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
idxStart = idx;
switch (code)
{
@@ -12809,7 +12822,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
catch (InvalidCastException e)
{
ShoutError(string.Format(
"{0} error running rule #{1}: arg #{2} ",
originFunc, rulesParsed, idx - idxStart) + e.Message);
}
finally
{
if (positionChanged)

View File

@@ -3036,7 +3036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
InitLSL();
m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams");
}
/// <summary>

View File

@@ -429,7 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
}

View File

@@ -40,16 +40,75 @@ using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
/// <summary>
/// To permit region owners to enable the extended scripting functionality
/// of OSSL, without allowing malicious scripts to access potentially
/// troublesome functions, each OSSL function is assigned a threat level,
/// and access to the functions is granted or denied based on a default
/// threshold set in OpenSim.ini (which can be overridden for individual
/// functions on a case-by-case basis)
/// </summary>
public enum ThreatLevel
{
// Not documented, presumably means permanently disabled ?
NoAccess = -1,
/// <summary>
/// Function is no threat at all. It doesn't constitute a threat to
/// either users or the system and has no known side effects.
/// </summary>
None = 0,
/// <summary>
/// Abuse of this command can cause a nuisance to the region operator,
/// such as log message spew.
/// </summary>
Nuisance = 1,
/// <summary>
/// Extreme levels of abuse of this function can cause impaired
/// functioning of the region, or very gullible users can be tricked
/// into experiencing harmless effects.
/// </summary>
VeryLow = 2,
/// <summary>
/// Intentional abuse can cause crashes or malfunction under certain
/// circumstances, which can be easily rectified; or certain users can
/// be tricked into certain situations in an avoidable manner.
/// </summary>
Low = 3,
/// <summary>
/// Intentional abuse can cause denial of service and crashes with
/// potential of data or state loss; or trusting users can be tricked
/// into embarrassing or uncomfortable situations.
/// </summary>
Moderate = 4,
/// <summary>
/// Casual abuse can cause impaired functionality or temporary denial
/// of service conditions. Intentional abuse can easily cause crashes
/// with potential data loss, or can be used to trick experienced and
/// cautious users into unwanted situations, or changes global data
/// permanently and without undo ability.
/// </summary>
High = 5,
/// <summary>
/// Even normal use may, depending on the number of instances, or
/// frequency of use, result in severe service impairment or crash
/// with loss of data, or can be used to cause unwanted or harmful
/// effects on users without giving the user a means to avoid it.
/// </summary>
VeryHigh = 6,
/// <summary>
/// Even casual use is a danger to region stability, or function allows
/// console or OS command execution, or function allows taking money
/// without consent, or allows deletion or modification of user data,
/// or allows the compromise of sensitive data by design.
/// </summary>
Severe = 7
};