2016-12-01 19:54:03 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2018-07-18 20:50:03 +00:00
|
|
|
[QEGVAR(medical,injured), {
|
2018-07-18 18:21:27 +00:00
|
|
|
params ["_unit", "_painLevel"];
|
|
|
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2018-07-18 20:50:03 +00:00
|
|
|
[QEGVAR(medical,moan), {
|
2018-07-18 18:21:27 +00:00
|
|
|
params ["_unit", "_painLevel"];
|
|
|
|
[_unit, "moan", PAIN_TO_MOAN(_painLevel)] call FUNC(playInjuredSound);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-12-01 19:54:03 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2017-03-18 16:53:57 +00:00
|
|
|
GVAR(nextFadeIn) = 0;
|
2017-02-19 04:11:40 +00:00
|
|
|
GVAR(heartBeatEffectRunning) = false;
|
|
|
|
|
|
|
|
[false] call FUNC(initEffects);
|
|
|
|
[LINKFUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
|
2016-12-09 18:16:41 +00:00
|
|
|
|
|
|
|
["ace_unconscious", {
|
|
|
|
params ["_unit", "_unconscious"];
|
2018-07-18 18:13:25 +00:00
|
|
|
|
2016-12-09 18:16:41 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
|
|
|
|
2018-07-20 21:23:48 +00:00
|
|
|
// Toggle unconscious player's ability to talk in radio addons
|
2019-04-09 17:51:59 +00:00
|
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_unit setVariable ["tf_voiceVolume", [1, 0] select _unconscious, true];
|
|
|
|
_unit setVariable ["tf_unable_to_use_radio", _unconscious]; // Only used locally
|
|
|
|
};
|
|
|
|
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_unit setVariable ["acre_sys_core_isDisabled", _unconscious, true];
|
|
|
|
};
|
2018-07-20 21:23:48 +00:00
|
|
|
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
|
|
|
|
[QUOTE(ADDON), VOL_UNCONSCIOUS, _unconscious] call EFUNC(common,setHearingCapability);
|
|
|
|
|
2016-12-09 18:16:41 +00:00
|
|
|
[_unconscious, 1] call FUNC(effectUnconscious);
|
2017-01-29 19:24:16 +00:00
|
|
|
["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus);
|
2016-12-09 18:16:41 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2017-04-30 06:46:51 +00:00
|
|
|
|
2018-07-20 21:23:48 +00:00
|
|
|
// Reset volume upon death for spectators
|
|
|
|
[QEGVAR(medical,death), {
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
if (_unit != ACE_player) exitWith {};
|
2019-04-09 17:51:59 +00:00
|
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_unit setVariable ["tf_voiceVolume", 1, true];
|
|
|
|
_unit setVariable ["tf_unable_to_use_radio", false];
|
|
|
|
};
|
|
|
|
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_unit setVariable ["acre_sys_core_isDisabled", false, true];
|
|
|
|
};
|
2018-07-20 21:23:48 +00:00
|
|
|
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
// Update effects to match new unit's current status (this also handles respawn)
|
2017-04-30 06:46:51 +00:00
|
|
|
["unit", {
|
2019-04-09 17:51:59 +00:00
|
|
|
params ["_new"];
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2017-04-30 06:46:51 +00:00
|
|
|
private _status = _new getVariable ["ace_unconscious", false];
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2019-04-09 17:51:59 +00:00
|
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_new setVariable ["tf_voiceVolume", [1, 0] select _status, true];
|
|
|
|
_new setVariable ["tf_unable_to_use_radio", _status];
|
|
|
|
};
|
|
|
|
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
_new setVariable ["acre_sys_core_isDisabled", _status, true];
|
|
|
|
};
|
2018-07-20 21:23:48 +00:00
|
|
|
[QUOTE(ADDON), VOL_UNCONSCIOUS, _status] call EFUNC(common,setHearingCapability);
|
2017-04-30 06:46:51 +00:00
|
|
|
[_status, 0] call FUNC(effectUnconscious);
|
|
|
|
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|