vehicle left panel

This commit is contained in:
LinkIsGrim 2024-02-04 14:54:33 -03:00
parent 1e404cf85b
commit ef02b96dd2
17 changed files with 90 additions and 9 deletions

View File

@ -10,7 +10,7 @@ class GVAR(sorts) {
class ACE_alphabetically: sortBase {
scope = 2;
displayName = "$STR_a3_rscdisplayarsenal_sort_alphabet";
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}, {0,1,2,3,4,5,6,7}};
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}, {0,1,2,3,4,5,6,7}};
statement = QUOTE({});
};

View File

@ -39,6 +39,7 @@ PREP(fillLeftPanel);
PREP(fillLoadoutsList);
PREP(fillRightPanel);
PREP(fillSort);
PREP(getNearbyInventories);
PREP(getVirtualItems);
PREP(handleActions);
PREP(handleLoadoutsSearchbar);

View File

@ -106,6 +106,8 @@
#define IDC_buttonVoice 2035
#define IDC_iconBackgroundInsigna 2036
#define IDC_buttonInsignia 2037
#define IDC_iconBackgroundContainer 2038
#define IDC_buttonContainer 2039
#define IDC_iconBackgroundOptic 21
#define IDC_buttonOptic 22
#define IDC_iconBackgroundItemAcc 23

View File

@ -32,7 +32,8 @@ private _actionList = [
[], // Watch 14
[], // Face 15
[], // Voice 16
[] // Insignia 17
[], // Insignia 17
[] // Containers 18
];
private _configGroupEntries = "true" configClasses (configFile >> QGVAR(actions));

View File

@ -49,7 +49,8 @@ private _sortListLeftPanel = [
[], // Watch 14
[], // Face 15
[], // Voice 16
[] // Insignia 17
[], // Insignia 17
[] // Containers 18
];
private _sortListRightPanel = [

View File

@ -233,6 +233,26 @@ private _selectedItem = switch (true) do {
GVAR(currentInsignia)
};
case IDC_buttonContainer: {
private _vehicles = call FUNC(getNearbyInventories);
private _displayName = "";
private _lbAdd = -1;
{
if (["ace_cargo"] call EFUNC(common,isModLoaded)) then {
_displayName = [_x, true] call EFUNC(cargo,getNameItem);
} else {
_displayName = getText (configOf _x >> "displayName");
};
_lbAdd = _ctrlPanel lbAdd format ["%1 (%2m)", _displayName, (GVAR(center) distance _x) toFixed 1];
// Since we can't refer to the object directly, we'll use its hashValue instead
_ctrlPanel lbSetData [_lbAdd, hashValue _x];
_ctrlPanel lbSetPicture [_lbAdd, [_x] call EFUNC(common,getVehicleIcon)];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, typeOf _x]];
} forEach _vehicles;
GVAR(currentContainer)
};
// Unknown
default {""};
};

View File

@ -106,7 +106,8 @@ private _sorts = if (_rightSort && {GVAR(currentLeftPanel) in [IDC_buttonUniform
IDC_buttonWatch,
IDC_buttonFace,
IDC_buttonVoice,
IDC_buttonInsignia
IDC_buttonInsignia,
IDC_buttonContainer
] find _idc)
};
}

View File

@ -0,0 +1,12 @@
#include "..\script_component.hpp"
if !(GVAR(enableInventoryEditing)) exitWith {[]};
private _typesToSkip = ["CAManBase", "WeaponHolder"];
(GVAR(center) nearSupplies 10) select {
private _object = _x;
_object != GVAR(currentBox) &&
{_typesToSkip findIf {_object isKindOf _x} == -1} &&
{[GVAR(center), _x] call EFUNC(common,canInteractWith)} &&
{GVAR(vehicleMap) set [hashValue _x, _x]; true}
} // return

View File

