mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
common: added execNextFrame function
This commit is contained in:
parent
4926b6970b
commit
c851a14da9
@ -31,6 +31,7 @@ PREP(displayTextPicture);
|
|||||||
PREP(displayTextStructured);
|
PREP(displayTextStructured);
|
||||||
PREP(doAnimation);
|
PREP(doAnimation);
|
||||||
PREP(endRadioTransmission);
|
PREP(endRadioTransmission);
|
||||||
|
PREP(execNextFrame);
|
||||||
PREP(execPersistentFnc);
|
PREP(execPersistentFnc);
|
||||||
PREP(execRemoteFnc);
|
PREP(execRemoteFnc);
|
||||||
PREP(executePersistent);
|
PREP(executePersistent);
|
||||||
|
34
addons/common/functions/fnc_execNextFrame.sqf
Normal file
34
addons/common/functions/fnc_execNextFrame.sqf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
EXPLODE_4_PVT(_this,_func,_params,_delay,_interval);
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
EXPLODE_2_PVT(_this,_params,_pfhId);
|
||||||
|
EXPLODE_2_PVT(_params,_delayedExecParams,_startFrame);
|
||||||
|
EXPLODE_3_PVT(_delayedExecParams,_func,_funcParams);
|
||||||
|
|
||||||
|
// 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
|
Loading…
Reference in New Issue
Block a user