Skip to content

Commit

Permalink
Update to v1.2.2
Browse files Browse the repository at this point in the history
Added a new CBA option for disabling the mod entirely
Fixed switch seat throwing an error if unit didn't have a proper name
  • Loading branch information
Leopard20 authored Jul 17, 2018
1 parent 85255e6 commit 15d62b5
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 119 deletions.
10 changes: 5 additions & 5 deletions addons/AIO_AIMENU/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Finally, to bind your function to a key, call CBA_fnc_addKeybind:
["My Awesome Mod","show_breathing_key", "Show Breathing", {_this call mymod_fnc_showGameHint}, "", [DIK_B, [true, true, false]]] call CBA_fnc_addKeybind;
*/


["AIO_useVoiceChat", "CHECKBOX", "Use Voice Chat", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_enableMod", "CHECKBOX", "Enable All-in-One Command Menu", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_useVoiceChat", "CHECKBOX", "Use radio chat for reporting", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_Init_Message", "CHECKBOX", "Show Initialization Message", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_Zeus_Enabled", "CHECKBOX", "Create Zeus Module", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_HC_Module_Enabled", "CHECKBOX", "Create High Command Module", "All-In-One Command Menu", false, 1] call CBA_Settings_fnc_init;
Expand All @@ -63,9 +63,9 @@ Finally, to bind your function to a key, call CBA_fnc_addKeybind:
["AIO_use_HC_driver", "CHECKBOX", "Use High Command Driver", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_use_doMove_command", "CHECKBOX", "Use doMove instead of CommandMove for Driver", "All-In-One Command Menu" ,true, 1] call CBA_Settings_fnc_init;
["AIO_becomeLeaderOnSwitch", "CHECKBOX", "Become Leader on Team Switch", "All-In-One Command Menu" ,false, 1] call CBA_Settings_fnc_init;
["AIO_AdvancedCtrlMode", "LIST", "Advanced Control Mode", "All-In-One Command Menu" ,[[false, true], ["Toggle", "Hold"], 0], 1] call CBA_Settings_fnc_init;
["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;
["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;
["AIO_AdvancedCtrlMode", "LIST", "Advanced Driving Control Mode", "All-In-One Command Menu" ,[[false, true], ["Toggle", "Hold"], 0], 1] call CBA_Settings_fnc_init;
["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;
["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;

["All-In-One Command Menu","AIO_AIMenu_initKey", "Show Menu", {_this call AIO_keyspressed}, "", [21, [false, false, false]], false] call CBA_fnc_addKeybind;
["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;
Expand Down
13 changes: 1 addition & 12 deletions addons/AIO_AIMENU/init.sqf
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
////////////////////////////////
// Grab config values and start
////////////////////////////////
//AIO_debug = getnumber(configfile>> "AIO_AICOVER_Key_Setting" >> "AIO_DEBUG");

//AIO_key = getnumber(configfile>> "AIO_AIMENU_Key_Setting" >> "AIO_key");
//AIO_mapkey = getnumber(configfile>> "AIO_AIMENU_Key_Setting" >> "AIO_mapkey");
//AIO_key = 73;
//AIO_HC_Module_Enabled = 1; AIO_Zeus_Enabled = 1; AIO_force_Zeus_enabled = false;
//AIO_Zeus_Enabled = getNumber (configfile >> "AIO_AIMENU_Settings" >> "AIO_Zeus_Enabled");
//AIO_HC_Module_Enabled = getNumber (configfile >> "AIO_AIMENU_Settings" >> "AIO_High_Command_Enabled");

if !(AIO_enableMod) exitWith {};
0 = [] execVM "AIO_AIMENU\postInit.sqf";
0 = [1] execVM "AIO_AIMENU\zeus.sqf";
0 = [] execVM "AIO_AIMENU\createHCmodule.sqf";
Expand Down
2 changes: 1 addition & 1 deletion addons/AIO_AIMENU/postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AIO_nearPlane = [];
AIO_nearHeli = [];
AIO_nearcargo = [];
AIO_rearmTargets = [];
AIO_copyExactStance = AIO_useExactStanceCopy;
AIO_copyExactStance = AIO_useExactCopyStance;
if (isNil "AIO_unitsToHoldFire") then {AIO_unitsToHoldFire = []};
if (isNil "AIO_dismissedUnits") then {AIO_dismissedUnits = []};
if (isNil "AIO_recruitedUnits") then {AIO_recruitedUnits = []};
Expand Down
233 changes: 132 additions & 101 deletions addons/AIO_AIMENU/switchseat.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,122 +3,153 @@ _grp = _this select 0;
_vehrole = _this select 1;
_unit = _grp select 0;
_veh = vehicle _unit;
if (_vehrole == 1) then {
_unit action ["movetoDriver", _veh];
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToDriver";};
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Driver") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = driver vehicle _unit;
moveOut _unit;
if (!isNull _driver) then {
moveOut _driver;
_text = format["%3 moveIn%1 %2", _unitrole1, _text, _driver];
call compile _text;
};
_unit moveInDriver _veh;
};
_moveInFnc =
{
params ["_unit","_unitrole1", "_vehSeat"];
if (_unitrole1 == "Cargo") then {_unit moveInCargo _vehSeat};
if (_unitrole1 == "Turret") then {_unit moveInTurret _vehSeat};
if (_unitrole1 == "Driver") then {_unit moveInDriver _vehSeat};
if (_unitrole1 == "Commander") then {_unit moveInCommander _vehSeat};
if (_unitrole1 == "Gunner") then {_unit moveInGunner _vehSeat};
};
if (_vehrole == 2) then {
private _switched = false;
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCommander";};
private _numcopilot = count(allTurrets [_veh, true]);
private _numcommander = count(fullCrew [_veh, "commander", true]);
if (_numcopilot!=0) then {
_unit action ["moveToTurret", _veh, [0]];
switch (_vehrole) do {
case 1:
{
_unit action ["movetoDriver", _veh];
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToDriver";};
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Turret") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = ((fullCrew [_veh, "Turret", true]) select 0) select 0;
if (_unitrole1 != "Driver") then {
_driver = driver (vehicle _unit);
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
call compile _text;
};
_unit moveInTurret [_veh, [0]];
};
_switched = true;
};
if (_numcommander!=0 && !(_switched)) then {
_unit action ["moveToCommander", _veh];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Commander") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = Commander vehicle _unit;
moveOut _unit;
if (!isNull _driver) then {
moveOut _driver;
_text = format["%3 moveIn%1 %2", _unitrole1, _text, _driver];
call compile _text;
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_driver, _unitrole1, _veh] call _moveInFnc;
};
};
_unit moveInDriver _veh;
};

};
};
if (_vehrole == 3) then {
private _switched = false;
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToGunner";};
private _turretPaths = allTurrets [_veh, true];
if (count(fullCrew [_veh, "Gunner", true])!=0) then {
_unit action ["movetogunner", _veh];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Gunner") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = gunner vehicle _unit;
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
call compile _text;
};
_unit moveInGunner _veh;
};
_switched = true;
};
_unitrole = assignedVehicleRole _unit;
if (!(_switched) && (count _turretPaths > 1)) then {
for "_i" from 1 to (count _turretPaths -1) do {
sleep 0.5;
if !((_turretPaths select _i) in _unitrole OR _switched) then {
_unit action ["moveToTurret", _veh, (_turretPaths select _i)];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Turret") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = ((fullCrew [_veh, "Turret", true]) select _i) select 0;
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
_text = format["%3 movein%1 %2", _unitrole1, _text, _driver];
call compile _text;

case 2:
{
private _switched = false;
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCommander";};
private _numcopilot = count(allTurrets [_veh, true]);
private _numcommander = count(fullCrew [_veh, "commander", true]);
if (_numcopilot!=0) then {
_unit action ["moveToTurret", _veh, [0]];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Turret") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = ((fullCrew [_veh, "Turret", true]) select 0) select 0;
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_driver, _unitrole1, _veh] call _moveInFnc;
};
_unit moveInTurret [_veh, (_turretPaths select _i)];
};
_unit moveInTurret [_veh, [0]];
};
_switched = true;
};
if (_numcommander!=0 && !(_switched)) then {
_unit action ["moveToCommander", _veh];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Commander") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = Commander (vehicle _unit);
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_driver, _unitrole1, _veh] call _moveInFnc;
};
};
_unit moveInDriver _veh;
};

};
};
case 3:
{
private _switched = false;
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToGunner";};
private _turretPaths = allTurrets [_veh, true];
if (count(fullCrew [_veh, "Gunner", true])!=0) then {
_unit action ["movetogunner", _veh];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Gunner") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = gunner (vehicle _unit);
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_driver, _unitrole1, _veh] call _moveInFnc;
};
};
_unit moveInGunner _veh;
};
};

