aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
authorCharles Krinke2008-09-25 03:58:03 +0000
committerCharles Krinke2008-09-25 03:58:03 +0000
commit5edaddce6d1b26869274819cf8a86b4914e7ae3d (patch)
tree63034e5d83fac8c63087f269070dd919795b0b44 /OpenSim/Region/ScriptEngine/Common
parent* Remove a message handler (diff)
downloadopensim-SC_OLD-5edaddce6d1b26869274819cf8a86b4914e7ae3d.zip
opensim-SC_OLD-5edaddce6d1b26869274819cf8a86b4914e7ae3d.tar.gz
opensim-SC_OLD-5edaddce6d1b26869274819cf8a86b4914e7ae3d.tar.bz2
opensim-SC_OLD-5edaddce6d1b26869274819cf8a86b4914e7ae3d.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-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 }