Medical Feedback - fix heart rate effect (#6927)

* Medical Fedback - fix heart rate effect

and limit setVar for acre/tfar

* Apply suggestions from code review

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* Update XEH_postInit.sqf

* use "task_force_radio"
This commit is contained in:
PabstMirror 2019-04-09 12:51:59 -05:00 committed by Magnetar
parent 0926d8508c
commit 69dc73ee45
2 changed files with 25 additions and 15 deletions

View File

@ -24,10 +24,13 @@ GVAR(heartBeatEffectRunning) = false;
if (_unit != ACE_player) exitWith {};
// Toggle unconscious player's ability to talk in radio addons
_unit setVariable ["tf_voiceVolume", [1, 0] select _unconscious, true];
_unit setVariable ["tf_unable_to_use_radio", _unconscious]; // Only used locally
_unit setVariable ["acre_sys_core_isDisabled", _unconscious, true];
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];
};
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
[QUOTE(ADDON), VOL_UNCONSCIOUS, _unconscious] call EFUNC(common,setHearingCapability);
@ -40,22 +43,29 @@ GVAR(heartBeatEffectRunning) = false;
params ["_unit"];
if (_unit != ACE_player) exitWith {};
_unit setVariable ["tf_voiceVolume", 1, true];
_unit setVariable ["tf_unable_to_use_radio", false];
_unit setVariable ["acre_sys_core_isDisabled", false, true];
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];
};
[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)
["unit", {
params ["_new", "_old"];
params ["_new"];
private _status = _new getVariable ["ace_unconscious", false];
_new setVariable ["tf_voiceVolume", [1, 0] select _status, true];
_new setVariable ["tf_unable_to_use_radio", _status];
_new setVariable ["acre_sys_core_isDisabled", _status, true];
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];
};
[QUOTE(ADDON), VOL_UNCONSCIOUS, _status] call EFUNC(common,setHearingCapability);
[_status, 0] call FUNC(effectUnconscious);
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);

View File

@ -4,18 +4,18 @@
* Handles the hear beat sound.
*
* Arguments:
* 0: Heart rate <NUMBER>
* None
*
* Return Value:
* None
*
* Example:
* [120] call ace_medical_feedback_fnc_effectHeartBeat
* [] call ace_medical_feedback_fnc_effectHeartBeat
*
* Public: No
*/
params ["_heartRate"];
private _heartRate = GET_HEART_RATE(ACE_player);
if (_heartRate == 0) exitWith {
TRACE_1("Ending heart beat effect - zero",_heartRate);