-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathfnc_startFallbackLoop.sqf
53 lines (40 loc) · 1.36 KB
/
fnc_startFallbackLoop.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Internal Function: CBA_fnc_startFallbackLoop
Description:
Starts a loop to iterate through all objects to initialize event handlers on XEH incompatible objects.
Internal use only.
Parameters:
None
Returns:
None
Examples:
(begin example)
call CBA_fnc_startFallbackLoop;
(end)
Author:
commy2
---------------------------------------------------------------------------- */
if (GVAR(fallbackRunning)) exitWith {};
GVAR(fallbackRunning) = true;
{
// don't run init and initPost event handlers on objects that already exist
SETINITIALIZED(_x);
} count (entities [[], [], true, true]); // count is safe here because SETINITIALIZED is a setVariable, which returns nil
GVAR(entities) = [];
[{
SCRIPT(fallbackLoopPFEH);
private _entities = entities [[], [], true, true];
if (_entities isNotEqualTo GVAR(entities)) then {
private _newEntities = _entities - GVAR(entities);
GVAR(entities) = _entities;
{
if !(ISPROCESSED(_x)) then {
_x call CBA_fnc_initEvents;
if !(ISINITIALIZED(_x)) then {
_x call CBA_fnc_init;
};
};
} forEach _newEntities;
};
}, 0.1, []] call CBA_fnc_addPerFrameHandler;