aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-09-26 22:30:09 +0200
committerMelanie2012-09-26 22:30:09 +0200
commit2998a2df6a6c56f52d56d85bcec869e4a76ad169 (patch)
tree5fdae1e142e15507837c1defc20f75280228e8dd
parent don't send a partial contents report if we are sending all data (diff)
downloadopensim-SC_OLD-2998a2df6a6c56f52d56d85bcec869e4a76ad169.zip
opensim-SC_OLD-2998a2df6a6c56f52d56d85bcec869e4a76ad169.tar.gz
opensim-SC_OLD-2998a2df6a6c56f52d56d85bcec869e4a76ad169.tar.bz2
opensim-SC_OLD-2998a2df6a6c56f52d56d85bcec869e4a76ad169.tar.xz
Streamline and improve llGetMass
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs40
1 files changed, 17 insertions, 23 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f9b4bfd..05aaebf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10599,31 +10599,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10599 UUID key = new UUID(); 10599 UUID key = new UUID();
10600 if (UUID.TryParse(id, out key)) 10600 if (UUID.TryParse(id, out key))
10601 { 10601 {
10602 try 10602 // return total object mass
10603 { 10603 SceneObjectPart part = World.GetSceneObjectPart(key);
10604 /* 10604 if (part != null)
10605 SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); 10605 return part.ParentGroup.GetMass();
10606 if (obj != null)
10607 return (double)obj.GetMass();
10608 */
10609 // return total object mass
10610 SceneObjectGroup obj = World.GetGroupByPrim(World.Entities[key].LocalId);
10611 if (obj != null)
10612 return obj.GetMass();
10613 10606
10614 // the object is null so the key is for an avatar 10607 // the object is null so the key is for an avatar
10615 ScenePresence avatar = World.GetScenePresence(key); 10608 ScenePresence avatar = World.GetScenePresence(key);
10616 if (avatar != null) 10609 if (avatar != null)
10617 if (avatar.IsChildAgent)
10618 // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
10619 // child agents have a mass of 1.0
10620 return 1;
10621 else
10622 return (double)avatar.GetMass();
10623 }
10624 catch (KeyNotFoundException)
10625 { 10610 {
10626 return 0; // The Object/Agent not in the region so just return zero 10611 if (avatar.IsChildAgent)
10612 {
10613 // reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectMass
10614 // child agents have a mass of 1.0
10615 return 1;
10616 }
10617 else
10618 {
10619 return (double)avatar.GetMass();
10620 }
10627 } 10621 }
10628 } 10622 }
10629 return 0; 10623 return 0;