From 1002dfe31bfb6d98350b7e021ce4b6b53e814153 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Mon, 12 Feb 2024 11:01:24 -0600 Subject: [PATCH] Grenades - Flashbang events (#9796) --- addons/grenades/functions/fnc_flashbangExplosionEH.sqf | 3 +++ docs/wiki/framework/grenades-framework.md | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index bba3cffd4d..36b84f942f 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -63,6 +63,7 @@ _affected = _affected - [ACE_player]; if (_flashReactionDebounce < CBA_missionTime) then { // Not used interally but could be useful for other mods _unit setVariable [QGVAR(flashStrength), _strength, true]; + [QGVAR(flashbangedAI), [_unit, _strength, _grenadePosASL]] call CBA_fnc_localEvent; { _unit setSkill [_x, (_unit skill _x) / 50]; } forEach SUBSKILLS; @@ -162,5 +163,7 @@ if (hasInterface && {!isNull ACE_player} && {alive ACE_player}) then { private _maxFlinch = linearConversion [0.2, 1, _strength, 0, 95, true]; private _flinch = (_minFlinch + random (_maxFlinch - _minFlinch)) * selectRandom [-1, 1]; ACE_player setDir (getDir ACE_player + _flinch); + + [QGVAR(flashbangedPlayer), [_strength, _grenadePosASL]] call CBA_fnc_localEvent; }; true diff --git a/docs/wiki/framework/grenades-framework.md b/docs/wiki/framework/grenades-framework.md index a0b0ceeea7..b8f61872ff 100644 --- a/docs/wiki/framework/grenades-framework.md +++ b/docs/wiki/framework/grenades-framework.md @@ -68,3 +68,13 @@ The average amount of time in seconds, after `explosionTime` has passed, between ### 2.4 ace_grenades_flashbangIntervalMaxDeviation The amount of randomness in the fuse time. + +## 3. Events + +### 3.1 Listenable + +Event Name | Description | Passed Parameter(s) | Locality +---------- | ----------- | ------------------- | -------- +`ace_flashbangExploded` | A flashbang exploded | `[_grenadePosASL]` | Global +`ace_grenades_flashbangedAI` | A local AI was affected by a flashbang | `[_unit, _strength, _grenadePosASL]` | Local +`ace_grenades_flashbangedPlayer` | The local player was affected by a flashbang | `[_strength, _grenadePosASL]` | Local