Merge branch 'master' into careminster

avinationmerge
Melanie 2012-07-20 22:12:02 +01:00
commit 03ff782c3c
4 changed files with 39 additions and 3 deletions

View File

@ -200,24 +200,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (int i = 0; i < result.Length; i++) for (int i = 0; i < result.Length; i++)
{ {
if (result[i] is string) if (result[i] is string)
{
llist[i] = new LSL_String((string)result[i]); llist[i] = new LSL_String((string)result[i]);
}
else if (result[i] is int) else if (result[i] is int)
{
llist[i] = new LSL_Integer((int)result[i]); llist[i] = new LSL_Integer((int)result[i]);
}
else if (result[i] is float) else if (result[i] is float)
{
llist[i] = new LSL_Float((float)result[i]); llist[i] = new LSL_Float((float)result[i]);
}
else if (result[i] is UUID)
{
llist[i] = new LSL_Key(result[i].ToString());
}
else if (result[i] is OpenMetaverse.Vector3) else if (result[i] is OpenMetaverse.Vector3)
{ {
OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i]; OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i];
llist[i] = new LSL_Vector(vresult.X,vresult.Y,vresult.Z); llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z);
} }
else if (result[i] is OpenMetaverse.Quaternion) else if (result[i] is OpenMetaverse.Quaternion)
{ {
OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i]; OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i];
llist[i] = new LSL_Rotation(qresult.X,qresult.Y,qresult.Z,qresult.W); llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W);
} }
else else
{ {
MODError(String.Format("unknown list element returned by {0}",fname)); MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name));
} }
} }

View File

@ -3322,5 +3322,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).DetachFromAvatar(); ((LSL_Api)m_LSL_Api).DetachFromAvatar();
} }
/// <summary>
/// Checks if thing is a UUID.
/// </summary>
/// <param name="thing"></param>
/// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
public LSL_Integer osIsUUID(string thing)
{
CheckThreatLevel(ThreatLevel.None, "osIsUUID");
m_host.AddScriptLPS(1);
UUID test;
return UUID.TryParse(thing, out test) ? 1 : 0;
}
} }
} }

View File

@ -276,5 +276,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetTerrainTexture(int level, LSL_Key texture); void osSetTerrainTexture(int level, LSL_Key texture);
void osSetTerrainTextureHeight(int corner, double low, double high); void osSetTerrainTextureHeight(int corner, double low, double high);
/// <summary>
/// Checks if thing is a UUID.
/// </summary>
/// <param name="thing"></param>
/// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
LSL_Integer osIsUUID(string thing);
} }
} }

View File

@ -930,5 +930,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high);
} }
public LSL_Integer osIsUUID(string thing)
{
return m_OSSL_Functions.osIsUUID(thing);
}
} }
} }