mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Grenades - Flashbang reaction fixes (#8485)
* flashbang reaction debounce * fix skill reduction * store flash strength * Update addons/grenades/functions/fnc_flashbangExplosionEH.sqf Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> * Update addons/grenades/functions/fnc_flashbangExplosionEH.sqf Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> * Update addons/grenades/functions/fnc_flashbangExplosionEH.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
9ebe427f23
commit
3c1c081239
@ -47,28 +47,42 @@ private _affected = (ASLtoAGL _grenadePosASL) nearEntities ["CAManBase", 20];
|
||||
_affected = _affected - [ACE_player];
|
||||
{
|
||||
if (local _x && {alive _x}) then {
|
||||
private _strength = 1 - (((eyePos _x) vectorDistance _grenadePosASL) min 20) / 20;
|
||||
private _unit = _x;
|
||||
private _strength = 1 - (((eyePos _unit) vectorDistance _grenadePosASL) min 20) / 20;
|
||||
|
||||
TRACE_3("FlashBangEffect Start",_x,((getPosASL _x) vectorDistance _grenadePosASL),_strength);
|
||||
TRACE_3("FlashBangEffect Start",_unit,((getPosASL _unit) vectorDistance _grenadePosASL),_strength);
|
||||
|
||||
[_x, true] call EFUNC(common,disableAI);
|
||||
|
||||
_x setSkill (skill _x / 50);
|
||||
[_unit, true] call EFUNC(common,disableAI);
|
||||
|
||||
// Make AI try to look away
|
||||
private _dirToFlash = _x getDir _grenadePosASL;
|
||||
_x setDir (_dirToFlash + linearConversion [0.2, 1, _strength, 40, 135] * selectRandom [-1, 1]);
|
||||
private _dirToFlash = _unit getDir _grenadePosASL;
|
||||
_unit setDir (_dirToFlash + linearConversion [0.2, 1, _strength, 40, 135] * selectRandom [-1, 1]);
|
||||
|
||||
[{
|
||||
params ["_unit"];
|
||||
private _flashReactionDebounce = _unit getVariable [QGVAR(flashReactionDebounce), 0];
|
||||
_unit setVariable [QGVAR(flashReactionDebounce), _flashReactionDebounce max (CBA_missionTime + (7 * _strength))];
|
||||
if (_flashReactionDebounce < CBA_missionTime) then {
|
||||
// Not used interally but could be useful for other mods
|
||||
_unit setVariable [QGVAR(flashStrength), _strength, true];
|
||||
{
|
||||
_unit setSkill [_x, (_unit skill _x) / 50];
|
||||
} forEach SUBSKILLS;
|
||||
[{
|
||||
params ["_unit"];
|
||||
CBA_missiontime >= _unit getVariable [QGVAR(flashReactionDebounce), 0]
|
||||
},{
|
||||
params ["_unit"];
|
||||
|
||||
//Make sure we don't enable AI for unconscious units
|
||||
if !(_unit getVariable ["ace_isUnconscious", false]) then {
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
};
|
||||
_unit setVariable [QGVAR(flashStrength), 0, true];
|
||||
|
||||
_unit setSkill (skill _unit * 50);
|
||||
}, [_x], 7 * _strength] call CBA_fnc_waitAndExecute;
|
||||
// Make sure we don't enable AI for unconscious units
|
||||
if !(_unit getVariable ["ace_isUnconscious", false]) then {
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
};
|
||||
{
|
||||
_unit setSkill [_x, (_unit skill _x) * 50];
|
||||
} forEach SUBSKILLS;
|
||||
}, [_unit]] call CBA_fnc_waitUntilAndExecute;
|
||||
};
|
||||
};
|
||||
} count _affected;
|
||||
|
||||
|
@ -147,4 +147,6 @@
|
||||
|
||||
#define ZEUS_ACTION_CONDITION ([_target, {QUOTE(QUOTE(ADDON)) in curatorAddons _this}, missionNamespace, QUOTE(QGVAR(zeusCheck)), 1E11, 'ace_interactMenuClosed'] call EFUNC(common,cachedCall))
|
||||
|
||||
#define SUBSKILLS ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"]
|
||||
|
||||
#include "script_debug.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user