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
{
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)

View File

@ -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();

View File

@ -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);