Skip to content

Commit f056ce3

Browse files
authored
Update to v1.3.0
Bug fixes and improvements
1 parent 8553d0a commit f056ce3

24 files changed

+167
-142
lines changed

addons/AIO_AIMENU/Functions/Assemble.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ AIO_staticAssemble_Fnc = {
3535
_unit1 doMove _pos;
3636
_unit2 doMove _pos;
3737
sleep 1;
38-
while {!(unitReady _unit1) && !(unitReady _unit2) && (alive _unit1) && (alive _unit2)} do {sleep 1};
38+
waitUntil {sleep 1; !(!(unitReady _unit1) && !(unitReady _unit2) && (alive _unit1) && (alive _unit2))};
3939
if (_unit1 distance _pos > 10 OR _unit2 distance _pos > 10) exitWith {_units doMove (getpos _unit1)};
4040
_base = unitBackpack _unit2;
4141
_unit2 action ["PutBag"];
@@ -46,7 +46,7 @@ AIO_staticAssemble_Fnc = {
4646
_unit1 = _units select 0;
4747
if (vehicle _unit1 != _unit1) exitWith {};
4848
_unit1 doMove _pos;
49-
while {!(unitReady _unit1) && (alive _unit1)} do {sleep 1;};
49+
waitUntil {sleep 1; !(!(unitReady _unit1) && (alive _unit1))};
5050
if (_unit1 distance _pos > 10) exitWith {_units doMove (getpos _unit1)};
5151
_array = nearestObjects [_unit1, ["WeaponHolder"], 10];
5252
_base = firstBackpack (_array select 0);

addons/AIO_AIMENU/Functions/CopyMyStance.sqf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,15 @@ AIO_copy_my_stance_fnc =
125125
};
126126
} forEach AIO_copyStanceUnits;
127127
};
128-
while {AIO_copy_my_stance} do {
128+
waitUntil {
129+
sleep 1;
129130
_pos = stance player;
130131
_posIndex = _stanceArray find _pos;
131132
_pos = _posArray select _posIndex;
132133
{
133134
_x setUnitPos _pos;
134135
} forEach AIO_copyStanceUnits;
135-
sleep 1;
136+
!(AIO_copy_my_stance)
136137
};
137138
player groupChat "Stop copying my stance.";
138139
{

addons/AIO_AIMENU/Functions/General.sqf

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,51 +28,50 @@ AIO_getUnitNumber =
2828
//Returns a list of nearby weapons according to their class (for taking weapons)
2929
AIO_getName_weapons =
3030
{
31-
private ["_allItem","_ItemCnt","_dist","_className", "_displayName", "_dispNm", "_typeA", "_type", "_emptySlot", "_cntW"];
31+
private ["_allItem","_ItemCnt","_dist","_className", "_displayName", "_dispNm", "_typeA", "_type", "_cntW"];
3232
_allItem = _this select 0;
3333
_ItemCnt = _this select 1;
3434
_typeA = _this select 2;
3535
_type = ["Rifle", "Pistol", "Launcher"] select _typeA;
36-
_dispNm = [[""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""]];
37-
for "_i" from 0 to 12 do
36+
_dispNm = [];
37+
for "_i" from 0 to _ItemCnt-1 do
3838
{
39-
if (_ItemCnt > _i) then {
40-
_dist = floor (player distance (_allItem select _i));
41-
_cntW = count (weaponsItemsCargo (_allItem select _i)) - 1;
42-
for "_k" from 0 to 12 do {
43-
if ((_dispNm select _k) select 0 == "") exitWith {_emptySlot = _k};
44-
};
45-
for "_j" from 0 to _cntW do {
46-
if (isNil "_emptySlot") exitWith {};
47-
_className = ((weaponsItemsCargo (_allItem select _i)) select _j) select 0;
48-
if (_className isKindOf [_type, configFile >> "CfgWeapons"] && _className != "") then {
49-
_displayName = Format ["%1, %2 m",(getText (configFile >> "CfgWeapons" >>_className >> "displayName")), _dist];
50-
_dispNm set [_emptySlot + _j, [_displayName, _allItem select _i, _className]];
51-
};
39+
_dist = floor (player distance (_allItem select _i));
40+
_cntW = count (weaponsItemsCargo (_allItem select _i)) - 1;
41+
for "_j" from 0 to _cntW do {
42+
_className = ((weaponsItemsCargo (_allItem select _i)) select _j) select 0;
43+
if (_className isKindOf [_type, configFile >> "CfgWeapons"] && _className != "") then {
44+
_displayName = Format ["%1, %2 m",(getText (configFile >> "CfgWeapons" >>_className >> "displayName")), _dist];
45+
_dispNm pushBack [_displayName, _allItem select _i, _className];
5246
};
5347
};
54-
_emptySlot = nil;
5548
};
56-
_dispNm
49+
for "_i" from 0 to 11 do
50+
{
51+
_dispNm pushBack [""]
52+
};
53+
_dispNm
5754
};
5855

5956
//Returns a list of nearby vehicles according to their class (for mount menu, disassemble menus and slingloading)
6057
AIO_getName_vehicles =
6158
{
6259
private ["_allItem","_ItemCnt","_dist","_className", "_dispNm", "_displayName"];
63-
_dispNm = ["", "", "", "", "", "", "", "", ""];
60+
_dispNm = [];
6461
_allItem = _this select 0;
6562
_ItemCnt = _this select 1;
66-
for "_i" from 0 to 11 do
63+
for "_i" from 0 to _ItemCnt-1 do
6764
{
68-
if (_ItemCnt > _i) then {
6965
_dist = floor (player distance (_allItem select _i));
7066
_className = typeOf (vehicle (_allItem select _i));
7167
_displayName = Format ["%1, %2 m",(getText (configFile >> "CfgVehicles" >>_className >> "displayName")), _dist];
72-
_dispNm set [_i, _displayName];
73-
};
68+
_dispNm pushBack _displayName;
69+
};
70+
for "_i" from 0 to 11 do
71+
{
72+
_dispNm pushBack ""
7473
};
75-
_dispNm
74+
_dispNm
7675
};
7776

7877
//Used for updating AIO_DriverSettings_subMenu when one of its settings are changed

addons/AIO_AIMENU/Functions/HighCommand.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ AIO_fnc_spawnHCGroups =
471471
{
472472
private ["_groups", "_cntGrps", "_menuNum", "_cntMenus", "_text"];
473473
_groups = allGroups select {(side _x) == (side player)};
474+
_groups = [_groups,[],{player distance (leader _x)},"ASCEND"] call BIS_fnc_sortBy;
474475
_cntGrps = count _groups;
475476
_cntMenus = floor (_cntGrps/11) + 1;
476477
_menuNum = 1;
@@ -483,7 +484,7 @@ AIO_fnc_spawnHCGroups =
483484
{
484485
private "_name";
485486
_unit = _groups select _i;
486-
_dist = floor (player distance2D (leader _unit));
487+
_dist = floor (player distance (leader _unit));
487488
_mod = (_i + 1) mod 11;
488489
if (_mod == 0) then {_mod = 11};
489490
_text = format ["%1 - %2 m", _unit, _dist];

addons/AIO_AIMENU/Functions/Rearm.sqf

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ AIO_rearmList_fnc =
1313
_rearmTargets = [];
1414
{
1515
private _unit = _x;
16-
_allWeapons = nearestObjects [_unit, ["ReammoBox_F", "Car", "Tank", "Helicopter", "Plane"], 100];
16+
_allWeapons = nearestObjects [_unit, ["ReammoBox_F", "Car", "Tank", "Helicopter", "Plane", "WeaponHolderSimulated","LandVehicle","CAManbase"], 100];
1717
for "_i" from 0 to ((count _allWeapons) -1) do {
1818
_cond = (count (weaponsItemsCargo (_allWeapons select _i)) > 0 OR count ((getMagazineCargo (_allWeapons select _i)) select 0) > 0);
1919
if (!((_allWeapons select _i) in _rearmTargets) && _cond) then {
@@ -49,18 +49,16 @@ AIO_rearmList_fnc =
4949
AIO_getName_weapons_fnc =
5050
{
5151
private _unit = (_this select 0) select 0;
52-
AIO_Rifle_subMenu = nil;
53-
AIO_Hgun_subMenu = nil;
54-
AIO_launcher_subMenu = nil;
55-
private _allWeapons = nearestObjects [_unit, ["ReammoBox", "ReammoBox_F"], 200];
52+
AIO_menuLoadingDone = false;
53+
private _allWeapons = nearestObjects [_unit, ["ReammoBox", "ReammoBox_F", "WeaponHolderSimulated","LandVehicle","CAManbase"], 200];
5654
_allWeapons = [_allWeapons,[],{player distance _x},"ASCEND"] call BIS_fnc_sortBy;
5755
//_allWeapons = _allWeapons apply {((weaponsItemsCargo _x) select 0) select 0};
5856
AIO_weaponType_subMenu =
5957
[
60-
["Take Weapon",true],
61-
["Rifle", [2], "#USER:AIO_Rifle_subMenu", -5, [["expression", ""]], "1", "1"],
62-
["Handgun", [3], "#USER:AIO_Hgun_subMenu", -5, [["expression", ""]], "1", "1"],
63-
["Launcher", [4], "#USER:AIO_launcher_subMenu", -5, [["expression", ""]], "1", "1"]
58+
["Take Weapon",true],
59+
["Rifle", [2], "#USER:AIO_Rifle_subMenu", -5, [["expression", ""]], "1", "1"],
60+
["Handgun", [3], "#USER:AIO_Hgun_subMenu", -5, [["expression", ""]], "1", "1"],
61+
["Launcher", [4], "#USER:AIO_launcher_subMenu", -5, [["expression", ""]], "1", "1"]
6462
];
6563
AIO_nearRifle = [_allWeapons, count _allWeapons, 0] call AIO_getName_weapons;
6664
AIO_Rifle_subMenu =
@@ -98,9 +96,10 @@ AIO_getName_weapons_fnc =
9896
[(AIO_selectedunits select 0), AIO_nearLaunch select %1] execVM ""AIO_AIMENU\takeWeapon.sqf"" ']], '1', '1']", _i];
9997
call compile _text;
10098
};
99+
if (_i == 12) then {AIO_menuLoadingDone = true};
101100
};
102101
[] spawn {
103-
waitUntil {!(isNil "AIO_Rifle_subMenu") && !(isNil "AIO_Hgun_subMenu") && !(isNil "AIO_launcher_subMenu")};
102+
waitUntil {AIO_menuLoadingDone};
104103
{
105104
player groupSelectUnit [_x, true];
106105
} forEach AIO_selectedunits;

addons/AIO_AIMENU/Functions/Retreat.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ AIO_retreatMapCMD =
4343

4444
{
4545
_x spawn {
46-
while {!(moveToCompleted _this) && (alive _this) && (currentCommand _this == "STOP")} do {sleep 1};
46+
waitUntil {sleep 1; !(!(moveToCompleted _this) && (alive _this) && (currentCommand _this == "STOP"))};
4747
[[_this], 0] execVM "AIO_AIMENU\sprintModeFull.sqf";
4848
_this enableAI "AUTOCOMBAT";
4949
_this enableAI "AUTOTARGET";

addons/AIO_AIMENU/Functions/Taxi.sqf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
_cfg = configfile >> "CfgWorlds" >> worldName;
3+
_allAirPorts = [[(getArray (_cfg >> "ilsDirection")), (getArray (_cfg >> "ilsPosition")), (getArray (_cfg >> "ilsTaxiIn")), (getArray (_cfg >> "ilsTaxiOff"))]];
4+
5+
_arr = "true" configclasses (_cfg >> "SecondaryAirports");
6+
{
7+
_cfg = _x;
8+
_allAirPorts pushBack [(getArray (_cfg >> "ilsDirection")), (getArray (_cfg >> "ilsPosition")), (getArray (_cfg >> "ilsTaxiIn")), (getArray (_cfg >> "ilsTaxiOff"))]
9+
} forEach _arr;
10+
11+
*/
12+
113
AIO_Plane_Taxi_move =
214
{
315
params ["_veh", "_pointA", "_pointB", "_centPos", "_radius"];

addons/AIO_AIMENU/XEH_preInit.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Finally, to bind your function to a key, call CBA_fnc_addKeybind:
6767
["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;
6868
["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

70-
["All-In-One Command Menu","AIO_AIMenu_initKey", "Show Menu", {_this call AIO_keyspressed}, "", [21, [false, false, false]], false] call CBA_fnc_addKeybind;
70+
["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;
7272
["All-In-One Command Menu","AIO_driver_move_forward_key", "Driver - Command Forward", {if (AIO_driver_mode_enabled && !AIO_Advanced_Ctrl) then {[0] call AIO_driver_call_fnc}}, {}, [DIK_W, [false, false, false]], false] call CBA_fnc_addKeybind;
7373
["All-In-One Command Menu","AIO_driver_move_left_key", "Driver - Command Left", {if (AIO_driver_mode_enabled && !AIO_Advanced_Ctrl) then {[2] call AIO_driver_call_fnc}}, {}, [DIK_A, [false, false, false]], false] call CBA_fnc_addKeybind;

addons/AIO_AIMENU/allRoundDefense.sqf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ AIO_360_defense_fnc =
2121
_unit setUnitPos "MIDDLE";
2222
sleep 0.2;
2323
_unit moveTo _pos;
24-
while {alive _unit && !(moveToCompleted _unit)} do {sleep 1};
24+
waitUntil {sleep 1; (!alive _unit || moveToCompleted _unit || currentCommand _unit != "STOP")};
2525
_unit doWatch _watchPos;
26-
while {currentCommand _unit == "STOP" && alive _unit} do {sleep 2};
26+
waitUntil {sleep 1; (!alive _unit || currentCommand _unit != "STOP")};
2727
_unit doWatch objNull;
2828
_unit setUnitPos "AUTO";
2929
};
@@ -68,10 +68,10 @@ AIO_fortify_pos_fnc =
6868
_unit1 doMove _pos;
6969
[_unit1] spawn {
7070
params ["_unit1"];
71-
if (_unit1 == effectiveCommander (vehicle _unit1)) then{
72-
while {!unitReady _unit1 && alive _unit1} do {sleep 1};
71+
if (_unit1 == effectiveCommander (vehicle _unit1)) then {
72+
waitUntil {sleep 1; (!alive _unit1 || unitReady _unit1)};
7373
} else {
74-
while {currentCommand _unit1 == "MOVE" && alive _unit1} do {sleep 1};
74+
waitUntil {sleep 1; (!alive _unit1 || currentCommand _unit1 != "MOVE")};
7575
};
7676
doGetOut (driver (vehicle _unit1));
7777
};
@@ -97,7 +97,7 @@ AIO_fortify_pos_fnc =
9797
if (unitPos _unit == "AUTO") then {_unit setUnitPos "MIDDLE"};
9898
sleep 0.2;
9999
_unit moveTo _pos;
100-
while {alive _unit && !moveToCompleted _unit} do {sleep 1};
100+
waitUntil {sleep 1; !(alive _unit && !moveToCompleted _unit)};
101101
_unit doWatch _watchPos;
102102
_unit doMove (getPos _unit);
103103
};

addons/AIO_AIMENU/config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class CfgPatches
22
{
3-
class AIO_AIMenu
3+
class AIO_AIMENU
44
{
55
author="Leopard20";
66
name="All-In-One Command Menu";
@@ -32,14 +32,14 @@ class CfgPatches
3232

3333
class Extended_PreInit_EventHandlers
3434
{
35-
class AIO_AIMenu_Init
35+
class AIO_AIMENU_Init
3636
{
3737
clientInit="call compile preProcessFileLineNumbers '\AIO_AIMENU\XEH_preInit.sqf'";
3838
};
3939
};
4040
class Extended_PostInit_EventHandlers
4141
{
42-
class AIO_AIMenu
42+
class AIO_AIMENU
4343
{
4444
clientInit="call compile preprocessFileLineNumbers '\AIO_AIMENU\init.sqf'";
4545
};

0 commit comments

Comments
 (0)