aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorCharles Krinke2008-11-19 18:30:16 +0000
committerCharles Krinke2008-11-19 18:30:16 +0000
commit44c56a974c428379ebf82386aac7b7443fd82a7d (patch)
tree5b22c54174a6489563cd2ac79162ada4c6f79ba3 /OpenSim/Region
parentAdjust to the Helpers->Utils rename (diff)
downloadopensim-SC_OLD-44c56a974c428379ebf82386aac7b7443fd82a7d.zip
opensim-SC_OLD-44c56a974c428379ebf82386aac7b7443fd82a7d.tar.gz
opensim-SC_OLD-44c56a974c428379ebf82386aac7b7443fd82a7d.tar.bz2
opensim-SC_OLD-44c56a974c428379ebf82386aac7b7443fd82a7d.tar.xz
Mantis#2656. Thank you kindly, Nlin for a patch that:
Attached patch implements llCollisionSound. Thanks T. Sado.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs37
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
2 files changed, 53 insertions, 2 deletions
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)