ACE3/addons/common/functions/fnc_swayLoop.sqf
Grim cc26f00df3
Common/Adv. Fatigue/Medical - Add unified sway calculation (#9226)
* fix adv fatigue sway interaction with medical

* change medical sway scaling

* move to common

* function header

* number tweaks

* baseline is always at least 1

* Add error msgs and warn if using old ACE_setCustomAimCoef

* Update addons/common/functions/fnc_addSwayFactor.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-02 18:09:19 -04:00

31 lines
765 B
Plaintext

#include "script_component.hpp"
/*
* Author: LinkIsGrim
* Calculates and applies final sway coefficient from sway factors
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_common_fnc_swayLoop
*
* Public: No
*/
private _baseline = 1;
if (GVAR(swayFactorsBaseline) isNotEqualTo []) then {
_baseline = 1 max ([missionNamespace, "ACE_setCustomAimCoef_baseline", "max"] call EFUNC(common,arithmeticGetResult));
};
private _multiplier = 1;
if (GVAR(swayFactorsMultiplier) isNotEqualTo []) then {
_multiplier = [missionNamespace, "ACE_setCustomAimCoef_multiplier", "product"] call EFUNC(common,arithmeticGetResult);
};
ACE_player setCustomAimCoef (_baseline * _multiplier);
[FUNC(swayLoop), [], 1] call CBA_fnc_waitAndExecute