Skip to content

Commit

Permalink
Medical Feedback - fix heart rate effect (#6927)
Browse files Browse the repository at this point in the history
* Medical Fedback - fix heart rate effect

and limit setVar for acre/tfar

* Apply suggestions from code review

Co-Authored-By: PabstMirror <[email protected]>

* Update XEH_postInit.sqf

* use "task_force_radio"
  • Loading branch information
PabstMirror authored and TheMagnetar committed Apr 9, 2019
1 parent 0926d85 commit 69dc73e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
34 changes: 22 additions & 12 deletions addons/medical_feedback/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions addons/medical_feedback/functions/fnc_effectHeartBeat.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 69dc73e

Please sign in to comment.