aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs22
2 files changed, 40 insertions, 4 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 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f40b1a5..ced5452 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7167,9 +7167,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7167 { 7167 {
7168 m_host.AddScriptLPS(1); 7168 m_host.AddScriptLPS(1);
7169 UUID key = new UUID(); 7169 UUID key = new UUID();
7170 if (UUID.TryParse(id,out key)) 7170 if (UUID.TryParse(id, out key))
7171 { 7171 {
7172 return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); 7172 try
7173 {
7174 SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId);
7175 if (obj != null)
7176 return (double)obj.GetMass();
7177 // the object is null so the key is for an avatar
7178 ScenePresence avatar = World.GetScenePresence(key);
7179 if (avatar != null)
7180 if (avatar.IsChildAgent)
7181 // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
7182 // child agents have a mass of 1.0
7183 return 1;
7184 else
7185 return (double)avatar.PhysicsActor.Mass;
7186 }
7187 catch (KeyNotFoundException)
7188 {
7189 return 0; // The Object/Agent not in the region so just return zero
7190 }
7173 } 7191 }
7174 return 0; 7192 return 0;
7175 } 7193 }