aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs9
-rw-r--r--OpenSim/Data/MySQL/Resources/022_RegionStore.sql6
-rw-r--r--OpenSim/Data/SQLite/Resources/015_RegionStore.sql6
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs37
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
6 files changed, 84 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index effe10b..1daefe4 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -981,6 +981,9 @@ namespace OpenSim.Data.MySQL
981 createCol(prims, "ClickAction", typeof (Byte)); 981 createCol(prims, "ClickAction", typeof (Byte));
982 createCol(prims, "Material", typeof (Byte)); 982 createCol(prims, "Material", typeof (Byte));
983 983
984 createCol(prims, "CollisionSound", typeof(String));
985 createCol(prims, "CollisionSoundVolume", typeof(Double));
986
984 // Add in contraints 987 // Add in contraints
985 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 988 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
986 989
@@ -1271,6 +1274,9 @@ namespace OpenSim.Data.MySQL
1271 if (!row.IsNull("ClickAction")) 1274 if (!row.IsNull("ClickAction"))
1272 prim.ClickAction = Convert.ToByte(row["ClickAction"]); 1275 prim.ClickAction = Convert.ToByte(row["ClickAction"]);
1273 1276
1277 prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
1278 prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
1279
1274 return prim; 1280 return prim;
1275 } 1281 }
1276 1282
@@ -1589,6 +1595,9 @@ namespace OpenSim.Data.MySQL
1589 row["ClickAction"] = clickAction; 1595 row["ClickAction"] = clickAction;
1590 1596
1591 row["Material"] = prim.Material; 1597 row["Material"] = prim.Material;
1598
1599 row["CollisionSound"] = prim.CollisionSound.ToString();
1600 row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
1592 } 1601 }
1593 1602
1594 /// <summary> 1603 /// <summary>
diff --git a/OpenSim/Data/MySQL/Resources/022_RegionStore.sql b/OpenSim/Data/MySQL/Resources/022_RegionStore.sql
new file mode 100644
index 0000000..af4fdce
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/022_RegionStore.sql
@@ -0,0 +1,6 @@
1BEGIN;
2
3ALTER TABLE prims ADD COLUMN CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000';
4ALTER TABLE prims ADD COLUMN CollisionSoundVolume float not null default 0.0;
5
6COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/015_RegionStore.sql b/OpenSim/Data/SQLite/Resources/015_RegionStore.sql
new file mode 100644
index 0000000..f9c0eea
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/015_RegionStore.sql
@@ -0,0 +1,6 @@
1BEGIN;
2
3ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
4ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
5
6COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 4ce343a..a959d56 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -877,6 +877,9 @@ namespace OpenSim.Data.SQLite
877 877
878 createCol(prims, "Material", typeof(Byte)); 878 createCol(prims, "Material", typeof(Byte));
879 879
880 createCol(prims, "CollisionSound", typeof(String));
881 createCol(prims, "CollisionSoundVolume", typeof(Double));
882
880 // Add in contraints 883 // Add in contraints
881 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 884 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
882 885
@@ -1237,6 +1240,10 @@ namespace OpenSim.Data.SQLite
1237 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); 1240 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
1238 1241
1239 prim.Material = Convert.ToByte(row["Material"]); 1242 prim.Material = Convert.ToByte(row["Material"]);
1243
1244 prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
1245 prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
1246
1240 return prim; 1247 return prim;
1241 } 1248 }
1242 1249
@@ -1564,6 +1571,9 @@ namespace OpenSim.Data.SQLite
1564 1571
1565 row["SalePrice"] = prim.SalePrice; 1572 row["SalePrice"] = prim.SalePrice;
1566 row["Material"] = prim.Material; 1573 row["Material"] = prim.Material;
1574
1575 row["CollisionSound"] = prim.CollisionSound.ToString();
1576 row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
1567 } 1577 }
1568 1578
1569 /// <summary> 1579 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index c7862ec..a626fa3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -201,6 +201,10 @@ namespace OpenSim.Region.Environment.Scenes
201 private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f); 201 private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
202 private bool m_forceMouselook = false; 202 private bool m_forceMouselook = false;
203 203
204 // TODO: Collision sound should have default.
205 private UUID m_collisionSound = UUID.Zero;
206 private float m_collisionSoundVolume = 0.0f;
207
204 #endregion Fields 208 #endregion Fields
205 209
206 #region Constructors 210 #region Constructors
@@ -952,6 +956,22 @@ if (m_shape != null) {
952 set { m_sitAnimation = value; } 956 set { m_sitAnimation = value; }
953 } 957 }
954 958
959 public UUID CollisionSound
960 {
961 get { return m_collisionSound; }
962 set
963 {
964 m_collisionSound = value;
965 aggregateScriptEvents();
966 }
967 }
968
969 public float CollisionSoundVolume
970 {
971 get { return m_collisionSoundVolume; }
972 set { m_collisionSoundVolume = value; }
973 }
974
955 #endregion Public Properties with only Get 975 #endregion Public Properties with only Get
956 976
957 977
@@ -1607,6 +1627,12 @@ if (m_shape != null) {
1607 if (m_parentGroup.IsDeleted) 1627 if (m_parentGroup.IsDeleted)
1608 return; 1628 return;
1609 1629
1630 // play the sound.
1631 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
1632 {
1633 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
1634 }
1635
1610 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) 1636 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
1611 { 1637 {
1612 // do event notification 1638 // do event notification
@@ -3233,7 +3259,8 @@ if (m_shape != null) {
3233 if ( 3259 if (
3234 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3260 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3235 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3261 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3236 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) 3262 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3263 (CollisionSound != null && CollisionSound != UUID.Zero)
3237 ) 3264 )
3238 { 3265 {
3239 // subscribe to physics updates. 3266 // subscribe to physics updates.
@@ -3252,6 +3279,13 @@ if (m_shape != null) {
3252 PhysActor.OnCollisionUpdate -= PhysicsCollision; 3279 PhysActor.OnCollisionUpdate -= PhysicsCollision;
3253 } 3280 }
3254 } 3281 }
3282
3283 if (m_parentGroup == null)
3284 {
3285 ScheduleFullUpdate();
3286 return;
3287 }
3288
3255 if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 3289 if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
3256 { 3290 {
3257 m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 3291 m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
@@ -3363,3 +3397,4 @@ if (m_shape != null) {
3363 3397
3364 3398
3365 3399
3400
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 968581b..a06ed9b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3490,7 +3490,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3490 public void llCollisionSound(string impact_sound, double impact_volume) 3490 public void llCollisionSound(string impact_sound, double impact_volume)
3491 { 3491 {
3492 m_host.AddScriptLPS(1); 3492 m_host.AddScriptLPS(1);
3493 NotImplemented("llCollisionSound"); 3493 //NotImplemented("llCollisionSound");
3494
3495 // TODO: Parameter check logic required.
3496 UUID soundId = UUID.Zero;
3497 if (!UUID.TryParse(impact_sound, out soundId))
3498 {
3499 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3500 {
3501 if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
3502 {
3503 soundId = item.AssetID;
3504 break;
3505 }
3506 }
3507 }
3508 m_host.CollisionSound = soundId;
3509 m_host.CollisionSoundVolume = (float)impact_volume;
3494 } 3510 }
3495 3511
3496 public void llCollisionSprite(string impact_sprite) 3512 public void llCollisionSprite(string impact_sprite)