Replace addPerFrameHandler for waitAndExecute

This commit is contained in:
esteldunedain 2016-01-20 13:05:47 -03:00
parent 80b9a8961a
commit 89106f6953
3 changed files with 32 additions and 12 deletions

View File

@ -34,15 +34,5 @@ GVAR(weaponInfoCache) setText QGVAR(weaponInfoCache);
[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
// Create a PFH to cool down all player weapons at (infrequent) regular intervals
[{
if (primaryWeapon ACE_player != "") then {
[ACE_player, primaryWeapon ACE_player, 0] call FUNC(updateTemperature);
};
if (handgunWeapon ACE_player != "") then {
[ACE_player, handgunWeapon ACE_player, 0] call FUNC(updateTemperature);
};
if (secondaryWeapon ACE_player != "") then {
[ACE_player, secondaryWeapon ACE_player, 0] call FUNC(updateTemperature);
};
}, 5, []] call CBA_fnc_addPerFrameHandler;
// Schedule cool down calculation of player weapons at (infrequent) regular intervals
[] call FUNC(updateTemperatureThread);

View File

@ -12,5 +12,6 @@ PREP(overheat);
PREP(swapBarrel);
PREP(swapBarrelCallback);
PREP(updateTemperature);
PREP(updateTemperatureThread);
ADDON = true;

View File

@ -0,0 +1,29 @@
/*
* Author: esteldunedain
* Update temperature of a weapon at regular intervals.
*
* Argument:
* None
*
* Return value:
* None
*
* Example:
* [] call ace_overheating_fnc_updateTemperatureThread
*
* Public: No
*/
#include "script_component.hpp"
if (primaryWeapon ACE_player != "") then {
[ACE_player, primaryWeapon ACE_player, 0] call FUNC(updateTemperature);
};
if (handgunWeapon ACE_player != "") then {
[ACE_player, handgunWeapon ACE_player, 0] call FUNC(updateTemperature);
};
if (secondaryWeapon ACE_player != "") then {
[ACE_player, secondaryWeapon ACE_player, 0] call FUNC(updateTemperature);
};
// Schedule for execution again after 5 seconds
[DFUNC(updateTemperatureThread), [], 5] call EFUNC(common,waitAndExecute);