ACE3/addons/common/functions/fnc_execNextFrame.sqf

35 lines
777 B
Plaintext
Raw Normal View History

2015-01-17 16:56:24 +00:00
/*
* Author: CAA-Picard
*
* Executes a code on the next frame
*
* Argument:
* 0: Code to execute (Code)
* 1: Parameters to run the code with (Array)
*
* Return value:
* PFH handler ID
*/
#include "script_component.hpp"
2015-01-18 18:26:26 +00:00
EXPLODE_2_PVT(_this,_func,_params);
2015-01-17 16:56:24 +00:00
[
{
EXPLODE_2_PVT(_this,_params,_pfhId);
EXPLODE_2_PVT(_params,_delayedExecParams,_startFrame);
2015-01-18 18:26:26 +00:00
EXPLODE_2_PVT(_delayedExecParams,_func,_funcParams);
2015-01-17 16:56:24 +00:00
// Exit if we are still on the same frame
if (diag_frameno == _startFrame) exitWith {};
// Remove the PFH
[_pfhId] call cba_fnc_removePerFrameHandler;
// Execute the function
_funcParams call _func;
},
_interval,
[_this, diag_frameno]
] call CBA_fnc_addPerFrameHandler