Replaced some PFH by waitandExecute

This commit is contained in:
Thomas Kooi 2015-01-21 21:37:03 +01:00
parent 77bd8f753d
commit 7020a8ef30
2 changed files with 24 additions and 35 deletions

View File

@ -52,8 +52,8 @@ if (!_found && (random(1)>0.2)) then {
if (_waitingTime > 0) then { if (_waitingTime > 0) then {
[{ [{
private ["_params", "_config", "_person", "_amount","_bodyPart","_woundClass","_item", "_bandagedWounds","_bandagedBodyPart","_bandagedWoundClass","_openWounds", "_openWoundsBodyPart","_openWoundClass"]; private ["_params", "_config", "_person", "_amount","_bodyPart","_woundClass","_item", "_bandagedWounds","_bandagedBodyPart","_bandagedWoundClass","_openWounds", "_openWoundsBodyPart","_openWoundClass"];
_params = (_this select 0) select 0; _params = _this select 0;
_config = (_this select 0) select 1; _config = _this select 1;
_person = _params select 0; _person = _params select 0;
_amount = _params select 1; _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; ["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, _selectedConfig], _waitingTime, _waitingTime] call EFUNC(common,waitAndExecute);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
} , _waitingTime, [_this, _selectedConfig] ] call CBA_fnc_addPerFrameHandler;
}; };

View File

@ -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"]; _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"]; _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"]; _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 {}; if (GVAR(playingHeartBeatSound)) exitwith {};
GVAR(playingHeartBeatSound) = true; GVAR(playingHeartBeatSound) = true;
@ -30,35 +28,29 @@ FUNC(hb_effect) = {
_sound = _hbSoundsSlow select (random((count _hbSoundsSlow) -1)); _sound = _hbSoundsSlow select (random((count _hbSoundsSlow) -1));
playSound _sound; playSound _sound;
[{ [{
if (time - ((_this select 0) select 1) < ((_this select 0) select 0)) exitwith {}; GVAR(playingHeartBeatSound) = false;
}, [], _sleep, _sleep] call EFUNC(common,waitAndExecute);
GVAR(playingHeartBeatSound) = false;
[(_this select 1)] call cba_fnc_removePerFrameHandler;
}, _sleep, [_sleep, time] ] call CBA_fnc_addPerFrameHandler;
} else { } else {
if (_heartRate > 120) then { if (_heartRate > 120) then {
_sound = _hbSoundsFast select (random((count _hbSoundsFast) -1)); _sound = _hbSoundsFast select (random((count _hbSoundsFast) -1));
playSound _sound; playSound _sound;
[{ [{
if (time - ((_this select 0) select 1) < ((_this select 0) select 0)) exitwith {};
GVAR(playingHeartBeatSound) = false; GVAR(playingHeartBeatSound) = false;
[(_this select 1)] call cba_fnc_removePerFrameHandler; }, [], _sleep, _sleep] call EFUNC(common,waitAndExecute);
}, _sleep, [_sleep, time] ] call CBA_fnc_addPerFrameHandler;
}; };
}; };
}; };
GVAR(playingHeartBeatSound) = false;
GVAR(BloodLevel_CC) = ppEffectCreate ["ColorCorrections", 4208]; 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) ppEffectAdjust [1,1,0, [0,0,0,0], [1,1,1,1], [0.2,0.2,0.2,0]];
GVAR(BloodLevel_CC) ppEffectCommit 0; GVAR(BloodLevel_CC) ppEffectCommit 0;
[{ [{
private ["_unit","_bloodLoss"]; private ["_unit","_bloodLoss", "_bloodVolume"];
_unit = ACE_player; _unit = ACE_player;
if ([_unit] call EFUNC(common,isAwake)) then { if ([_unit] call EFUNC(common,isAwake)) then {
_bloodLoss = _unit call FUNC(getBloodLoss); _bloodLoss = _unit call FUNC(getBloodLoss);
@ -66,22 +58,22 @@ GVAR(BloodLevel_CC) ppEffectCommit 0;
[_bloodLoss] call EFUNC(gui,effectBleeding); [_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 0) getvariable[QGVAR(amountOfPain), 0])] call EFUNC(gui,effectPain);
[(_this select 1)] call cba_fnc_removePerFrameHandler; }, [_unit], 0.25, 0.25] call EFUNC(common,waitAndExecute);
}, 0.25, [_unit] ] call CBA_fnc_addPerFrameHandler;
[(_unit getvariable[QGVAR(heartRate), 70])] call FUNC(hb_effect); [(_unit getvariable[QGVAR(heartRate), 70])] call FUNC(hb_effect);
["medicalEffectsLoop", [_unit]] call ace_common_fnc_localEvent ["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; } , 0.5, [] ] call CBA_fnc_addPerFrameHandler;