if (_vehrole == 4) then {
_unit action ["MovetoCargo", _veh, 0];
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCargo";};
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Cargo") then {
moveOut _unit;
_unit moveInCargo _veh;
_switched = true;
};
if (vehicle _unit == _unit) then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_text = format["%3 movein%1 %2", _unitrole1, _text, _unit];
call compile _text;
}
};
_unitrole = assignedVehicleRole _unit;
if (!(_switched) && (count _turretPaths > 1)) then {
for "_i" from 1 to (count _turretPaths -1) do {
sleep 0.5;
if !((_turretPaths select _i) in _unitrole OR _switched) then {
_unit action ["moveToTurret", _veh, (_turretPaths select _i)];
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Turret") then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {_text = format["[%1, %2]", _veh, (_unitrole select 1)]} else {_text = format["%1", _veh]};
_driver = ((fullCrew [_veh, "Turret", true]) select _i) select 0;
moveOut _unit;
if !(isNull _driver) then {
moveOut _driver;
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_driver, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_driver, _unitrole1, _veh] call _moveInFnc;
};
};
_unit moveInTurret [_veh, (_turretPaths select _i)];
};
_switched = true;
};
};
};
};

case 4:
{
_unit action ["MovetoCargo", _veh, 0];
if (_unit != player && AIO_useVoiceChat) then {player groupRadio "SentCmdSwitchToCargo";};
_unitrole = assignedVehicleRole _unit;
_unitrole1 = _unitrole select 0;
if (_unitrole1 != "Cargo") then {
moveOut _unit;
_unit moveInCargo _veh;
};
if (vehicle _unit == _unit) then {
if (count _unitrole == 2 && _unitrole1 != "Cargo") then {
[_unit, _unitrole1, [_veh, (_unitrole select 1)]] call _moveInFnc;
} else {
[_unit, _unitrole1, _veh] call _moveInFnc;
};
}
};
};

0 comments on commit 15d62b5

Please sign in to comment.