Make Buoyancy a prim property

avinationmerge
Melanie 2011-06-02 18:32:25 +02:00
parent f02fbdbc68
commit 61bf2bf2dd
3 changed files with 52 additions and 26 deletions

View File

@ -680,6 +680,9 @@ namespace OpenSim.Region.Framework.Scenes
ApplyPhysics(m_scene.m_physicalPrim);
if (RootPart.PhysActor != null)
RootPart.Buoyancy = RootPart.Buoyancy;
// Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
// for the same object with very different properties. The caller must schedule the update.
//ScheduleGroupForFullUpdate();

View File

@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes
protected Vector3 m_lastAcceleration;
protected Vector3 m_lastAngularVelocity;
protected int m_lastTerseSent;
protected float m_buoyancy = 0.0f;
/// <summary>
/// Stores media texture data
@ -1335,6 +1336,19 @@ namespace OpenSim.Region.Framework.Scenes
set { m_collisionSoundVolume = value; }
}
public float Buoyancy
{
get { return m_buoyancy; }
set
{
m_buoyancy = value;
if (PhysActor != null)
{
PhysActor.Buoyancy = value;
}
}
}
#endregion Public Properties with only Get
#region Private Methods
@ -3275,14 +3289,6 @@ namespace OpenSim.Region.Framework.Scenes
STATUS_ROTATE_Z = rotate;
}
public void SetBuoyancy(float fvalue)
{
if (PhysActor != null)
{
PhysActor.Buoyancy = fvalue;
}
}
public void SetDieAtEdge(bool p)
{
if (m_parentGroup == null)

View File

@ -3453,7 +3453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
m_host.ParentGroup.RootPart.Buoyancy = (float)buoyancy;
}
}
}
@ -3707,7 +3707,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
}
else if (m_host.SitTargetAvatar == agentID) // Sitting avatar
else
{
bool sitting = false;
if (m_host.SitTargetAvatar == agentID)
{
sitting = true;
}
else
{
foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
{
if (p.SitTargetAvatar == agentID)
sitting = true;
}
}
if (sitting)
{
// When agent is sitting, certain permissions are implicit if requested from sitting agent
int implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@ -3730,6 +3746,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
}
}
ScenePresence presence = World.GetScenePresence(agentID);