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.

avinationmerge
UbitUmarov 2012-04-09 20:53:29 +01:00
parent ad544bdd3d
commit 87fdb2ed7e
3 changed files with 30 additions and 9 deletions

View File

@ -3176,17 +3176,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
else else
{ {
if (m_host.IsRoot) // new SL always returns object mass
{ // if (m_host.IsRoot)
// {
return m_host.ParentGroup.GetMass(); return m_host.ParentGroup.GetMass();
} // }
else // else
{ // {
return m_host.GetMass(); // return m_host.GetMass();
} // }
} }
} }
public LSL_Float llGetMassMKS()
{
return 100f * llGetMass();
}
public void llCollisionFilter(string name, string id, int accept) public void llCollisionFilter(string name, string id, int accept)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -4959,7 +4966,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
float distance = (PusheePos - m_host.AbsolutePosition).Length(); float distance = (PusheePos - m_host.AbsolutePosition).Length();
float distance_term = distance * distance * distance; // Script Energy 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_DISTANCE = 17f;
float PUSH_ATTENUATION_SCALE = 5f; float PUSH_ATTENUATION_SCALE = 5f;
@ -9964,9 +9972,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
try try
{ {
/*
SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId);
if (obj != null) if (obj != null)
return (double)obj.GetMass(); 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 // the object is null so the key is for an avatar
ScenePresence avatar = World.GetScenePresence(key); ScenePresence avatar = World.GetScenePresence(key);
if (avatar != null) if (avatar != null)

View File

@ -148,7 +148,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Vector llGetLocalPos(); LSL_Vector llGetLocalPos();
LSL_Rotation llGetLocalRot(); LSL_Rotation llGetLocalRot();
LSL_Float llGetMass(); 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_String llGetNotecardLine(string name, int line);
LSL_Key llGetNumberOfNotecardLines(string name); LSL_Key llGetNumberOfNotecardLines(string name);
LSL_Integer llGetNumberOfPrims(); LSL_Integer llGetNumberOfPrims();

View File

@ -581,6 +581,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetMass(); return m_LSL_Functions.llGetMass();
} }
public LSL_Float llGetMassMKS()
{
return m_LSL_Functions.llGetMassMKS();
}
public void llGetNextEmail(string address, string subject) public void llGetNextEmail(string address, string subject)
{ {
m_LSL_Functions.llGetNextEmail(address, subject); m_LSL_Functions.llGetNextEmail(address, subject);