Skip to content

Commit a996fa6

Browse files
committed
v1.0.1
1 parent d8927ab commit a996fa6

File tree

10 files changed

+563
-119
lines changed

10 files changed

+563
-119
lines changed

@AIO_SPPack/addons/AIO_AIMENU.pbo

14 KB
Binary file not shown.

@AIO_SPPack/addons/AIO_AIMENU/cfgFunctions.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class CfgFunctions
5151
class createTargetMenu {};
5252
class createCheatsMenu {};
5353
class createExplosivesMenu {};
54+
class createSupportMenu_HC {};
5455
};
5556
class highCommand
5657
{
Lines changed: 109 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
params ["_supType"];
2-
private ["_mode", "_units", "_supType", "_type", "_static", "_unit", "_crew", "_role", "_turret", "_text"];
3-
_units = [];
4-
5-
{
6-
_units pushback (AIO_HCSelectedUnits select _x);
7-
} forEach AIO_HCSelectedUnitsNum;
1+
params ["_units", "_supType", "_isHC"];
2+
private ["_mode", "_supType", "_type", "_static", "_unit", "_crew", "_role", "_turret", "_text"];
83

94
if (count _units == 0) exitWith {};
105

11-
AIO_supportGroups append _units;
12-
6+
_subUnits = [];
137
if (_supType == 0) then {
148
_mode = 1;
159
{
10+
_unit = _x;
1611
_back = backpack _x;
1712
_veh = vehicle _x;
18-
if (getText (configfile >> "CfgVehicles" >> _back >> "faction") != "Default" && (_mode != 2)) then {_mode = 1};
19-
if ((_veh isKindOf "Staticweapon") || (getText(configfile >> "CfgVehicles" >> typeOf _veh >> "editorSubcategory") == "EdSubcat_Artillery")) then {_mode = 2};
13+
if (getText (configfile >> "CfgVehicles" >> _back >> "faction") != "Default" && _back != "") then {_mode = 1; _subUnits pushBack _x};
14+
if ((_veh isKindOf "Staticweapon") || (getText(configfile >> "CfgVehicles" >> typeOf _veh >> "editorSubcategory") == "EdSubcat_Artillery")) exitWith {_mode = 2};
2015
} forEach _units;
2116
};
2217

23-
if (isNil "AIO_support_requester" || {isNull AIO_support_requester}) then {
18+
if (isNil "AIO_support_requester" || {!alive AIO_support_requester}) then {
2419
AIO_support_requester = "SupportRequester"createVehicleLocal [0, 0, 0];
2520
AIO_support_requester setVehicleVarName "AIO_support_requester";
2621
};
@@ -37,78 +32,111 @@ if (isNil "AIO_support_requester" || {isNull AIO_support_requester}) then {
3732
"Transport"
3833
];
3934

35+
36+
_originalGroup = group (_units select 0);
37+
4038
call {
4139
_continue = false;
42-
if (_subType == 0) exitWith {
43-
{
44-
_unit = _x;
45-
if ((vehicle _unit) isKindOf "Tank" || (vehicle _unit) isKindOf "staticweapon") exitWith {_continue = true};
46-
} forEach _units;
47-
48-
if !(_continue) then {_unit = _units select 0};
40+
if (_supType == 0) exitWith {
4941

50-
if (count _units != 2 && _mode == 1) exitWith {hintSilent "You need to select 2 members."};
42+
if (count _subUnits < 2 && _mode == 1) exitWith {hintSilent "You need to select 2 members."};
5143

5244
_veh = vehicle _unit;
5345

5446
_crew = fullCrew [vehicle _unit, "", false];
5547
{
5648
if (_x select 0 == _unit) then {_role = _x select 1; if (_role == "Turret") then {_turret = _x select 3}};
5749
} forEach _crew;
58-
AIO_support_arty_grp = createGroup (side player);
50+
51+
if (_mode == 1) then {
52+
_unit1 = _subUnits select 0;
53+
_unit2 = _subUnits select 1;
54+
55+
_tempUnit = objNull;
56+
_originalLeader = leader _originalGroup;
57+
if (_unit1 == _originalLeader || _unit2 == _originalLeader) then {
58+
_tempUnit = _originalGroup createUnit [typeOf _unit, [0,0,1e6], [], 0, "NONE"];
59+
60+
_originalGroup selectLeader _tempUnit;
61+
_tempUnit enableSimulation false;
62+
};
63+
64+
sleep 1;
65+
66+
_pos = ASLToAGL(getPosASL _unit1) vectorAdd [0,0,0.5];
67+
68+
_target = [_unit1] call AIO_fnc_getHideFrom;
69+
70+
_dir = if (!alive _target) then {0} else {_pos getDir (getPosASL _target)};
71+
72+
[_unit1,[14,_unit2,[_pos,_dir],objNull], 0] call AIO_fnc_pushToQueue;
73+
[_unit2,[14,_unit1,[_pos,_dir],objNull], 0] call AIO_fnc_pushToQueue;
74+
[_unit1, _unit2] call AIO_fnc_sync;
75+
76+
waitUntil {sleep 1; !(_unit1 in AIO_taskedUnits) && !(_unit2 in AIO_taskedUnits)};
77+
78+
sleep 3;
79+
80+
_vehs = _unit1 nearObjects ["staticweapon", 10];
81+
if (alive _tempUnit) then {deleteVehicle _tempUnit};
82+
83+
if (count _vehs == 0) then {
84+
_vehs = _unit2 nearObjects ["staticweapon", 10];
85+
if (count _vehs != 0) then {_continue = true}
86+
} else {
87+
_continue = true
88+
};
89+
90+
if !(_continue) exitWith {};
91+
92+
_veh = _vehs select 0;
93+
_role = "Gunner";
94+
95+
_originalGroup selectLeader _originalLeader;
96+
_continue = true;
97+
} else {
98+
_continue = true
99+
};
100+
101+
if !(_continue) exitWith {hintSilent "Cannot create a group with the selected unit(s)"};
102+
103+
AIO_support_arty_grp = createGroup (side _originalGroup);
59104

60105
_units joinSilent AIO_support_arty_grp;
61106

62107
AIO_support_arty_grp selectLeader _unit;
63108

64-
if (isNil "AIO_support_arty" || {isNull AIO_support_arty}) then {
109+
if (isNil "AIO_support_arty" || {!alive AIO_support_arty}) then {
65110
AIO_support_arty = "SupportProvider_Artillery" createVehicleLocal [0, 0, 0];
66111
AIO_support_arty setVehicleVarName "AIO_support_arty";
67112
};
68-
if (_mode == 1) then {
69-
_support_handler = [_units, getPos _unit] spawn AIO_fnc_assembleStatic;
70-
waitUntil {scriptDone _support_handler};
71-
sleep 5;
72-
_static = _unit nearObjects ["staticweapon", 10];
73-
_units = _units - [_unit];
74-
_units joinSilent group player;
75-
_static = _static select 0;
76-
//_support_handler = [[_unit], _static, 0, false] call AIO_fnc_getIn;
77-
_unit assignAsGunner _static;
78-
[_unit] orderGetIn true;
79-
waitUntil {vehicle _unit != _unit || !alive _unit || !(_unit in (units AIO_support_arty_grp))};
80-
sleep 1;
81-
_veh = _static; _role = "Gunner";
82-
};
83-
84-
if (isNil "_role") exitWith {hintSilent "Cannot create a group with the selected unit(s)"; _units joinSilent (group player)};
85113

86114
if (_role == "Turret") then {_text = format ["_unit assignAs%1 [_veh, %2]", _role, _turret]} else {_text = format ["_unit assignAs%1 _veh", _role]};
87115

88116
call compile _text;
89117
{
90-
if !(_x in (units AIO_support_arty_grp)) then {[_x] join AIO_support_arty_grp};
118+
if !(_x in (units AIO_support_arty_grp)) then {[_x] join AIO_support_arty_grp; _units pushBackUnique _x};
91119
} forEach crew(vehicle _unit);
92120

93-
(units AIO_support_arty_grp) orderGetIn true;
94-
95-
AIO_supportGroups append (crew (vehicle _unit) - [_unit]);
96-
97121
{
98-
if (vehicle _x != vehicle _unit) then {[_x] joinSilent group player; AIO_supportGroups = AIO_supportGroups - [_x]};
99-
} forEach (units AIO_support_arty_grp);
122+
if (vehicle _x != _veh) then {[_x] joinSilent _originalGroup; _units = _units - [_x]};
123+
} forEach ((units AIO_support_arty_grp) - [_unit]);
100124

101-
_unit = (leader AIO_support_arty_grp);
125+
(units AIO_support_arty_grp) orderGetIn true;
126+
127+
//_unit = (leader AIO_support_arty_grp);
102128

103129
_unit synchronizeObjectsAdd [AIO_support_arty];
104130

105131
player synchronizeObjectsAdd [AIO_support_requester];
106132

107133
[player, AIO_support_requester, AIO_support_arty] call BIS_fnc_addSupportLink;
134+
135+
if !(_isHC) then {AIO_supportGroups append _units};
108136
};
109137

110138

111-
if (_subType == 1) exitWith {
139+
if (_supType == 1) exitWith {
112140

113141
{
114142
_unit = _x;
@@ -125,44 +153,45 @@ call {
125153
if (_x select 0 == _unit) then {_role = _x select 1; if (_role == "Turret") then {_turret = _x select 3}};
126154
} forEach _crew;
127155

128-
if (isNil "_role") exitWith {hintSilent "Cannot create a group with the selected unit(s)"; _units joinSilent (group player)};
156+
if (isNil "_role") exitWith {hintSilent "Cannot create a group with the selected unit(s)"; _units joinSilent (_originalGroup)};
129157

130158
_landed = [_veh, false] call AIO_fnc_analyzeHeli;
131159
if (_landed) then {
132160
_landPad = createVehicle ["Land_HelipadEmpty_F", [0,0,0]];
133161
_landPad setPosASL (getPosASL _veh);
134162
};
135163

136-
if (isNil "AIO_support_cas_heli" || {isNull AIO_support_cas_heli}) then {
164+
if (isNil "AIO_support_cas_heli" || {!alive AIO_support_cas_heli}) then {
137165
AIO_support_cas_heli = "SupportProvider_CAS_Heli" createVehicleLocal [0, 0, 0];
138166
AIO_support_cas_heli setVehicleVarName "AIO_support_cas_heli";
139167
};
140-
AIO_support_cas_heli_grp = createGroup (side player);
168+
AIO_support_cas_heli_grp = createGroup (side _originalGroup);
141169
_units joinSilent AIO_support_cas_heli_grp;
142170
AIO_support_cas_heli_grp selectLeader _unit;
143171

144172
if (_role == "Turret") then {_text = format ["_unit assignAs%1 [_veh, %2]", _role, _turret]} else {_text = format ["_unit assignAs%1 _veh", _role]};
145173
call compile _text;
146174
{
147-
if !(_x in (units AIO_support_cas_heli_grp)) then {[_x] join AIO_support_cas_heli_grp};
175+
if !(_x in (units AIO_support_cas_heli_grp)) then {[_x] join AIO_support_cas_heli_grp; _units pushBackUnique _x};
148176
} forEach crew(vehicle _unit);
149177

150-
(units AIO_support_cas_heli_grp) orderGetIn true;
151-
152-
AIO_supportGroups append (crew (vehicle _unit) - [_unit]);
153178
{
154-
if (vehicle _x != vehicle _unit) then {[_x] joinSilent group player; AIO_supportGroups = AIO_supportGroups - [_x]};
179+
if (vehicle _x != _veh) then {[_x] joinSilent _originalGroup; _units = _units - [_x]};
155180
} forEach (units AIO_support_cas_heli_grp);
156181

182+
(units AIO_support_cas_heli_grp) orderGetIn true;
183+
157184
_unit synchronizeObjectsAdd [AIO_support_cas_heli];
158185

159186
player synchronizeObjectsAdd [AIO_support_requester];
160187

161188
[player, AIO_support_requester, AIO_support_cas_heli] call BIS_fnc_addSupportLink;
189+
190+
if !(_isHC) then {AIO_supportGroups append _units};
162191
};
163192

164193

165-
if (_subType == 2) exitWith {
194+
if (_supType == 2) exitWith {
166195
{
167196
_unit = _x;
168197
if ((vehicle _unit) isKindOf "Plane") exitWith {_continue = true};
@@ -175,30 +204,35 @@ call {
175204
{
176205
if (_x select 0 == _unit) then {_role = _x select 1; if (_role == "Turret") then {_turret = _x select 3}};
177206
} forEach _crew;
178-
if (isNil "AIO_support_cas_bomb" || {isNull AIO_support_cas_bomb}) then {
207+
if (isNil "AIO_support_cas_bomb" || {!alive AIO_support_cas_bomb}) then {
179208
AIO_support_cas_bomb = "SupportProvider_CAS_Bombing" createVehicleLocal [0, 0, 0];
180209
AIO_support_cas_bomb setVehicleVarName "AIO_support_cas_bomb";
181210
};
182-
AIO_support_cas_bomb_grp = createGroup (side player);
211+
AIO_support_cas_bomb_grp = createGroup (side _originalGroup);
183212
_units joinSilent AIO_support_cas_bomb_grp;
184213
AIO_support_cas_bomb_grp selectLeader _unit;
185214
if (_role == "Turret") then {_text = format ["_unit assignAs%1 [_veh, %2]", _role, _turret]} else {_text = format ["_unit assignAs%1 _veh", _role]};
186215
call compile _text;
187216
{
188-
if !(_x in (units AIO_support_cas_bomb_grp)) then {[_x] join AIO_support_cas_bomb_grp};
217+
if !(_x in (units AIO_support_cas_bomb_grp)) then {[_x] join AIO_support_cas_bomb_grp; _units pushBackUnique _x};
189218
} forEach crew(vehicle _unit);
190-
(units AIO_support_cas_bomb_grp) orderGetIn true;
191-
AIO_supportGroups append (crew (vehicle _unit) - [_unit]);
219+
220+
192221
{
193-
if (vehicle _x != vehicle _unit) then {[_x] joinSilent group player; AIO_supportGroups = AIO_supportGroups - [_x]};
222+
if (vehicle _x != _veh) then {[_x] joinSilent _originalGroup; _units = _units - [_x]};
194223
} forEach (units AIO_support_cas_bomb_grp);
224+
225+
(units AIO_support_cas_bomb_grp) orderGetIn true;
226+
195227
_unit synchronizeObjectsAdd [AIO_support_cas_bomb];
196228
player synchronizeObjectsAdd [AIO_support_requester];
197229
[player, AIO_support_requester, AIO_support_cas_bomb] call BIS_fnc_addSupportLink;
230+
231+
if !(_isHC) then {AIO_supportGroups append _units};
198232
};
199233

200234

201-
if (_subType == 3) exitWith {
235+
if (_supType == 3) exitWith {
202236
{
203237
_unit = _x;
204238
_veh = vehicle _unit;
@@ -219,27 +253,32 @@ call {
219253
_landPad setPosASL (getPosASL _veh);
220254
};
221255

222-
if (isNil "AIO_support_trans" || {isNull AIO_support_trans}) then {
256+
if (isNil "AIO_support_trans" || {!alive AIO_support_trans}) then {
223257
AIO_support_trans = "SupportProvider_Transport" createVehicleLocal [0, 0, 0];
224258
AIO_support_trans setVehicleVarName "AIO_support_trans";
225259
};
226260

227-
AIO_support_trans_grp = createGroup (side player);
261+
AIO_support_trans_grp = createGroup (side _originalGroup);
228262
_units joinSilent AIO_support_trans_grp;
229263
AIO_support_trans_grp selectLeader _unit;
230264
if (_role == "Turret") then {_text = format ["_unit assignAs%1 [_veh, %2]", _role, _turret]} else {_text = format ["_unit assignAs%1 _veh", _role]};
231265
call compile _text;
232266
{
233-
if !(_x in (units AIO_support_trans_grp)) then {[_x] join AIO_support_trans_grp};
267+
if !(_x in (units AIO_support_trans_grp)) then {[_x] join AIO_support_trans_grp; _units pushBackUnique _x};
234268
} forEach crew(vehicle _unit);
235-
(units AIO_support_trans_grp) orderGetIn true;
269+
236270
(crew(vehicle _unit) - [_unit]) join AIO_support_trans_grp;
237-
AIO_supportGroups append (crew (vehicle _unit) - [_unit]);
271+
238272
{
239-
if (vehicle _x != vehicle _unit) then {[_x] joinSilent group player; AIO_supportGroups = AIO_supportGroups - [_x]};
273+
if (vehicle _x != _veh) then {[_x] joinSilent _originalGroup; _units = _units - [_x]};
240274
} forEach (units AIO_support_trans_grp);
275+
276+
(units AIO_support_trans_grp) orderGetIn true;
277+
241278
_unit synchronizeObjectsAdd [AIO_support_trans];
242279
player synchronizeObjectsAdd [AIO_support_requester];
243280
[player, AIO_support_requester, AIO_support_trans] call BIS_fnc_addSupportLink;
281+
282+
if !(_isHC) then {AIO_supportGroups append _units};
244283
};
245284
};

@AIO_SPPack/addons/AIO_AIMENU/functions/init/fn_Menu_Const.sqf

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,17 @@ AIO_supportTypes_subMenu =
427427
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa'/><t font='PuristaBold'> Infantry Squad", [6], "", -5, [["expression", "[4] spawn AIO_fnc_createSupportMenu"]], "1", "1"]
428428
];
429429

430+
AIO_supportTypes_HC_subMenu =
431+
[
432+
["Create Support Group",true],
433+
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa'/><t font='PuristaBold'> Artillary Support", [2], "", -5, [["expression", "[0] spawn AIO_fnc_createSupportMenu_HC"]], "1", "1"],
434+
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\casheli_ca.paa'/><t font='PuristaBold'> CAS (Helicopter Attack)", [3], "", -5, [["expression", "[1] spawn AIO_fnc_createSupportMenu_HC"]], "1", "1"],
435+
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa'/><t font='PuristaBold'> CAS (Bombing Run)", [4], "", -5, [["expression", "[2] spawn AIO_fnc_createSupportMenu_HC"]], "1", "1"],
436+
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa'/><t font='PuristaBold'> Helicopter Transport", [5], "", -5, [["expression", "[3] spawn AIO_fnc_createSupportMenu_HC"]], "1", "1"],
437+
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa'/><t font='PuristaBold'> Add HC Group To Player", [6], "", -5, [["expression", "[] spawn AIO_fnc_createHCGroupsMenu"]], "1", "1"]
438+
];
439+
440+
430441
AIO_clearMem_subMenu =
431442
[
432443
["Clear Memory",true],
@@ -446,7 +457,7 @@ AIO_backup_subMenu =
446457
_unit = _x;
447458
{
448459
if (_x == AIO_support_trans || _x == AIO_support_cas_heli || _x == AIO_support_cas_bomb || _x == AIO_support_arty || _x == AIO_support_requester) then {
449-
_unit synchronizeObjectsRemove [_x];
460+
_unit synchronizeObjectsRemove [_x];
450461
};
451462
} forEach (synchronizedObjects _x);
452463
} forEach (AIO_supportGroups + [player]); AIO_supportGroups join group player; AIO_supportGroups = []; player doFollow player;"]], "1", "1"],
@@ -458,9 +469,9 @@ AIO_HighCommand_Menu =
458469
["High Command Mode",true],
459470
[parseText"<img color='#f94a4a' image='\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\meet_ca.paa'/><t font='PuristaBold'> Dismiss Units", [2], "#USER:AIO_squadDismiss_subMenu1", -5, [["expression", ""]], "1", "1"],
460471
[parseText"<img color='#95ff44' image='\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\meet_ca.paa'/><t font='PuristaBold'> Recruit Units", [3], "#USER:AIO_recruit_subMenu1", -5, [["expression", ""]], "1", "1"],
461-
[parseText"<img image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa'/><t font='PuristaBold'> Create Support Group", [4], "#USER:AIO_supportTypes_subMenu", -5, [["expression", ""]], "1", "1"],
462-
[parseText"<img image='\A3\ui_f\data\IGUI\Cfg\Cursors\leader_ca.paa'/><t font='PuristaBold'> Select Squad Leader", [5], "#USER:AIO_giveLead_subMenu1", -5, [["expression", ""]], "1", "1"],
463-
[parseText"<img image='\A3\ui_f\data\GUI\Rsc\RscDisplayDLCContentBrowser\platform_ca.paa'/><t font='PuristaBold'> Add HC Group To Player", [6], "", -5, [["expression", "[] spawn AIO_fnc_createHCGroupsMenu"]], "1", "1"],
472+
[parseText"<img color='#95ff44' image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa'/><t font='PuristaBold'> Create Support Group", [4], "#USER:AIO_supportTypes_subMenu", -5, [["expression", ""]], "1", "1"],
473+
[parseText"<img color='#2da7ff' image='\A3\ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa'/><t font='PuristaBold'> Create Support Group (HC)", [5], "#USER:AIO_supportTypes_HC_subMenu", -5, [["expression", ""]], "1", "1"],
474+
[parseText"<img image='\A3\ui_f\data\IGUI\Cfg\Cursors\leader_ca.paa'/><t font='PuristaBold'> Select Squad Leader", [6], "#USER:AIO_giveLead_subMenu1", -5, [["expression", ""]], "1", "1"],
464475
["", [], "", -1, [["expression", ""]], "1", "0"],
465476
[parseText"<img image='AIO_AIMENU\pictures\monitor.paa'/><t font='PuristaBold'> Monitor Squad Units", [7], "#USER:AIO_monitor_subMenu1", -5, [["expression", ""]], "1", "1"],
466477
["", [], "", -1, [["expression", ""]], "1", "0"],

0 commit comments

Comments
 (0)