From 6e68a11082c0928395450d70fcb5b3f18bdfb35f Mon Sep 17 00:00:00 2001
From: Dahlia Trimble
Date: Mon, 22 Dec 2008 09:29:59 +0000
Subject: Thanks Gerhard for a patch that implements part 3 of VolumeDetection
/ persistance
---
OpenSim/Data/SQLite/Resources/016_RegionStore.sql | 5 +++++
OpenSim/Data/SQLite/SQLiteRegionData.cs | 10 ++++++++++
OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 8 ++++----
OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 7 ++++++-
4 files changed, 25 insertions(+), 5 deletions(-)
create mode 100644 OpenSim/Data/SQLite/Resources/016_RegionStore.sql
diff --git a/OpenSim/Data/SQLite/Resources/016_RegionStore.sql b/OpenSim/Data/SQLite/Resources/016_RegionStore.sql
new file mode 100644
index 0000000..71be55b
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/016_RegionStore.sql
@@ -0,0 +1,5 @@
+BEGIN;
+
+ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
+
+COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 78c57ed..7f929a8 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -879,6 +879,8 @@ namespace OpenSim.Data.SQLite
createCol(prims, "CollisionSound", typeof(String));
createCol(prims, "CollisionSoundVolume", typeof(Double));
+ createCol(prims, "VolumeDetect", typeof(Int16));
+
// Add in contraints
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
@@ -1240,6 +1242,9 @@ namespace OpenSim.Data.SQLite
prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
+ if (Convert.ToInt16(row["VolumeDetect"]) != 0)
+ prim.VolumeDetectActive = true;
+
return prim;
}
@@ -1569,6 +1574,11 @@ namespace OpenSim.Data.SQLite
row["CollisionSound"] = prim.CollisionSound.ToString();
row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
+ if (prim.VolumeDetectActive)
+ row["VolumeDetect"] = 1;
+ else
+ row["VolumeDetect"] = 0;
+
}
///
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 857f193..2f6a61a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -858,7 +858,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(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;
RootPart.Rezzed = DateTime.Now;
RootPart.RemFlag(PrimFlags.TemporaryOnRez);
@@ -1161,12 +1161,12 @@ namespace OpenSim.Region.Environment.Scenes
{
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)
{
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
{
- m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_physicalPrim);
+ m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
}
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0315c92..ddfb413 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1281,11 +1281,15 @@ if (m_shape != null) {
///
///
///
- 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 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.
bool RigidBody = isPhysical && !isPhantom;
@@ -1305,6 +1309,7 @@ if (m_shape != null) {
{
PhysActor.LocalID = LocalId;
DoPhysicsPropertyUpdate(RigidBody, true);
+ PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
}
}
}
--
cgit v1.1