diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index 721def7d3d..cc27dbdee7 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -52,8 +52,8 @@ if (!_found && (random(1)>0.2)) then { if (_waitingTime > 0) then { [{ private ["_params", "_config", "_person", "_amount","_bodyPart","_woundClass","_item", "_bandagedWounds","_bandagedBodyPart","_bandagedWoundClass","_openWounds", "_openWoundsBodyPart","_openWoundClass"]; - _params = (_this select 0) select 0; - _config = (_this select 0) select 1; + _params = _this select 0; + _config = _this select 1; _person = _params select 0; _amount = _params select 1; @@ -79,8 +79,5 @@ if (_waitingTime > 0) then { ["Medical_onWoundsReopened", [_person, (_amount * (_config select RATIO)), _bodyPart, _woundClass, _item]] call ace_common_fnc_localEvent; }; - // Delete this PFH, so it is only executed once - [(_this select 1)] call cba_fnc_removePerFrameHandler; - } , _waitingTime, [_this, _selectedConfig] ] call CBA_fnc_addPerFrameHandler; - + }, [_this, _selectedConfig], _waitingTime, _waitingTime] call EFUNC(common,waitAndExecute); }; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDisplayEffects.sqf b/addons/medical/functions/fnc_handleDisplayEffects.sqf index 9a34368ba8..e4b0621791 100644 --- a/addons/medical/functions/fnc_handleDisplayEffects.sqf +++ b/addons/medical/functions/fnc_handleDisplayEffects.sqf @@ -19,9 +19,7 @@ FUNC(hb_effect) = { _hbSoundsFast = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; _hbSoundsNorm = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; _hbSoundsSlow = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; - if (isnil QGVAR(playingHeartBeatSound)) then { - GVAR(playingHeartBeatSound) = false; - }; + if (GVAR(playingHeartBeatSound)) exitwith {}; GVAR(playingHeartBeatSound) = true; @@ -30,35 +28,29 @@ FUNC(hb_effect) = { _sound = _hbSoundsSlow select (random((count _hbSoundsSlow) -1)); playSound _sound; - [{ - if (time - ((_this select 0) select 1) < ((_this select 0) select 0)) exitwith {}; - - GVAR(playingHeartBeatSound) = false; - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }, _sleep, [_sleep, time] ] call CBA_fnc_addPerFrameHandler; + [{ + GVAR(playingHeartBeatSound) = false; + }, [], _sleep, _sleep] call EFUNC(common,waitAndExecute); } else { if (_heartRate > 120) then { _sound = _hbSoundsFast select (random((count _hbSoundsFast) -1)); playSound _sound; [{ - if (time - ((_this select 0) select 1) < ((_this select 0) select 0)) exitwith {}; - GVAR(playingHeartBeatSound) = false; - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }, _sleep, [_sleep, time] ] call CBA_fnc_addPerFrameHandler; + }, [], _sleep, _sleep] call EFUNC(common,waitAndExecute); }; }; }; - +GVAR(playingHeartBeatSound) = false; GVAR(BloodLevel_CC) = ppEffectCreate ["ColorCorrections", 4208]; -GVAR(BloodLevel_CC) ppEffectForceInNVG True; +GVAR(BloodLevel_CC) ppEffectForceInNVG true; GVAR(BloodLevel_CC) ppEffectAdjust [1,1,0, [0,0,0,0], [1,1,1,1], [0.2,0.2,0.2,0]]; GVAR(BloodLevel_CC) ppEffectCommit 0; [{ - private ["_unit","_bloodLoss"]; + private ["_unit","_bloodLoss", "_bloodVolume"]; _unit = ACE_player; if ([_unit] call EFUNC(common,isAwake)) then { _bloodLoss = _unit call FUNC(getBloodLoss); @@ -66,22 +58,22 @@ GVAR(BloodLevel_CC) ppEffectCommit 0; [_bloodLoss] call EFUNC(gui,effectBleeding); }; - // Blood Level Effect - _currentBlood = _unit getVariable [QGVAR(bloodVolume), 100]; - if (_currentBlood > 99) then { - GVAR(BloodLevel_CC) ppEffectEnable False; - } else { - GVAR(BloodLevel_CC) ppEffectEnable True; - GVAR(BloodLevel_CC) ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [1, 1, 1,_currentBlood], [0.2, 0.2, 0.2, 0]]; - GVAR(BloodLevel_CC) ppEffectCommit 0; - }; - [{ - [((_this select 0) select 0 getvariable[QGVAR(amountOfPain), 0])] call EFUNC(gui,effectPain); - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }, 0.25, [_unit] ] call CBA_fnc_addPerFrameHandler; + [((_this select 0) getvariable[QGVAR(amountOfPain), 0])] call EFUNC(gui,effectPain); + }, [_unit], 0.25, 0.25] call EFUNC(common,waitAndExecute); [(_unit getvariable[QGVAR(heartRate), 70])] call FUNC(hb_effect); ["medicalEffectsLoop", [_unit]] call ace_common_fnc_localEvent }; + + // Blood Level Effect + _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; + if (_bloodVolume > 99 || !alive _unit) then { + GVAR(BloodLevel_CC) ppEffectEnable false; + } else { + GVAR(BloodLevel_CC) ppEffectEnable true; + GVAR(BloodLevel_CC) ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [1, 1, 1,_bloodVolume/100], [0.2, 0.2, 0.2, 0]]; + GVAR(BloodLevel_CC) ppEffectCommit 0; + }; + } , 0.5, [] ] call CBA_fnc_addPerFrameHandler;