Thanks Gerhard for a patch that implements part 3 of VolumeDetection / persistance

0.6.2-post-fixes
Dahlia Trimble 2008-12-22 09:29:59 +00:00
parent 1fbbdb6714
commit 6e68a11082
4 changed files with 25 additions and 5 deletions

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -879,6 +879,8 @@ namespace OpenSim.Data.SQLite
createCol(prims, "CollisionSound", typeof(String)); createCol(prims, "CollisionSound", typeof(String));
createCol(prims, "CollisionSoundVolume", typeof(Double)); createCol(prims, "CollisionSoundVolume", typeof(Double));
createCol(prims, "VolumeDetect", typeof(Int16));
// Add in contraints // Add in contraints
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
@ -1240,6 +1242,9 @@ namespace OpenSim.Data.SQLite
prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
if (Convert.ToInt16(row["VolumeDetect"]) != 0)
prim.VolumeDetectActive = true;
return prim; return prim;
} }
@ -1569,6 +1574,11 @@ namespace OpenSim.Data.SQLite
row["CollisionSound"] = prim.CollisionSound.ToString(); row["CollisionSound"] = prim.CollisionSound.ToString();
row["CollisionSoundVolume"] = prim.CollisionSoundVolume; row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
if (prim.VolumeDetectActive)
row["VolumeDetect"] = 1;
else
row["VolumeDetect"] = 0;
} }
/// <summary> /// <summary>

View File

@ -858,7 +858,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.AttachedAvatar = UUID.Zero; m_rootPart.AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0); SetAttachmentPoint((byte)0);
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
HasGroupChanged = true; HasGroupChanged = true;
RootPart.Rezzed = DateTime.Now; RootPart.Rezzed = DateTime.Now;
RootPart.RemFlag(PrimFlags.TemporaryOnRez); RootPart.RemFlag(PrimFlags.TemporaryOnRez);
@ -1161,12 +1161,12 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_parts.Count > 1) if (m_parts.Count > 1)
{ {
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
if (part.LocalId != m_rootPart.LocalId) if (part.LocalId != m_rootPart.LocalId)
{ {
part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim);
} }
} }
@ -1175,7 +1175,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim); m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
} }
} }
} }

View File

@ -1281,11 +1281,15 @@ if (m_shape != null) {
/// </summary> /// </summary>
/// <param name="rootObjectFlags"></param> /// <param name="rootObjectFlags"></param>
/// <param name="m_physicalPrim"></param> /// <param name="m_physicalPrim"></param>
public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool m_physicalPrim)
{ {
bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim); bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim);
bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0); bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0);
// Special case for VolumeDetection: If VolumeDetection is set, the phantom flag is locally ignored
if (VolumeDetectActive)
isPhantom = false;
// Added clarification.. since A rigid body is an object that you can kick around, etc. // Added clarification.. since A rigid body is an object that you can kick around, etc.
bool RigidBody = isPhysical && !isPhantom; bool RigidBody = isPhysical && !isPhantom;
@ -1305,6 +1309,7 @@ if (m_shape != null) {
{ {
PhysActor.LocalID = LocalId; PhysActor.LocalID = LocalId;
DoPhysicsPropertyUpdate(RigidBody, true); DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
} }
} }
} }