Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.csavinationmerge
commit
2a5077ef7e
|
@ -5375,8 +5375,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vectors & Rotations always return zero in SL, but
|
||||||
|
// keys don't always return zero, it seems to be a bit complex.
|
||||||
|
else if (src.Data[index] is LSL_Vector ||
|
||||||
|
src.Data[index] is LSL_Rotation)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (src.Data[index] is LSL_Integer)
|
if (src.Data[index] is LSL_Integer)
|
||||||
return (LSL_Integer)src.Data[index];
|
return (LSL_Integer)src.Data[index];
|
||||||
else if (src.Data[index] is LSL_Float)
|
else if (src.Data[index] is LSL_Float)
|
||||||
|
@ -5400,6 +5409,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vectors & Rotations always return zero in SL
|
||||||
|
else if (src.Data[index] is LSL_Vector ||
|
||||||
|
src.Data[index] is LSL_Rotation)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// valid keys seem to get parsed as integers then converted to floats
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UUID uuidt;
|
||||||
|
if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt))
|
||||||
|
{
|
||||||
|
return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value);
|
||||||
|
}
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (src.Data[index] is LSL_Integer)
|
if (src.Data[index] is LSL_Integer)
|
||||||
|
@ -5443,17 +5468,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return src.Data[index].ToString();
|
return src.Data[index].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llList2Key(LSL_List src, int index)
|
public LSL_Key llList2Key(LSL_List src, int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SL spits out an empty string for types other than key & string
|
||||||
|
// At the time of patching, LSL_Key is currently LSL_String,
|
||||||
|
// so the OR check may be a little redundant, but it's being done
|
||||||
|
// for completion and should LSL_Key ever be implemented
|
||||||
|
// as it's own struct
|
||||||
|
else if (!(src.Data[index] is LSL_String ||
|
||||||
|
src.Data[index] is LSL_Key))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return src.Data[index].ToString();
|
return src.Data[index].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5472,6 +5510,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
return (LSL_Vector)src.Data[index];
|
return (LSL_Vector)src.Data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SL spits always out ZERO_VECTOR for anything other than
|
||||||
|
// strings or vectors. Although keys always return ZERO_VECTOR,
|
||||||
|
// it is currently difficult to make the distinction between
|
||||||
|
// a string, a key as string and a string that by coincidence
|
||||||
|
// is a string, so we're going to leave that up to the
|
||||||
|
// LSL_Vector constructor.
|
||||||
|
else if (!(src.Data[index] is LSL_String ||
|
||||||
|
src.Data[index] is LSL_Vector))
|
||||||
|
{
|
||||||
|
return new LSL_Vector(0, 0, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new LSL_Vector(src.Data[index].ToString());
|
return new LSL_Vector(src.Data[index].ToString());
|
||||||
|
@ -5489,7 +5539,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
return new LSL_Rotation(0, 0, 0, 1);
|
return new LSL_Rotation(0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
if (src.Data[index].GetType() == typeof(LSL_Rotation))
|
|
||||||
|
// SL spits always out ZERO_ROTATION for anything other than
|
||||||
|
// strings or vectors. Although keys always return ZERO_ROTATION,
|
||||||
|
// it is currently difficult to make the distinction between
|
||||||
|
// a string, a key as string and a string that by coincidence
|
||||||
|
// is a string, so we're going to leave that up to the
|
||||||
|
// LSL_Rotation constructor.
|
||||||
|
else if (!(src.Data[index] is LSL_String ||
|
||||||
|
src.Data[index] is LSL_Rotation))
|
||||||
|
{
|
||||||
|
return new LSL_Rotation(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
else if (src.Data[index].GetType() == typeof(LSL_Rotation))
|
||||||
{
|
{
|
||||||
return (LSL_Rotation)src.Data[index];
|
return (LSL_Rotation)src.Data[index];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue