refactor: Fold most SOP.ScriptSet* methods back into script code. Simplify.

bulletsim
Justin Clark-Casey (justincc) 2011-08-06 00:13:08 +01:00
parent ba89fc3aa1
commit c6c91e6599
3 changed files with 9 additions and 47 deletions

View File

@ -2967,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void ScriptSetPhantomStatus(bool Phantom)
{
if (m_parentGroup != null)
{
m_parentGroup.ScriptSetPhantomStatus(Phantom);
}
}
public void ScriptSetTemporaryStatus(bool Temporary)
{
if (m_parentGroup != null)
{
m_parentGroup.ScriptSetTemporaryStatus(Temporary);
}
}
public void ScriptSetPhysicsStatus(bool UsePhysics) public void ScriptSetPhysicsStatus(bool UsePhysics)
{ {
if (m_parentGroup == null) if (m_parentGroup == null)
@ -2991,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
} }
public void ScriptSetVolumeDetect(bool SetVD)
{
if (m_parentGroup != null)
{
m_parentGroup.ScriptSetVolumeDetect(SetVD);
}
}
/// <summary> /// <summary>
/// Set sculpt and mesh data, and tell the physics engine to process the change. /// Set sculpt and mesh data, and tell the physics engine to process the change.
/// </summary> /// </summary>

View File

@ -53,9 +53,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart rootPart = so.RootPart; SceneObjectPart rootPart = so.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
so.RootPart.ScriptSetPhantomStatus(true); so.ScriptSetPhantomStatus(true);
Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
} }
} }

View File

@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
{ {
if (value != 0) if (m_host.ParentGroup != null)
m_host.ScriptSetPhantomStatus(true); m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
else
m_host.ScriptSetPhantomStatus(false);
} }
if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
@ -6446,9 +6444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentGroup != null) if (m_host.ParentGroup != null)
{ {
if (!m_host.ParentGroup.IsDeleted) if (!m_host.ParentGroup.IsDeleted)
{ m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0);
}
} }
} }
@ -6456,7 +6452,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// This is a depecated function so this just replicates the result of /// This is a depecated function so this just replicates the result of
/// invoking it in SL /// invoking it in SL
/// </summary> /// </summary>
public void llRemoteLoadScript(string target, string name, int running, int start_param) public void llRemoteLoadScript(string target, string name, int running, int start_param)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -7254,14 +7249,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
string ph = rules.Data[idx++].ToString(); string ph = rules.Data[idx++].ToString();
bool phantom;
if (ph.Equals("1")) if (m_host.ParentGroup != null)
phantom = true; m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
else
phantom = false;
part.ScriptSetPhantomStatus(phantom);
break; break;
case (int)ScriptBaseClass.PRIM_PHYSICS: case (int)ScriptBaseClass.PRIM_PHYSICS:
@ -7282,14 +7273,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (remain < 1) if (remain < 1)
return; return;
string temp = rules.Data[idx++].ToString(); string temp = rules.Data[idx++].ToString();
bool tempOnRez;
if (temp.Equals("1")) if (m_host.ParentGroup != null)
tempOnRez = true; m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
else
tempOnRez = false;
part.ScriptSetTemporaryStatus(tempOnRez);
break; break;
case (int)ScriptBaseClass.PRIM_TEXGEN: case (int)ScriptBaseClass.PRIM_TEXGEN: