From 87fdb2ed7e27e9c161a4d10d9c5b9859dcde5b2d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 9 Apr 2012 20:53:29 +0100 Subject: llGetMass and llGetObjectMass (and push estimation) always use object mass as in current SL ( push is what makes sense or impulse will depend on what prim it is and not object). Added llGetMassMKS() that just returns 100 x llGetMass() as it seems to be in SL. --- .../Shared/Api/Implementation/LSL_Api.cs | 31 ++++++++++++++++------ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 3 ++- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 30 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e71f027..2f61b70 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3176,17 +3176,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (m_host.IsRoot) - { + // new SL always returns object mass +// if (m_host.IsRoot) +// { return m_host.ParentGroup.GetMass(); - } - else - { - return m_host.GetMass(); - } +// } +// else +// { +// return m_host.GetMass(); +// } } } + + public LSL_Float llGetMassMKS() + { + return 100f * llGetMass(); + } + public void llCollisionFilter(string name, string id, int accept) { m_host.AddScriptLPS(1); @@ -4959,7 +4966,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { float distance = (PusheePos - m_host.AbsolutePosition).Length(); float distance_term = distance * distance * distance; // Script Energy - float pusher_mass = m_host.GetMass(); + // use total object mass and not part + float pusher_mass = m_host.ParentGroup.GetMass(); float PUSH_ATTENUATION_DISTANCE = 17f; float PUSH_ATTENUATION_SCALE = 5f; @@ -9964,9 +9972,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { try { + /* SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); if (obj != null) return (double)obj.GetMass(); + */ + // return total object mass + SceneObjectGroup obj = World.GetGroupByPrim(World.Entities[key].LocalId); + if (obj != null) + return (double)obj.GetMass(); + // the object is null so the key is for an avatar ScenePresence avatar = World.GetScenePresence(key); if (avatar != null) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index b976dc3..5c528977 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -148,7 +148,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llGetLocalPos(); LSL_Rotation llGetLocalRot(); LSL_Float llGetMass(); - void llGetNextEmail(string address, string subject); + LSL_Float llGetMassMKS(); + void llGetNextEmail(string address, string subject); LSL_String llGetNotecardLine(string name, int line); LSL_Key llGetNumberOfNotecardLines(string name); LSL_Integer llGetNumberOfPrims(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index bf58d13..70c5fcd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -581,6 +581,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetMass(); } + public LSL_Float llGetMassMKS() + { + return m_LSL_Functions.llGetMassMKS(); + } + public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); -- cgit v1.1