mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Attempt to fix loadouts handling
From totally broken to somewhat usable.
This commit is contained in:
@ -32,7 +32,7 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
_data deleteAt (_data find ((_data select {_x select 0 == _loadoutName}) select 0));
|
||||
};
|
||||
|
||||
_contentPanelCtrl setVariable [_loadoutName + QGVAR(currentLoadoutsTab), nil];
|
||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), nil];
|
||||
_contentPanelCtrl lnbDeleteRow _contentPanelCursSel;
|
||||
_contentPanelCtrl lnbSetCurSelRow (_contentPanelCursSel);
|
||||
|
||||
|
@ -26,7 +26,7 @@ private _loadout = switch GVAR(currentLoadoutsTab) do {
|
||||
|
||||
case IDC_buttonMyLoadouts;
|
||||
case IDC_buttonDefaultLoadouts:{
|
||||
_contentPanelCtrl getVariable _loadoutName + QGVAR(currentLoadoutsTab)
|
||||
_contentPanelCtrl getVariable _loadoutName + str GVAR(currentLoadoutsTab)
|
||||
};
|
||||
|
||||
case IDC_buttonSharedLoadouts:{
|
||||
|
@ -23,7 +23,7 @@ private _data = [profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(
|
||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||
private _curSelRow = lnbCurSelRow _contentPanelCtrl;
|
||||
private _loadoutName = _contentPanelCtrl lnbText [_curSelRow, 1];
|
||||
private _loadout = _contentPanelCtrl getVariable (_loadoutName + QGVAR(currentLoadoutsTab));
|
||||
private _loadout = _contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab));
|
||||
|
||||
private _editBoxCtrl = _display displayCtrl IDC_textEditBox;
|
||||
private _editBoxContent = ctrlText _editBoxCtrl;
|
||||
@ -36,8 +36,8 @@ if (count _similarLoadouts > 0) exitWith {
|
||||
|
||||
// Update loadout info in profile and list namespaces
|
||||
_data set [_data find ((_data select {_x select 0 == _loadoutName}) select 0), [_editBoxContent, _loadout]];
|
||||
_contentPanelCtrl setVariable [_loadoutName + QGVAR(currentLoadoutsTab), nil];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + QGVAR(currentLoadoutsTab), _loadout];
|
||||
_contentPanelCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), nil];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), _loadout];
|
||||
|
||||
_contentPanelCtrl lnbDeleteRow _curSelRow;
|
||||
|
||||
@ -51,7 +51,7 @@ _contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapon
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + QGVAR(currentLoadoutsTab), _loadout];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), _loadout];
|
||||
|
||||
// Sort and select the current row
|
||||
_contentPanelCtrl lnbSort [1, false];
|
||||
@ -59,7 +59,7 @@ for '_i' from 0 to (((lnbsize _contentPanelCtrl) select 0) - 1) do {
|
||||
if ((_contentPanelCtrl lnbText [_i, 1]) == _editBoxContent) exitwith {_contentPanelCtrl lnbSetCurSelRow _i};
|
||||
};
|
||||
|
||||
if (is3DEN) then {
|
||||
if (is3DEN && {GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts}) then {
|
||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||
};
|
||||
|
||||
|
@ -25,26 +25,24 @@ if (_editBoxContent == "") exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), format ["The name box is empty!", _editBoxContent]] call FUNC(message); // TBL
|
||||
};
|
||||
|
||||
private _data = [+(profileNamespace getVariable [QGVAR(saved_loadouts), []]), +GVAR(defaultLoadoutsList)] select (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts);
|
||||
private _loadout = getUnitLoadout GVAR(center);
|
||||
|
||||
private _data = [+(profileNamespace getVariable QGVAR(saved_loadouts)), +(GVAR(defaultLoadoutsList))] select (GVAR(currentLoadoutsTab) == IDC_buttonDefaultLoadouts && {is3DEN});
|
||||
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||
private _cursSelRow = lnbCurSelRow _contentPanelCtrl;
|
||||
|
||||
private _loadoutName = _contentPanelCtrl lnbText [_cursSelRow, 1];
|
||||
private _curSelLoadout = _contentPanelCtrl getVariable (_loadoutName + QGVAR(currentLoadoutsTab));
|
||||
private _curSelLoadout = _contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab));
|
||||
private _loadout = getUnitLoadout GVAR(center);
|
||||
|
||||
private _sameNameLoadoutsList = _data select {_x select 0 == _editBoxContent};
|
||||
|
||||
scopeName "main";
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in GVAR(sharedLoadoutsVars);
|
||||
if (_similarSharedLoadout) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), format ["You are sharing a loadout with this name", _editBoxContent]] call FUNC(message); // TBL
|
||||
};
|
||||
|
||||
switch (GVAR(currentLoadoutsTab)) do {
|
||||
case IDC_buttonMyLoadouts:{
|
||||
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in GVAR(sharedLoadoutsVars);
|
||||
if (_similarSharedLoadout) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), format ["You are sharing a loadout with this name", _editBoxContent]] call FUNC(message); // TBL
|
||||
breakOut "main";
|
||||
};
|
||||
|
||||
for "_dataIndex" from 0 to 10 do {
|
||||
switch (_dataIndex) do {
|
||||
|
||||
@ -115,7 +113,7 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
|
||||
|
||||
_contentPanelCtrl setVariable [_editBoxContent + QGVAR(currentLoadoutsTab), _loadout];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), _loadout];
|
||||
|
||||
_contentPanelCtrl lnbSort [1, false];
|
||||
|
||||
@ -125,13 +123,16 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
};
|
||||
|
||||
profileNamespace setVariable [QGVAR(saved_loadouts), _data];
|
||||
|
||||
private _savedLoadout = (_data select {_x select 0 == _editBoxContent}) select 0;
|
||||
[QGVAR(onLoadoutSave), [_data find _savedLoadout, _savedLoadout]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
case IDC_buttonDefaultLoadouts:{
|
||||
|
||||
if (is3DEN) then {
|
||||
|
||||
_sameNameLoadoutsList = GVAR(defaultLoadoutsList) select {_x select 0 == _editBoxContent};
|
||||
private _sameNameLoadoutsList = _data select {_x select 0 == _editBoxContent};
|
||||
|
||||
for "_dataIndex" from 0 to 10 do {
|
||||
switch (_dataIndex) do {
|
||||
@ -202,7 +203,7 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];
|
||||
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
|
||||
|
||||
_contentPanelCtrl setVariable [_editBoxContent + QGVAR(currentLoadoutsTab), _loadout];
|
||||
_contentPanelCtrl setVariable [_editBoxContent + str GVAR(currentLoadoutsTab), _loadout];
|
||||
|
||||
_contentPanelCtrl lnbSort [1, false];
|
||||
|
||||
@ -212,13 +213,10 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
};
|
||||
|
||||
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
|
||||
} else {
|
||||
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in GVAR(sharedLoadoutsVars);
|
||||
if (_similarSharedLoadout) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), format ["You are sharing a loadout with this name", _editBoxContent]] call FUNC(message); // TBL
|
||||
breakOut "main";
|
||||
};
|
||||
private _savedLoadout = (_data select {_x select 0 == _editBoxContent}) select 0;
|
||||
[QGVAR(onLoadoutSave), [_data find _savedLoadout, _savedLoadout]] call CBA_fnc_localEvent;
|
||||
} else {
|
||||
|
||||
if (count _sameNameLoadoutsList == 0) then {
|
||||
_data pushBack [_editBoxContent, _curSelLoadout];
|
||||
@ -232,13 +230,7 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
|
||||
case IDC_buttonSharedLoadouts :{
|
||||
|
||||
private _similarSharedLoadout = (profileName + _editBoxContent) in GVAR(sharedLoadoutsVars);
|
||||
if (_similarSharedLoadout) exitWith {
|
||||
[(findDisplay IDD_ace_arsenal), format ["You are sharing a loadout with this name", _editBoxContent]] call FUNC(message); // TBL
|
||||
breakOut "main";
|
||||
};
|
||||
|
||||
private _loadout = (GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_cursSelRow, 0]) + (_contentPanelCtrl lnbText [_cursSelRow, 1]))) select 2;
|
||||
_loadout = (GVAR(sharedLoadoutsNamespace) getVariable ((_contentPanelCtrl lnbText [_cursSelRow, 0]) + (_contentPanelCtrl lnbText [_cursSelRow, 1]))) select 2;
|
||||
|
||||
if (count _sameNameLoadoutsList == 0) then {
|
||||
_data pushBack [_editBoxContent, _loadout];
|
||||
@ -249,8 +241,4 @@ switch (GVAR(currentLoadoutsTab)) do {
|
||||
profileNamespace setVariable [QGVAR(saved_loadouts), _data];
|
||||
};
|
||||
};
|
||||
|
||||
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was saved", _editBoxContent]] call FUNC(message); // TBL
|
||||
|
||||
private _savedLoadout = (_data select {_x select 0 == _editBoxContent}) select 0;
|
||||
[QGVAR(onLoadoutSave), [_data find _savedLoadout, _savedLoadout]] call CBA_fnc_localEvent;
|
||||
[(findDisplay IDD_ace_arsenal), format ["Loadout '%1' was saved", _editBoxContent]] call FUNC(message); // TBL
|
@ -25,7 +25,7 @@ private _profileName = profileName; // GVAR(center) could be a remote unit
|
||||
private _loadoutVar = _profileName + _loadoutName;
|
||||
|
||||
private _loadoutIndex = GVAR(sharedLoadoutsVars) find _loadoutVar;
|
||||
private _loadoutData = _contentPanelCtrl getVariable (_loadoutName + QGVAR(currentLoadoutsTab));
|
||||
private _loadoutData = _contentPanelCtrl getVariable (_loadoutName + str GVAR(currentLoadoutsTab));
|
||||
|
||||
if (_loadoutIndex > -1) then {
|
||||
GVAR(sharedLoadoutsNamespace) setVariable [_loadoutVar, nil, true];
|
||||
|
@ -31,16 +31,10 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
{
|
||||
_x params ["_loadoutName", "_loadoutData"];
|
||||
|
||||
// Check if the check was ran already
|
||||
if (isNil {_contentListCtrl getVariable _loadoutName}) then {
|
||||
|
||||
[_loadoutData] call FUNC(verifyLoadout)
|
||||
} else {
|
||||
_contentListCtrl getVariable (_loadoutName + "missingOrNilItemsCount")
|
||||
} params ["_loadout", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
|
||||
[_loadoutData] call FUNC(verifyLoadout) params ["_loadout", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
|
||||
|
||||
// Log missing / nil items to RPT
|
||||
if (!(isNil "_nullItemsList") && {_nullItemsAmount > 0} || {_unavailableItemsAmount > 0}) then {
|
||||
if (_nullItemsAmount > 0 || {_unavailableItemsAmount > 0}) then {
|
||||
|
||||
private _printComponent = "ACE_Arsenal - Loadout:";
|
||||
private _printNullItemsList = ["Missing items:", str _nullItemsList] joinString " ";
|
||||
@ -76,8 +70,7 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
|
||||
};
|
||||
};
|
||||
|
||||
_contentListCtrl setVariable [_loadoutName + QGVAR(currentLoadoutsTab), _loadout];
|
||||
_contentListCtrl setVariable [_loadoutName + "missingOrNilItemsCount" + QGVAR(currentLoadoutsTab) , [_nullItemsAmount, _unavailableItemsAmount]];
|
||||
_contentListCtrl setVariable [_loadoutName + str GVAR(currentLoadoutsTab), _loadout];
|
||||
|
||||
if ((profileName + _loadoutName) in GVAR(sharedLoadoutsVars)) then {
|
||||
_contentListCtrl lnbSetText [[_newRow, 0], "X"];
|
||||
|
Reference in New Issue
Block a user