aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs22
1 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 72a4322..795baac 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -7391,9 +7391,27 @@ namespace OpenSim.Region.ScriptEngine.Common
7391 { 7391 {
7392 m_host.AddScriptLPS(1); 7392 m_host.AddScriptLPS(1);
7393 UUID key = new UUID(); 7393 UUID key = new UUID();
7394 if (UUID.TryParse(id,out key)) 7394 if (UUID.TryParse(id, out key))
7395 { 7395 {
7396 return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); 7396 try
7397 {
7398 SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId);
7399 if (obj != null)
7400 return (double)obj.GetMass();
7401 // the object is null so the key is for an avatar
7402 ScenePresence avatar = World.GetScenePresence(key);
7403 if (avatar != null)
7404 if (avatar.IsChildAgent)
7405 // ref http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
7406 // child agents have a mass of 1.0
7407 return 1;
7408 else
7409 return (double)avatar.PhysicsActor.Mass;
7410 }
7411 catch (KeyNotFoundException)
7412 {
7413 return 0; // The Object/Agent not in the region so just return zero
7414 }
7397 } 7415 }
7398 return 0; 7416 return 0;
7399 } 7417 }