Mantis#2123. Thank you kindly, Idb for a patch that solves:

Under both DotNetEngine and XEngine, if an agent's UUID 
is passed as the parameter to llGetObjectMass(), 
it throws an exception.
0.6.0-stable
Charles Krinke 2008-09-25 03:58:03 +00:00
parent 031eb08b8e
commit 5edaddce6d
2 changed files with 40 additions and 4 deletions

View File

@ -7391,9 +7391,27 @@ namespace OpenSim.Region.ScriptEngine.Common
{
m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id,out key))
if (UUID.TryParse(id, out key))
{
return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
try
{
SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId);
if (obj != null)
return (double)obj.GetMass();
// the object is null so the key is for an avatar
ScenePresence avatar = World.GetScenePresence(key);
if (avatar != null)
if (avatar.IsChildAgent)
// ref http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
// child agents have a mass of 1.0
return 1;
else
return (double)avatar.PhysicsActor.Mass;
}
catch (KeyNotFoundException)
{
return 0; // The Object/Agent not in the region so just return zero
}
}
return 0;
}

View File

@ -7167,9 +7167,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id,out key))
if (UUID.TryParse(id, out key))
{
return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
try
{
SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId);
if (obj != null)
return (double)obj.GetMass();
// the object is null so the key is for an avatar
ScenePresence avatar = World.GetScenePresence(key);
if (avatar != null)
if (avatar.IsChildAgent)
// reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
// child agents have a mass of 1.0
return 1;
else
return (double)avatar.PhysicsActor.Mass;
}
catch (KeyNotFoundException)
{
return 0; // The Object/Agent not in the region so just return zero
}
}
return 0;
}