@ -38,7 +38,8 @@ private _panel = [
IDC_buttonWatch,
IDC_buttonFace,
IDC_buttonVoice,
IDC_buttonInsignia
IDC_buttonInsignia,
IDC_buttonContainer
] find GVAR(currentLeftPanel);
private _groups = (GVAR(actionList) select _panel) select {

View File

@ -201,8 +201,8 @@ private _fnc_handleStats = {
// Check if in left or right panel
if (ctrlIDC _control == IDC_leftTabContent) then {
// Faces, voices and insigna do not have stats
if ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia] find GVAR(currentLeftPanel) > -1) then {
// Faces, voices, insignia and containers do not have stats
if ([IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsignia, IDC_buttonContainer] find GVAR(currentLeftPanel) > -1) then {
call _fnc_hideEverything;
} else {
[[

View File

@ -113,6 +113,8 @@ GVAR(currentItems) = nil;
GVAR(currentFace) = nil;
GVAR(currentVoice) = nil;
GVAR(currentInsignia) = nil;
GVAR(currentContainer) = nil;
GVAR(vehicleMap) = nil;
GVAR(currentAction) = nil;
GVAR(currentStatPage) = nil;

View File

@ -70,6 +70,8 @@ GVAR(virtualItemsFlatAll) = +GVAR(virtualItemsFlat);
GVAR(currentFace) = face GVAR(center);
GVAR(currentVoice) = speaker GVAR(center);
GVAR(currentInsignia) = GVAR(center) call BIS_fnc_getUnitInsignia;
GVAR(currentContainer) = "";
GVAR(vehicleMap) = createHashMap;
GVAR(currentAction) = "Stand";
GVAR(shiftState) = false;
@ -252,6 +254,14 @@ private _leftPanelIDC = [IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC
[_display, _display displayCtrl _leftPanelIDC] call FUNC(fillLeftPanel);
if !(GVAR(enableInventory)) then {
{
private _ctrl = _display displayCtrl _x;
_ctrl ctrlShow false;
_ctrl ctrlEnable false;
} forEach [IDC_buttonContainer, IDC_iconBackgroundContainer];
};
//--------------- Init camera
if (isNil QGVAR(cameraPosition)) then {
GVAR(cameraPosition) = [5, 0, 0, [0, 0, 0.85]];

View File

@ -692,6 +692,16 @@ switch (GVAR(currentLeftPanel)) do {
[_display, _control, _curSel, _unitInsigniaConfig] call FUNC(itemInfo);
};
};
// Container
case IDC_buttonContainer: {
GVAR(currentContainer) = _item;
call FUNC(showItem);
TOGGLE_RIGHT_PANEL_HIDE
// call FUNC(openInventoryMenu);
[_display, _control, _curSel, configNull] call FUNC(itemInfo);
};
};
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", GVAR(center) call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);

View File

@ -92,7 +92,8 @@ if (_rightSort) then {
IDC_buttonWatch,
IDC_buttonFace,
IDC_buttonVoice,
IDC_buttonInsignia
IDC_buttonInsignia,
IDC_buttonContainer
] find GVAR(currentLeftPanel)))
]
} params ["_panel", "_cfgClass", "_sorts"];

View File

@ -8,6 +8,15 @@ private _category = LLSTRING(settingCategory);
false
] call CBA_fnc_addSetting;
[
QGVAR(enableInventoryEditing),
"CHECKBOX",
["Enable Inventory Editing", "Allows editing the contents of nearby containers' inventory."],
_category,
true,
true
] call CBA_fnc_addSetting;
[
QGVAR(enableModIcons),
"CHECKBOX",

View File

@ -3,7 +3,7 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
#define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_ARSENAL

View File

@ -866,6 +866,16 @@ class GVAR(display) {
text = "\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\Insignia_ca.paa";
y = QUOTE(170 * GRID_H);
};
class iconBackgroundContainer: iconBackgroundPrimaryWeapon {
idc = IDC_iconBackgroundContainer;
y = QUOTE(180 * GRID_H);
};
class buttonContainer: buttonPrimaryWeapon {
idc = IDC_buttonContainer;
tooltip = "$STR_DN_Vehicles";
text = "\A3\Ui_f\data\Map\VehicleIcons\iconCrateVeh_ca.paa";
y = QUOTE(180 * GRID_H);
};
};
};
class iconBackgroundOptic: ctrlStaticBackground {