From 67fe22a5a6bce3b5cf22f614e61a61971e8cb5db Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 22 May 2024 22:38:59 +0200 Subject: [PATCH] Grenades - Make flashbang detonation sound configurable via config (#9985) * Added configurable flashbang detonation sound Updated documentation by filling missing information in * Update grenades-framework.md * Update grenades-framework.md --- addons/grenades/functions/fnc_flashbangThrownFuze.sqf | 11 +++++++++-- docs/wiki/framework/grenades-framework.md | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index f966283f96..1c9751da37 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -19,8 +19,15 @@ params ["_projectile"]; TRACE_1("params",_projectile); if (alive _projectile) then { - private _soundFile = format ["A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_0%1.wss", floor (random 4) + 1]; - playSound3D [_soundFile, _projectile, false, getPosASL _projectile, 5, 1.2, 400]; + private _sounds = getArray (_projectile call CBA_fnc_getObjectConfig >> QGVAR(flashbangExplodeSound)); + + (if (_sounds isEqualTo []) then { + [format ["A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_0%1.wss", floor (random 4) + 1], 5, 1.2, 400] + } else { + selectRandom _sounds + }) params ["_file", "_volume", "_pitch", "_distance"]; + + playSound3D [_file, _projectile, false, getPosASL _projectile, _volume, _pitch, _distance]; ["ace_flashbangExploded", [getPosASL _projectile]] call CBA_fnc_globalEvent; }; diff --git a/docs/wiki/framework/grenades-framework.md b/docs/wiki/framework/grenades-framework.md index fce3b480c2..14c72e1cb5 100644 --- a/docs/wiki/framework/grenades-framework.md +++ b/docs/wiki/framework/grenades-framework.md @@ -50,6 +50,10 @@ class CfgAmmo { ace_grenades_flashbangBangs = 6; // 6 bangs ace_grenades_flashbangInterval = 0.25; // 0.25 seconds between each subsequent bang ace_grenades_flashbangIntervalMaxDeviation = 0.05; // Deviation of up to ± 0.05 seconds on each fuse + ace_grenades_flashbangExplodeSound[] = { // Sound that is played upon detonation + {"A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_01.wss", 5, 1.2, 400}, // file path, volume, pitch, max distance + {"A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_02.wss", 5, 1.2, 400} + }; }; }; ``` @@ -70,6 +74,11 @@ The average amount of time in seconds, after `explosionTime` has passed, between The amount of randomness in the fuse time. +### 2.1.5 ace_grenades_flashbangExplodeSound + +The sounds that can be used when the flashbang detonates. It randomly selects an entry from this array (equal chances, there are no weights involved). +If not defined, `[format ["A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_0%1.wss", floor (random 4) + 1], 5, 1.2, 400]` is used as a default instead (4 sounds total). + ### 2.2 Incendiary Config Values ```cpp