-
Notifications
You must be signed in to change notification settings - Fork 37
/
x_isledefense.sqf
73 lines (65 loc) · 1.56 KB
/
x_isledefense.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// by Xeno
//#define __DEBUG__
#define THIS_FILE "x_isledefense.sqf"
#include "..\x_setup.sqf"
if !(call d_fnc_checkSHC) exitWith {};
#ifndef __DEBUG__
sleep 85.321;
#else
sleep 5;
d_all_igrps_vecs = [];
#endif
__TRACE("before isServer check")
if (isMultiplayer && {isServer && {!isNil "HC_D_UNIT"}}) exitWith {};
__TRACE("after isServer check")
d_old_old_start = [0,0,0];
private _isle_grps = [];
for "_i" from 1 to (d_with_isledefense # 4) do {
_isle_grps pushBack (call d_fnc_make_isle_grp);
sleep 3.012;
};
__TRACE_1("","_isle_grps")
while {true} do {
#ifndef __DEBUG__
sleep 300 + random 300;
#else
sleep 10;
#endif
{
_x params ["_igrp"];
private _make_new = false;
#ifdef __DEBUG__
d_all_igrps_vecs append (_x # 2);
#endif
if (!isNull _igrp) then {
if ((units _igrp) findIf {alive _x} == -1) then {
_make_new = true;
} else {
(_x # 2) findIf {
private _ret = _x distance2D (_x getVariable ["d_cur_pos", [0, 0, 0]]) < 100 || {!canMove _x};
if (!_ret) then {
_x setVariable ["d_cur_pos", getPosASL _x];
} else {
_make_new = true;
};
_ret
};
};
} else {
_make_new = true;
};
sleep 0.3;
if (_make_new) then {
{_x call d_fnc_DelVecAndCrew; sleep 0.01} forEach ((_x # 2) select {!isNull _x});
sleep 0.01;
{deleteVehicle _x; sleep 0.01} forEach (_x # 1);
_isle_grps set [_forEachIndex, call d_fnc_make_isle_grp];
sleep 3.012;
};
#ifndef __DEBUG__
sleep 50 + random 50;
#else
sleep 5;
#endif
} forEach _isle_grps;
};