ACE3/addons/medical_ui/functions/fnc_effectHeartBeat.sqf
2017-01-29 21:59:24 +01:00

30 lines
638 B
Plaintext

/*
* Author: BaerMitUmlaut
* Handles the hear beat sound.
*
* Arguments:
* None
*
* Return Value:
* None
*/
#include "script_component.hpp"
private _heartRate = ACE_player getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE]
private _waitTime = 60 / _heartRate;
if (_heartRate == 0) exitWith {};
if (CBA_missionTime - GVAR(lastHeartBeatSound) > _waitTime) then {
GVAR(lastHeartBeatSound) = CBA_missionTime;
switch (true) do {
case (_heartRate > 160): {
playSound SND_HEARBEAT_FAST;
};
case (_heartRate < 60): {
playSound SND_HEARBEAT_SLOW;
};
};
};