implement arithmetic source for fatigue system (#4517)

This commit is contained in:
commy2 2016-10-06 22:46:46 +02:00 committed by GitHub
parent 853c7db1dc
commit 673f3b4f9f
2 changed files with 22 additions and 11 deletions

View File

@ -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 {};

View File

@ -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;