diff options
author | Charles Krinke | 2008-09-25 03:58:03 +0000 |
---|---|---|
committer | Charles Krinke | 2008-09-25 03:58:03 +0000 |
commit | 5edaddce6d1b26869274819cf8a86b4914e7ae3d (patch) | |
tree | 63034e5d83fac8c63087f269070dd919795b0b44 /OpenSim/Region/ScriptEngine/Shared | |
parent | * Remove a message handler (diff) | |
download | opensim-SC-5edaddce6d1b26869274819cf8a86b4914e7ae3d.zip opensim-SC-5edaddce6d1b26869274819cf8a86b4914e7ae3d.tar.gz opensim-SC-5edaddce6d1b26869274819cf8a86b4914e7ae3d.tar.bz2 opensim-SC-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/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 22 |
1 files changed, 20 insertions, 2 deletions
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 | } |