-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzmm_setup_world.sqf
77 lines (64 loc) · 2.51 KB
/
zmm_setup_world.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
74
75
76
77
// Spawns a markers/missions over all locations in a world.
// Largest locations take priority over smaller ones on checking distance.
if !isServer exitWith {};
["INFO", format["Populating World: %1 (%2km)", worldName, round (worldSize / 1000)]] call zmm_fnc_logMsg;
private _counter = 0;
{
_configType = _x;
{
_pos = getArray (_x >> 'position');
_radius = getNumber (_x >> 'radiusA') max getNumber (_x >> 'radiusB');
_locType = getText (_x >> 'type');
_locName = getText (_x >> 'name');
_pos set [2,0];
_create = true;
_bypass = false;
// Distance Checks
{
_mkrPos = getMarkerPos _x;
_mkrSiz = (getMarkerSize _x) select 0;
_mkrStr = toUpper _x;
// Make sure we're far enough away.
if (_mkrStr find "_MAX" > 0) then {
if ((_pos distance2D _mkrPos) <= (_radius * 2) + (_mkrSiz * 1.5)) then { _create = false };
};
// Never create within another area or safe zone.
if (_mkrStr find "_MIN" > 0 || _mkrStr find "SAFEZONE" >= 0) then {
if (_pos inArea _x) then { _bypass = true };
};
// Don't let the area be too big.
_radius = (_radius min 500) max 200;
if _bypass exitWith {};
} forEach allMapMarkers;
if (!_bypass) then {
// Water Check for small islands
private _water = 0;
{ if (surfaceIsWater (_pos getPos [_radius, _x])) then { _water = _water + 1 } } forEach [0,45,90,135,180,225,270,315];
if ((_water / 8) < 0.875) then {
// Objective Zone
if _create then {
// Are we in CTI Mode?
if (ZZM_Mode > 0) then {
_zoneId = [_pos, _locType, _radius, _locName ] call zmm_fnc_setupZone;
_counter = _counter + 1;
} else {
_zoneId = [_pos, "Ambient", _radius, _locName, _locType ] call zmm_fnc_setupZone;
_counter = _counter + 1;
};
} else {
if (random 100 > 50 && ({ _pos inArea _x } count allMapMarkers) < 3) then {
_zoneID = [_pos, "Ambient", _radius, _locName, _locType] call zmm_fnc_setupZone;
_counter = _counter + 1;
};
};
};
};
} forEach ("getText (_x >> 'type') == _configType" configClasses (configFile >> "CfgWorlds" >> worldName >> "Names"));
} forEach ["Airport", "NameCityCapital", "NameCity", "NameVillage", "NameLocal"];
// TODO: Custom Locations Here?
//
{
_zoneId = [getPos _x, "NameVillage", 250, format["Location %1", _forEachIndex] ] call zmm_fnc_setupZone;
_counter = _counter + 1;
} forEach (allMissionObjects "logic" select { str _x find "ZMM_LOC_" >= 0 });
["INFO", format["Populating World: Complete (%1 Zones)", _counter]] call zmm_fnc_logMsg;