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
This commit is contained in:
johnb432 2024-05-22 22:38:59 +02:00 committed by GitHub
parent e1137ac903
commit 67fe22a5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View File

@ -19,8 +19,15 @@ params ["_projectile"];
TRACE_1("params",_projectile); TRACE_1("params",_projectile);
if (alive _projectile) then { if (alive _projectile) then {
private _soundFile = format ["A3\Sounds_F\arsenal\explosives\grenades\Explosion_HE_grenade_0%1.wss", floor (random 4) + 1]; private _sounds = getArray (_projectile call CBA_fnc_getObjectConfig >> QGVAR(flashbangExplodeSound));
playSound3D [_soundFile, _projectile, false, getPosASL _projectile, 5, 1.2, 400];
(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; ["ace_flashbangExploded", [getPosASL _projectile]] call CBA_fnc_globalEvent;
}; };

View File

@ -50,6 +50,10 @@ class CfgAmmo {
ace_grenades_flashbangBangs = 6; // 6 bangs ace_grenades_flashbangBangs = 6; // 6 bangs
ace_grenades_flashbangInterval = 0.25; // 0.25 seconds between each subsequent bang 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_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. 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 ### 2.2 Incendiary Config Values
```cpp ```cpp