2016-09-04 19:33:07 +00:00
|
|
|
#include "script_component.hpp"
|
2016-10-06 20:46:46 +00:00
|
|
|
|
2016-09-04 19:33:07 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2024-06-22 17:53:08 +00:00
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
|
|
call FUNC(renderDebugLines);
|
|
|
|
#endif
|
|
|
|
|
2023-06-27 16:40:07 +00:00
|
|
|
// recheck weapon inertia after weapon swap, change of attachments or switching unit
|
|
|
|
["weapon", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["loadout", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["unit", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2016-09-04 19:33:07 +00:00
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
|
2024-08-22 17:13:54 +00:00
|
|
|
[QEGVAR(ui,hideHud), LINKFUNC(updateStaminaBar)] call CBA_fnc_addEventHandler;
|
|
|
|
|
2024-03-21 19:24:49 +00:00
|
|
|
["baseline", {
|
|
|
|
private _fatigue = ACE_player getVariable [QGVAR(aimFatigue), 0];
|
|
|
|
switch (stance ACE_player) do {
|
|
|
|
case ("CROUCH"): {
|
|
|
|
(1.0 + _fatigue ^ 2 * 0.1)
|
|
|
|
};
|
|
|
|
case ("PRONE"): {
|
|
|
|
(1.0 + _fatigue ^ 2 * 2.0)
|
|
|
|
};
|
|
|
|
default {
|
|
|
|
(1.5 + _fatigue ^ 2 * 3.0)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
|
|
|
|
|
2016-09-04 19:33:07 +00:00
|
|
|
// - 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 -----------------------------------------
|
2024-06-22 17:53:08 +00:00
|
|
|
["unit", LINKFUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
2016-11-13 16:56:45 +00:00
|
|
|
|
2017-02-10 19:03:12 +00:00
|
|
|
["visibleMap", {
|
|
|
|
params ["", "_visibleMap"]; // command visibleMap is updated one frame later
|
2024-06-22 17:53:08 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]) ctrlShow (!_visibleMap && isNull objectParent ACE_player);
|
2017-02-10 19:03:12 +00:00
|
|
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["vehicle", {
|
2024-06-22 17:53:08 +00:00
|
|
|
(uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]) ctrlShow (!visibleMap && isNull objectParent ACE_player);
|
2017-02-10 19:03:12 +00:00
|
|
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
2016-09-04 19:33:07 +00:00
|
|
|
|
|
|
|
// - Duty factors -------------------------------------------------------------
|
2024-06-18 00:07:38 +00:00
|
|
|
if (GETEGVAR(medical,enabled,false)) then {
|
2016-09-07 20:05:39 +00:00
|
|
|
[QEGVAR(medical,pain), { // 0->1.0, 0.5->1.05, 1->1.1
|
2024-06-22 17:53:08 +00:00
|
|
|
linearConversion [0, 1, _this getVariable [QEGVAR(medical,pain), 0], 1, 1.1, true];
|
2016-09-07 20:05:39 +00:00
|
|
|
}] call FUNC(addDutyFactor);
|
2019-07-03 15:40:42 +00:00
|
|
|
[QEGVAR(medical,bloodVolume), { // 6->1.0, 5->1.167, 4->1.33
|
2024-06-22 17:53:08 +00:00
|
|
|
linearConversion [6, 0, _this getVariable [QEGVAR(medical,bloodVolume), 6], 1, 2, true];
|
2016-09-07 20:05:39 +00:00
|
|
|
}] call FUNC(addDutyFactor);
|
|
|
|
};
|
2024-01-01 01:45:01 +00:00
|
|
|
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
|
2016-09-07 20:05:39 +00:00
|
|
|
[QEGVAR(dragging,isCarrying), {
|
|
|
|
[1, 3] select (_this getVariable [QEGVAR(dragging,isCarrying), false]);
|
|
|
|
}] call FUNC(addDutyFactor);
|
|
|
|
};
|
2022-03-09 03:41:56 +00:00
|
|
|
// Weather has an off switch, Dragging & Medical don't.
|
|
|
|
if (missionNamespace getVariable [QEGVAR(weather,enabled), false]) then {
|
2016-09-07 20:05:39 +00:00
|
|
|
[QEGVAR(weather,temperature), { // 35->1, 45->2
|
2024-06-22 17:53:08 +00:00
|
|
|
linearConversion [35, 45, missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25], 1, 2, true];
|
2016-09-07 20:05:39 +00:00
|
|
|
}] call FUNC(addDutyFactor);
|
|
|
|
};
|
2016-09-04 19:33:07 +00:00
|
|
|
|
2016-09-23 21:40:52 +00:00
|
|
|
// - Add main loop at 1 second interval -------------------------------------------------------------
|
|
|
|
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
|
2016-09-04 19:33:07 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|