Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Feedback - fix heart rate effect #6927

Merged
merged 4 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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