diff --git a/addons/advanced_fatigue/XEH_postInit.sqf b/addons/advanced_fatigue/XEH_postInit.sqf index d566e3b042..be1da52bc0 100644 --- a/addons/advanced_fatigue/XEH_postInit.sqf +++ b/addons/advanced_fatigue/XEH_postInit.sqf @@ -1,6 +1,24 @@ #include "script_component.hpp" + if (!hasInterface) exitWith {}; +[missionNamespace, "ACE_setCustomAimCoef", QUOTE(ADDON), { + private _unit = ACE_player; + private _fatigue = _unit getVariable [QGVAR(aimFatigue), 0]; + + switch (stance _unit) do { + case ("CROUCH"): { + 1.0 + _fatigue ^ 2 * 0.1 + }; + case ("PRONE"): { + 1.0 + _fatigue ^ 2 * 2.0 + }; + default { + 1.5 + _fatigue ^ 2 * 3.0 + }; + }; +}] call EFUNC(common,arithmeticSetSource); + ["ace_settingsInitialized", { if (!GVAR(enabled)) exitWith {}; diff --git a/addons/advanced_fatigue/functions/fnc_handleEffects.sqf b/addons/advanced_fatigue/functions/fnc_handleEffects.sqf index e23b9d86cd..bec6e996be 100644 --- a/addons/advanced_fatigue/functions/fnc_handleEffects.sqf +++ b/addons/advanced_fatigue/functions/fnc_handleEffects.sqf @@ -77,14 +77,7 @@ if (_overexhausted) then { }; }; -switch (stance _unit) do { - case ("CROUCH"): { - _unit setCustomAimCoef (1.0 + _fatigue ^ 2 * 0.1); - }; - case ("PRONE"): { - _unit setCustomAimCoef (1.0 + _fatigue ^ 2 * 2.0); - }; - default { - _unit setCustomAimCoef (1.5 + _fatigue ^ 2 * 3.0); - }; -}; +_unit setVariable [QGVAR(aimFatigue), _fatigue]; + +private _aimCoef = [missionNamespace, "ACE_setCustomAimCoef", "max"] call EFUNC(common,arithmeticGetResult); +_unit setCustomAimCoef _aimCoef;