* Added proper handling of llSetStatus(STATUS_PHYSICS,BOOL)

0.6.0-stable
Teravus Ovares 2008-03-14 06:20:50 +00:00
parent abacfba287
commit ae9a98ceb1
3 changed files with 70 additions and 3 deletions

View File

@ -590,6 +590,53 @@ namespace OpenSim.Region.Environment.Scenes
SetPartAsRoot(newPart);
}
public void ScriptSetPhysicsStatus(bool UsePhysics)
{
if (m_scene.m_physicalPrim)
{
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (UsePhysics)
part.AddFlag(LLObject.ObjectFlags.Physics);
else
part.RemFlag(LLObject.ObjectFlags.Physics);
part.DoPhysicsPropertyUpdate(UsePhysics, false);
IsSelected = false;
}
}
}
}
public void ScriptSetPhantomStatus(bool PhantomStatus)
{
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (PhantomStatus)
{
part.AddFlag(LLObject.ObjectFlags.Phantom);
if (part.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(part.PhysActor);
}
}
else
{
part.RemFlag(LLObject.ObjectFlags.Phantom);
if ((part.ObjectFlags & (int)LLObject.ObjectFlags.Physics) != 0)
{
part.DoPhysicsPropertyUpdate(true, false);
}
}
}
}
}
public void applyImpulse(PhysicsVector impulse)
{
// We check if rootpart is null here because scripts don't delete if you delete the host.

View File

@ -1326,7 +1326,20 @@ namespace OpenSim.Region.Environment.Scenes
// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
ScheduleFullUpdate();
}
public void ScriptSetPhysicsStatus(bool UsePhysics)
{
if (m_parentGroup != null)
{
m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
}
}
public void ScriptSetPhantomStatus(bool Phantom)
{
if (m_parentGroup != null)
{
m_parentGroup.ScriptSetPhantomStatus(Phantom);
}
}
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{
if (PhysActor != null)

View File

@ -609,11 +609,18 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1);
if ((status & BuiltIn_Commands_BaseClass.STATUS_PHYSICS) == BuiltIn_Commands_BaseClass.STATUS_PHYSICS)
{
m_host.AddFlag(LLObject.ObjectFlags.Physics);
if (value == 1)
m_host.ScriptSetPhysicsStatus(true);
else
m_host.ScriptSetPhysicsStatus(false);
}
if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM)
{
m_host.AddFlag(LLObject.ObjectFlags.Phantom);
if (value == 1)
m_host.ScriptSetPhantomStatus(true);
else
m_host.ScriptSetPhantomStatus(false);
}
if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS)
{