Skip to content

Commit 15d62b5

Browse files
authored
Update to v1.2.2
Added a new CBA option for disabling the mod entirely Fixed switch seat throwing an error if unit didn't have a proper name
1 parent 85255e6 commit 15d62b5

File tree

4 files changed

+139
-119
lines changed

4 files changed

+139
-119
lines changed

addons/AIO_AIMENU/XEH_preInit.sqf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Finally, to bind your function to a key, call CBA_fnc_addKeybind:
5050
["My Awesome Mod","show_breathing_key", "Show Breathing", {_this call mymod_fnc_showGameHint}, "", [DIK_B, [true, true, false]]] call CBA_fnc_addKeybind;
5151
*/
5252

53-
54-
["AIO_useVoiceChat", "CHECKBOX", "Use Voice Chat", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
53+
["AIO_enableMod", "CHECKBOX", "Enable All-in-One Command Menu", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
54+
["AIO_useVoiceChat", "CHECKBOX", "Use radio chat for reporting", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
5555
["AIO_Init_Message", "CHECKBOX", "Show Initialization Message", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
5656
["AIO_Zeus_Enabled", "CHECKBOX", "Create Zeus Module", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
5757
["AIO_HC_Module_Enabled", "CHECKBOX", "Create High Command Module", "All-In-One Command Menu", false, 1] call CBA_Settings_fnc_init;
@@ -63,9 +63,9 @@ Finally, to bind your function to a key, call CBA_fnc_addKeybind:
6363
["AIO_use_HC_driver", "CHECKBOX", "Use High Command Driver", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
6464
["AIO_use_doMove_command", "CHECKBOX", "Use doMove instead of CommandMove for Driver", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
6565
["AIO_becomeLeaderOnSwitch", "CHECKBOX", "Become Leader on Team Switch", "All-In-One Command Menu" ,false, 1] call CBA_Settings_fnc_init;
66-
["AIO_AdvancedCtrlMode", "LIST", "Advanced Control Mode", "All-In-One Command Menu" ,[[false, true], ["Toggle", "Hold"], 0], 1] call CBA_Settings_fnc_init;
67-
["AIO_DriverFixWatchDir", "LIST", "Player Watch Direction During Adv Ctrl", "All-In-One Command Menu" ,[[false, true], ["Watch Ahead", "Fixed"], 0], 1] call CBA_Settings_fnc_init;
68-
["AIO_useExactStanceCopy", "LIST", "Copy My Stance Mode", "All-In-One Command Menu" ,[[true, false], ["Exact Stance", "Standard Stance"], 0], 1] call CBA_Settings_fnc_init;
66+
["AIO_AdvancedCtrlMode", "LIST", "Advanced Driving Control Mode", "All-In-One Command Menu" ,[[false, true], ["Toggle", "Hold"], 0], 1] call CBA_Settings_fnc_init;
67+
["AIO_DriverFixWatchDir", "LIST", "Player Watch Direction During Adv. Driving Ctrl", "All-In-One Command Menu" ,[[false, true], ["Watch Ahead", "Fixed"], 0], 1] call CBA_Settings_fnc_init;
68+
["AIO_useExactCopyStance", "LIST", "Copy My Stance Mode", "All-In-One Command Menu" ,[[true, false], ["Exact Stance", "Standard Stance"], 0], 1] call CBA_Settings_fnc_init;
6969

7070
["All-In-One Command Menu","AIO_AIMenu_initKey", "Show Menu", {_this call AIO_keyspressed}, "", [21, [false, false, false]], false] call CBA_fnc_addKeybind;
7171
["All-In-One Command Menu","AIO_follow_stance_key", "Toggle Copy My Stance", {if !(AIO_copy_my_stance) then {[(groupSelectedUnits player)] spawn AIO_copy_my_stance_fnc} else {AIO_copy_my_stance = false; {_x setUnitPos "AUTO"} forEach ((units group player) - [player]);}}, "", [DIK_C, [true, true, false]], false] call CBA_fnc_addKeybind;

addons/AIO_AIMENU/init.sqf

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
////////////////////////////////
2-
// Grab config values and start
3-
////////////////////////////////
4-
//AIO_debug = getnumber(configfile>> "AIO_AICOVER_Key_Setting" >> "AIO_DEBUG");
5-
6-
//AIO_key = getnumber(configfile>> "AIO_AIMENU_Key_Setting" >> "AIO_key");
7-
//AIO_mapkey = getnumber(configfile>> "AIO_AIMENU_Key_Setting" >> "AIO_mapkey");
8-
//AIO_key = 73;
9-
//AIO_HC_Module_Enabled = 1; AIO_Zeus_Enabled = 1; AIO_force_Zeus_enabled = false;
10-
//AIO_Zeus_Enabled = getNumber (configfile >> "AIO_AIMENU_Settings" >> "AIO_Zeus_Enabled");
11-
//AIO_HC_Module_Enabled = getNumber (configfile >> "AIO_AIMENU_Settings" >> "AIO_High_Command_Enabled");
12-
1+
if !(AIO_enableMod) exitWith {};
132
0 = [] execVM "AIO_AIMENU\postInit.sqf";
143
0 = [1] execVM "AIO_AIMENU\zeus.sqf";
154
0 = [] execVM "AIO_AIMENU\createHCmodule.sqf";

addons/AIO_AIMENU/postInit.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AIO_nearPlane = [];
2222
AIO_nearHeli = [];
2323
AIO_nearcargo = [];
2424
AIO_rearmTargets = [];
25-
AIO_copyExactStance = AIO_useExactStanceCopy;
25+
AIO_copyExactStance = AIO_useExactCopyStance;
2626
if (isNil "AIO_unitsToHoldFire") then {AIO_unitsToHoldFire = []};
2727
if (isNil "AIO_dismissedUnits") then {AIO_dismissedUnits = []};
2828
if (isNil "AIO_recruitedUnits") then {AIO_recruitedUnits = []};

addons/AIO_AIMENU/switchseat.sqf

Lines changed: 132 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -3,122 +3,153 @@ _grp = _this select 0;
33
_vehrole = _this select 1;
44
_unit = _grp select 0;
55
_veh = vehicle _unit;
6-
if (_vehrole == 1) then {
7-
_unit action ["movetoDriver", _veh];
8-
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToDriver";};
9-
_unitrole = assignedVehicleRole _unit;
10-
_unitrole1 = _unitrole select 0;
11-
if (_unitrole1 != "Driver") then {
12-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
13-
_driver = driver vehicle _unit;
14-
moveOut _unit;
15-
if (!isNull _driver) then {
16-
moveOut _driver;
17-
_text = format["%3 moveIn%1 %2", _unitrole1, _text, _driver];
18-
call compile _text;
19-
};
20-
_unit moveInDriver _veh;
21-
};
6+
_moveInFnc =
7+
{
8+
params ["_unit","_unitrole1", "_vehSeat"];
9+
if (_unitrole1 == "Cargo") then {_unit moveInCargo _vehSeat};
10+
if (_unitrole1 == "Turret") then {_unit moveInTurret _vehSeat};
11+
if (_unitrole1 == "Driver") then {_unit moveInDriver _vehSeat};
12+
if (_unitrole1 == "Commander") then {_unit moveInCommander _vehSeat};
13+
if (_unitrole1 == "Gunner") then {_unit moveInGunner _vehSeat};
2214
};
23-
if (_vehrole == 2) then {
24-
private _switched = false;
25-
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCommander";};
26-
private _numcopilot = count(allTurrets [_veh, true]);
27-
private _numcommander = count(fullCrew [_veh, "commander", true]);
28-
if (_numcopilot!=0) then {
29-
_unit action ["moveToTurret", _veh, [0]];
15+
switch (_vehrole) do {
16+
case 1:
17+
{
18+
_unit action ["movetoDriver", _veh];
19+
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToDriver";};
3020
_unitrole = assignedVehicleRole _unit;
3121
_unitrole1 = _unitrole select 0;
32-
if (_unitrole1 != "Turret") then {
33-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
34-
_driver = ((fullCrew [_veh, "Turret", true]) select 0) select 0;
22+
if (_unitrole1 != "Driver") then {
23+
_driver = driver (vehicle _unit);
3524
moveOut _unit;
3625
if !(isNull _driver) then {
3726
moveOut _driver;
38-
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
39-
call compile _text;
40-
};
41-
_unit moveInTurret [_veh, [0]];
42-
};
43-
_switched = true;
44-
};
45-
if (_numcommander!=0 && !(_switched)) then {
46-
_unit action ["moveToCommander", _veh];
47-
_unitrole = assignedVehicleRole _unit;
48-
_unitrole1 = _unitrole select 0;
49-
if (_unitrole1 != "Commander") then {
50-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
51-
_driver = Commander vehicle _unit;
52-
moveOut _unit;
53-
if (!isNull _driver) then {
54-
moveOut _driver;
55-
_text = format["%3 moveIn%1 %2", _unitrole1, _text, _driver];
56-
call compile _text;
27+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
28+
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
29+
} else {
30+
[_driver, _unitrole1, _veh] call _moveInFnc;
31+
};
5732
};
5833
_unit moveInDriver _veh;
5934
};
60-
61-
};
62-
};
63-
if (_vehrole == 3) then {
64-
private _switched = false;
65-
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToGunner";};
66-
private _turretPaths = allTurrets [_veh, true];
67-
if (count(fullCrew [_veh, "Gunner", true])!=0) then {
68-
_unit action ["movetogunner", _veh];
69-
_unitrole = assignedVehicleRole _unit;
70-
_unitrole1 = _unitrole select 0;
71-
if (_unitrole1 != "Gunner") then {
72-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
73-
_driver = gunner vehicle _unit;
74-
moveOut _unit;
75-
if !(isNull _driver) then {
76-
moveOut _driver;
77-
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
78-
call compile _text;
79-
};
80-
_unit moveInGunner _veh;
8135
};
82-
_switched = true;
83-
};
84-
_unitrole = assignedVehicleRole _unit;
85-
if (!(_switched) && (count _turretPaths > 1)) then {
86-
for "_i" from 1 to (count _turretPaths -1) do {
87-
sleep 0.5;
88-
if !((_turretPaths select _i) in _unitrole OR _switched) then {
89-
_unit action ["moveToTurret", _veh, (_turretPaths select _i)];
90-
_unitrole = assignedVehicleRole _unit;
91-
_unitrole1 = _unitrole select 0;
92-
if (_unitrole1 != "Turret") then {
93-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
94-
_driver = ((fullCrew [_veh, "Turret", true]) select _i) select 0;
95-
moveOut _unit;
96-
if !(isNull _driver) then {
97-
moveOut _driver;
98-
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
99-
call compile _text;
36+
37+
case 2:
38+
{
39+
private _switched = false;
40+
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCommander";};
41+
private _numcopilot = count(allTurrets [_veh, true]);
42+
private _numcommander = count(fullCrew [_veh, "commander", true]);
43+
if (_numcopilot!=0) then {
44+
_unit action ["moveToTurret", _veh, [0]];
45+
_unitrole = assignedVehicleRole _unit;
46+
_unitrole1 = _unitrole select 0;
47+
if (_unitrole1 != "Turret") then {
48+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
49+
_driver = ((fullCrew [_veh, "Turret", true]) select 0) select 0;
50+
moveOut _unit;
51+
if !(isNull _driver) then {
52+
moveOut _driver;
53+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
54+
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
55+
} else {
56+
[_driver, _unitrole1, _veh] call _moveInFnc;
10057
};
101-
_unit moveInTurret [_veh, (_turretPaths select _i)];
58+
};
59+
_unit moveInTurret [_veh, [0]];
10260
};
10361
_switched = true;
62+
};
63+
if (_numcommander!=0 && !(_switched)) then {
64+
_unit action ["moveToCommander", _veh];
65+
_unitrole = assignedVehicleRole _unit;
66+
_unitrole1 = _unitrole select 0;
67+
if (_unitrole1 != "Commander") then {
68+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
69+
_driver = Commander (vehicle _unit);
70+
moveOut _unit;
71+
if !(isNull _driver) then {
72+
moveOut _driver;
73+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
74+
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
75+
} else {
76+
[_driver, _unitrole1, _veh] call _moveInFnc;
77+
};
10478
};
79+
_unit moveInDriver _veh;
80+
};
81+
10582
};
83+
};
84+
case 3:
85+
{
86+
private _switched = false;
87+
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToGunner";};
88+
private _turretPaths = allTurrets [_veh, true];
89+
if (count(fullCrew [_veh, "Gunner", true])!=0) then {
90+
_unit action ["movetogunner", _veh];
91+
_unitrole = assignedVehicleRole _unit;
92+
_unitrole1 = _unitrole select 0;
93+
if (_unitrole1 != "Gunner") then {
94+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
95+
_driver = gunner (vehicle _unit);
96+
moveOut _unit;
97+
if !(isNull _driver) then {
98+
moveOut _driver;
99+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
100+
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
101+
} else {
102+
[_driver, _unitrole1, _veh] call _moveInFnc;
103+
};
104+
};
105+
_unit moveInGunner _veh;
106106
};
107-
};
108-
109-
if (_vehrole == 4) then {
110-
_unit action ["MovetoCargo", _veh, 0];
111-
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCargo";};
112-
_unitrole = assignedVehicleRole _unit;
113-
_unitrole1 = _unitrole select 0;
114-
if (_unitrole1 != "Cargo") then {
115-
moveOut _unit;
116-
_unit moveInCargo _veh;
107+
_switched = true;
117108
};
118-
if (vehicle _unit == _unit) then {
119-
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
120-
_text = format["%3 movein%1 %2", _unitrole1, _text, _unit];
121-
call compile _text;
122-
}
123-
};
109+
_unitrole = assignedVehicleRole _unit;
110+
if (!(_switched) && (count _turretPaths > 1)) then {
111+
for "_i" from 1 to (count _turretPaths -1) do {
112+
sleep 0.5;
113+
if !((_turretPaths select _i) in _unitrole OR _switched) then {
114+
_unit action ["moveToTurret", _veh, (_turretPaths select _i)];
115+
_unitrole = assignedVehicleRole _unit;
116+
_unitrole1 = _unitrole select 0;
117+
if (_unitrole1 != "Turret") then {
118+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
119+
_driver = ((fullCrew [_veh, "Turret", true]) select _i) select 0;
120+
moveOut _unit;
121+
if !(isNull _driver) then {
122+
moveOut _driver;
123+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
124+
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
125+
} else {
126+
[_driver, _unitrole1, _veh] call _moveInFnc;
127+
};
128+
};
129+
_unit moveInTurret [_veh, (_turretPaths select _i)];
130+
};
131+
_switched = true;
132+
};
133+
};
134+
};
135+
};
124136

137+
case 4:
138+
{
139+
_unit action ["MovetoCargo", _veh, 0];
140+
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCargo";};
141+
_unitrole = assignedVehicleRole _unit;
142+
_unitrole1 = _unitrole select 0;
143+
if (_unitrole1 != "Cargo") then {
144+
moveOut _unit;
145+
_unit moveInCargo _veh;
146+
};
147+
if (vehicle _unit == _unit) then {
148+
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
149+
[_unit, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
150+
} else {
151+
[_unit, _unitrole1, _veh] call _moveInFnc;
152+
};
153+
}
154+
};
155+
};

0 commit comments

Comments
 (0)