aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-06 21:14:19 +0100
committerJustin Clark-Casey (justincc)2012-04-06 21:14:19 +0100
commitf2903db39009c7e62f6a07c545183b9588bff775 (patch)
tree7960717836df2d7011e5bb1d05386bd330827910 /OpenSim/Region/ScriptEngine
parentMake llGetMass() return total mass of object when called on root prim. (diff)
downloadopensim-SC_OLD-f2903db39009c7e62f6a07c545183b9588bff775.zip
opensim-SC_OLD-f2903db39009c7e62f6a07c545183b9588bff775.tar.gz
opensim-SC_OLD-f2903db39009c7e62f6a07c545183b9588bff775.tar.bz2
opensim-SC_OLD-f2903db39009c7e62f6a07c545183b9588bff775.tar.xz
For llGetMass(), return the mass of the avatar is the object is attached.
As per http://lslwiki.net/lslwiki/wakka.php?wakka=llGetMass This is the mass as used by the physics engine (ODE or Bullet).
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs27
1 files changed, 24 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 43b66f4..17f5a64 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2907,10 +2907,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2907 public LSL_Float llGetMass() 2907 public LSL_Float llGetMass()
2908 { 2908 {
2909 m_host.AddScriptLPS(1); 2909 m_host.AddScriptLPS(1);
2910 if (m_host.IsRoot) 2910
2911 return m_host.ParentGroup.GetMass(); 2911 if (m_host.ParentGroup.IsAttachment)
2912 {
2913 ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2914
2915 if (attachedAvatar != null)
2916 {
2917 return attachedAvatar.GetMass();
2918 }
2919 else
2920 {
2921 return 0;
2922 }
2923 }
2912 else 2924 else
2913 return m_host.GetMass(); 2925 {
2926 if (m_host.IsRoot)
2927 {
2928 return m_host.ParentGroup.GetMass();
2929 }
2930 else
2931 {
2932 return m_host.GetMass();
2933 }
2934 }
2914 } 2935 }
2915 2936
2916 public void llCollisionFilter(string name, string id, int accept) 2937 public void llCollisionFilter(string name, string id, int accept)