-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapMarkers.sqf
178 lines (146 loc) · 5 KB
/
mapMarkers.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
private ["_markerNames", "_getMarkerName", "_getVehicleMarkerType"];
_markerNames = [ ];
_getMarkerName = {
name (_this select 0) + "_position";
};
_getVehicleMarkerType = {
private ["_veh", "_markerType", "_markerText"];
_veh = _this select 0;
_markerText = "";
_markerType = "";
if(_veh in allUnitsUAV) exitWith { ["b_uav", "UAV"]; };
if(_veh isKindOf "Helicopter") then
{
_markerType = "b_air";
_markerText = "Air: ";
}
else
{
if(_veh isKindOf "Ship") then
{
_markerType = "b_unknown";
_markerText = "Sea: ";
}
else
{
_markerType = "b_recon";
_markerText = "Land: ";
};
};
[_markerType, _markerText];
};
while{true} do
{
private ["_units"];
_units = [side player] call Mh_fnc_getSideUnits;
private ["_oldMarkerNames"];
_oldMarkerNames = _markerNames;
_markerNames = [ ];
{
if(alive _x) then
{
if(vehicle _x != _x && _x in _units) then
{
private ["_crew", "_un"];
_crew = crew vehicle _x;
_un = _x;
{
if(_x != _un) then
{
_units = _units - [ _x ];
};
} forEach _crew;
};
}
else
{
_units = _units - [ _x ];
};
} forEach ([side player] call Mh_fnc_getSideUnits);
{
private ["_markerName"];
_markerName = [_x] call _getMarkerName;
createMarkerLocal [_markerName, position _x];
_markerName setMarkerPosLocal position _x;
_markerName setMarkerSizeLocal [0.75, 0.75];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerColorLocal "ColorWEST";
_markerNames pushBack _markerName;
if(vehicle _x == _x) then
{
_markerName setMarkerTypeLocal "b_inf";
_markerName setMarkerTextLocal name _x;
}
else
{
private ["_driver", "_markerText", "_veh", "_crew"];
_veh = vehicle _x;
_driver = driver vehicle _x;
_crew = crew _veh;
private["_vehMark"];
_vehMark = [_veh] call _getVehicleMarkerType;
_markerText = _vehMark select 1;
_markerName setMarkerTypeLocal (_vehMark select 0);
{
if(isPlayer _x) then
{
_markerText = _markerText + name _x;
if(_crew select (count _crew - 1) != _x) then
{
_markerText = _markerText + ",";
};
}
} forEach _crew;
_markerName setMarkerTextLocal _markerText;
};
} forEach _units;
private["_respawnVehicles"];
_respawnVehicles = [ ];
if(!isNil "respawnVehicles") then
{
// Remove occupied respawn vehicles
{
if(side player == (_x getVariable["mh_respawnvehicle_side", civilian]) && count crew _x == 0) then { _respawnVehicles pushBack _x; };
} forEach respawnVehicles;
};
private["_i"];
_i = 0;
{
private ["_markerName"];
_markerName = format ["respawn%1_position", _i];
private ["_vehMark"];
_vehMark = [_x] call _getVehicleMarkerType;
createMarkerLocal [_markerName, position _x];
_markerName setMarkerPosLocal position _x;
_markerName setMarkerSizeLocal [0.75, 0.75];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerColorLocal "ColorWEST";
_markerName setMarkerTypeLocal (_vehMark select 0);
_markerName setMarkerTextLocal ((_vehMark select 1) + "Respawn veh.");
_markerNames pushBack _markerName;
_i = _i + 1;
} forEach _respawnVehicles;
_i = 0;
{
if(alive _x && isUAVConnected _x && side player == side _x) then
{
private ["_markerName"];
_markerName = format ["uav%1_position", _i];
private ["_vehMark"];
_vehMark = [_x] call _getVehicleMarkerType;
createMarkerLocal [_markerName, position _x];
_markerName setMarkerPosLocal position _x;
_markerName setMarkerSizeLocal [0.75, 0.75];
_markerName setMarkerShapeLocal "ICON";
_markerName setMarkerColorLocal "ColorWEST";
_markerName setMarkerTypeLocal (_vehMark select 0);
_markerName setMarkerTextLocal (_vehMark select 1);
_markerNames pushBack _markerName;
};
} forEach allUnitsUAV;
// Clear unused markers
{
deleteMarkerLocal _x;
} forEach (_oldMarkerNames - _markerNames);
sleep 2;
};