ACE3/addons/advanced_fatigue/XEH_postInit.sqf
BaerMitUmlaut cc414de8d1 Add Advanced Fatigue component (#4321)
* Initial commit advanced fatigue

* Added animation changes

* Fixes, rewrites

* Broadcast 3den attribute and fix UBC

* Further animation tweaks

* Added Eden attribute and CBA settings

* Switch to CBA events

* Add beautified component name

* Rewrites, fixes, tweaks

* Move setVars to GVARs

* Add setting to disable

* Switch to status effect handler for sprint and jog blocking

* Add component name

* Failsafe for early unit player EH

* Removed raised weapon penalty for pistols

* Added respawn compatibility

* Tweaked side jog animation speed

* Added support for virtual load

* Added stamina bar

* Remove debug flags

* Added custom duty factor functions and values

* Added structural comments

* Disabled CBA settings, added ACE settings

* Fixed config

* Added readme

* Remove leftover debug diag_logs

* Improved stringtable
2016-09-04 21:33:07 +02:00

51 lines
2.0 KiB
Plaintext

#include "script_component.hpp"
if (!hasInterface) exitWith {};
["ace_settingsInitialized", {
if (!GVAR(enabled)) exitWith {};
// - Post process effect ------------------------------------------------------
GVAR(ppeBlackout) = ppEffectCreate ["ColorCorrections", 4220];
GVAR(ppeBlackout) ppEffectEnable true;
GVAR(ppeBlackout) ppEffectForceInNVG true;
GVAR(ppeBlackout) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
GVAR(ppeBlackout) ppEffectCommit 0.4;
// - GVAR updating and initialization -----------------------------------------
if !(isNull ACE_player) then {
[ACE_player, objNull] call FUNC(handlePlayerChanged);
};
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
// - Duty factors -------------------------------------------------------------
[QEGVAR(medical,pain), {
1 + (((_this getVariable [QEGVAR(medical,pain), 0]) min 1) / 10)
}] call FUNC(addDutyFactor);
[QEGVAR(medical,bloodVolume), {
2 - (((_this getVariable [QEGVAR(medical,bloodVolume), 100]) min 100) / 100)
}] call FUNC(addDutyFactor);
[QEGVAR(dragging,isCarrying), {
if (_this getVariable [QEGVAR(dragging,isCarrying), false]) then {
3
} else {
1
};
}] call FUNC(addDutyFactor);
[QEGVAR(weather,temperature), {
(((missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]) - 35) / 10) max 2 min 1
}] call FUNC(addDutyFactor);
// - Add main PFH -------------------------------------------------------------
[FUNC(pfhMain), 1, []] call CBA_fnc_addPerFrameHandler;
}] call CBA_fnc_addEventHandler;
["ace_settingChanged", {
params ["_name", "_value"];
if (_name == QGVAR(enableStaminaBar) && {!_value}) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 0;
};
}] call CBA_fnc_addEventHandler;