mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
2bde515aaa
* Add CBA setting for modIcons * Add CBA settings for camera control * Merge the 2 inverted settings into one There's no man crazy enough to need one inverted and the other normal * Add back missing newline * Change rscCommon, don't redefine base classes * Change anim to "civil" when not in a weapon or special tab * Fix current handgun ending up in launchers tab and vice versa * Change back virtualItems first index to primary secondary handgun * Add ace_arsenal_hide config check and config entry * Add dogtags handling in postInit * Add CBA setting for fontHeight for left and right panel * magazineGroups * Add base layout for loadouts GUI * Prepare the SQF base for the loadouts display * Continue laying the base for the SQF of the loadouts display * Add CBA settings for the loadouts display * Implement button logic for loadouts display * Finish button logic, start adding filling and button funcs * Add editBox for loadout names * Add loadout saving and deleting * Add loadouts loading * Add select current after list is refreshed after saving * Redo button layout, Add rename button, Add messages * Add double click loading * Fix loadout deleting not triggering curSel change * Keep cursor at same index when deleting loadouts Woops * Reload pictures when saving over old loadout * Fix loadout save not updating the pictures properly (again) * Add close button for loadouts dialog * Fix weight not updating when using arrows to add / remove items * Make the arsenal layout a bit prettier * Start adding non available items and missing mods for loadouts * Remove useless lines in fillLoadouts * Move buttonHide above panel fill in loadoutsClose * Change the way weapons are checked in fillLoadoutsList * Add weapon in container support for fillLoadoutsList * Add mag in container check for fillLoadoutsList * Add item check for containers in fillLoadoutsList * Fix item duplication when loadout loadouts * Switch anim to civil for the rest of the tabs that need it * Make extra sure item duplication won't happen * Fix right panel hiding issues * Fix remove all button, use QGVAR for EHs names, add isMP check to share tab * Fix initBox erroring out if the object is null * Move loadout checking to it's own func * Force panel reload every time loadoutList change I'm forced to do this, I can't save arrays in listnboxes * Change how loadouts are retrived from the listnbox * Fix save overwriting existing loadout not updating right row * Fix indentation in buttonLoadoutsSave * Fix reserved var error * Fix fillLoadoutlist tab check * Fix accessories in containers not being checked properly via verifyLoadout * Fix binos not being detected properly by verifyLoadout * Fix pre-filled backpacks not behaving properly * Add mine detector check in configScan and onArsenalOpen * Add extra traces * Add mine detector check in non cached part of addVirtualItems * Move right panel greying to it's own func * Fix right panel listnbox for items with mass under 1 * Redo unique items sorting in onArsenalOpen * Add loadoutSaved EH, handle empty name box for loadout saving * Reapply inisgnia after loadout is loaded * Change LoadoutSaved to loadoutSaved * Rename savedLoadout to onLoadoutSave * Change buttonLoadoutsSave layout to prepare base weapon saving * Save base class for weapons when saving loadouts * Remove unused profiling code related code * Add not implemented warning messages for export and import * Fix error when saving with a container or weapon slot being empty * Remove dogtags from loadout upon loadout saving * Change how misc item mass is retrieved * Remove vanilla "NoVoice" from voices to avoid an error related to it * Use tolower for currentData and itemsToCheck in fillLeftPanel Avoid camelCase issues with the commands that don't fucking respect it. * Remove redundant check in postInit * Fix sharedLoadouts condition in onArsenalOpen, Fix save button logic * Prepare sharedLoadouts addition * Add loadout sharing * Add proper saving and loading for shared loadouts * Change loadout deleted / unshared EH name, add said EH to unsharing * Remove shared loadouts from disconnected players * Fix error in buttonLoadoutsSave, add row when other share a loadout * Change sharedLoadouts tab curSel selection to lnbData instead of lnbText * Add data when adding a new row via CBA EH * Remove mode, add arg to openBox to have arsenal prefilled * Cleanup buttonClearAll code * Fix itemInfo behavior when switching between items that don't have logos Fix #23 * Add copy paste and arrow key support for searchbars Close #22 * Add back newline at EOF for onKeyDown * Change default camera setting from non inverted to inverted * Fix import and export "not implemented" message * Rename share button to Unshare when loadout selected is shared * Improve missing items logging, cache verifyLoadout check * Remove unused var * Add full 3DEN support * Remove 3DEN sphere and grid, set helper center dir properly * Change 3DEN lightsource intensity * Save 3DEN inventory properly * Rewrite onArsenalClose 3DEN comment * Fix sharedLoadouts check * Add 3DEN support for defaultTab * Add new event for 3rd parties in buttonCargo * Move weight update to updateRightPanel for buttonCargo and selChangedListnBox * Fix defaultLoadout save button * Remove unallowed command * Fix arsenal messages not working in 3DEN * Add export current loadout, Add export defaultLoadoutsList Signed-off-by: Josuan Albin <josuanalbin@outlook.fr> * Add import button functionality * Change export / import messages * Change message to use scheduled only * Attempt to sanitize data in import func * Add a 3DEN attribute to save defaultLoadoutsList, fix shared loadout check * Replace 2 last traces in verifyLoadout * Change defaultLoadoutsList export format and add a 3DEN check for it's default value * Fix original array being modified in fillLoadoutsList * Improve shared loadout check * Fix removeVirtualItems not removing Accs, nil virtualItems var in removeBox * Add zeus support for arsenal rewrite, fix openBox camera check * Add isPlayer check to arsenal rewrite part of bi module Arsenal rewrite does not seem to work on remote players, welp, I tried at least * Fix shared loadouts loadout index being null Forgot to change that one getVar * Hide shared column if sharing is disabled on My loadouts tab * Remove trace from loadoutsLoad, add trace to shared and unshared EHs * Fix postInit trace * Fix sharing EHs being broken, remove traces in them, prevent possible issue yeah, _x params doesn't work there :p * Fix fillLoadoutsList error * Start translating and code reviewing * Add editing vehicle crew loadout support for arsenal * Move left panel filling above 3DEN handling to avoid float crew members * Fix onArsenalClose EOF, add header for it * Move onButton EHs to config, remove placeholder stats func * Add headers for onLoadouts funcs and verifyLoadout * Clean up buttonClearAll * Fix assigned items not being added properly to currentItems on loadout load * Add more function headers * Make rename work in default loadouts tab in 3DEN * Add more functions headers, continue code review * Add more functions headers, finish code review * Fix loadout saving to profile from an other tab than my loadouts * Fix loadout saving even more * Attempt to fix loadouts handling From totally broken to somewhat usable. * Even more fixing * Add back onLoadoutSave EH * Add back author message in loadoutSave * Add back EOF newline * Add back loadout caching * Remove unique items from saved and loaded loadouts * Add unique item support for the remaining container tabs * Fix mag check for magazine type in container * Add support for CfgVehicles and CfgGlasses in miscItems * Add button highlighting for loadouts display, fix mag put and throw check * Change shared column to show a proper icon * Revert "Move onButton EHs to config, remove placeholder stats func" This reverts commit1be5d92426
. * Add back EOL newline in prep, remove stats placeholder again * Add part of the german translation * Add more translations, change how shared button text is managed * Add scheduled check in openBox to avoid issues with people using addaction Because you know they will. * Add translations for import and export messages * Fix comms tab defaulting to empty * Align buttons perfectly for loadouts display, translation for delete action * Add loadout saved translations * Add load and rename messages translations * localized interaction name in initBox * Fix issue when admins deleted a loadout didn't change the icon status for authors * Fix loadout import, update unique items list after import / loadout load * Beautify UI a bit * Add setting to toggle missing / unavailable items RPT logging * Add settings strings * Increase button size for main display * Change DLC logo side in infoBox * Change loadouts display buttons spacing, change deleteLoadout button active color * Remove camera rotation limit * Add polish translation * German translation by @bux * Order * Fix typo in buttonExport, add credits in handleMouse * Fix right panel item count not updating properly in certain scenarios * Add loadoutName check when importing default loadouts, change assignedItems check * Improve onSelChangedRight, fix typos in onSelChangedLeft and handleSearchbar * Fix syntax check in removeVirtualItems count * Shorten onSelChangedRightListnbox by improving current tab check * Improve fillLeftPanel weapon tab filling * Move lnbSetPicture occurences for the loadouts display to a define * scan config opti * Fix RPT logging check in fillLoadoutsList, use picture macro for shared tab * Fix sharing and RPT logging settings having the same var * Add newline at EOF for funcs that are missing it * Move GVAR(sharedLoadoutsVars) to sharedLoadoutsNamespace * newline eof commy contributed too! * Fix delete button not working as intended in public tab * Replace bis_fnc_baseWeapon with CBA equivalent everywhere outisde of scanConfig * Revert "Replace bis_fnc_baseWeapon with CBA equivalent everywhere outisde of scanConfig" This reverts commit496e6f8223
. * Add new Cfg entry for handling unique items saving, add entry to chemlight shields * Fix currentMag tab not detecting current mag properly (still experimental) * Improve left and right filled EHs, add "Dog Tags:" for dogtag uniques * Change how the right panel first update works * Fix updateRightPanel very obscure bug and header typo * Move postInit EHs for medical and dogtags to their respective postInit * Fix medical postInit typo * Add currentMag tabs for primary and secondary muzzles properly * Fix container compatible mags tab not showing anything * Replace an inline if to select in fillRightPanel * Attempt to fix accs recognition when switching weapons * Improve currentMag2 tab show / hide logic Secondary and handguns can't have a secondary mauzzle * Add strings for currentMag and currentMag2 tabs * Readd strings that tabler accidentally removed * Make sorting for the right panel stay the same when switching items / tabs * Replace bis_fnc_addWeapon by the addWeapon command bis_fnc_addWeapon failed when a weapon with the same classname was in one of the player's containers Add mag for primary muzzle after the weapon is added, is possibly replaced by current mag(s) saved in curentItems * Replace BIS_fnc_overviewAuthor in itemInfo It works better * Display itemInfo box properly for currentMag1 and 2 tabs * Don't reset arsenal vision mode after quitting arsenal * Improve showItem * Remove trace from showItem * Move getWeight and weight string from movement to common * Fix typos in addVirtualItems * Comment back compile cache for common (Not yet for arsenal, not until it's validated for a merge) * Replace secondaryMuzzleMag tab icon by @Max255PL 's * Update @Max255PL 's icon * Add missing author strings * Add debug trace for a specific issue * Add more traces in loadoutsSave * Fix bug in loadoutsSave, remove debug traces * Fix typo in loadoutsSave * Fix uniqueBase cfg check for all cases in loadoutsSave * Improve whitelisting for current weapon accs and mags * Update CBA settings strings, change RPT logging to be turned off by default * Update polish translation by @max255PL * Fix saving loadouts when no loadout has ever been saved * Make loadout screen lighter * Save camera position and view mode for ace arsenal * Improve loadouts screen presentation * Improve loadouts screen readability * Improve camera angle in loadout screen * Improve loadout renaming, Fix bug linked to renaming * Fix wrong loadout being used while renaming and color not being reapplied * Fix other possible issue with renaming * Change missing items color to be more colorblind friendly * Fix typo and improve return check in getWeight * Disable debug and re-enable compile cache for common and arsenal * Remove uneccessary newline in arsenal's script_component.hpp
224 lines
10 KiB
Plaintext
224 lines
10 KiB
Plaintext
/*
|
|
* Author: Alganthe, Dedmen
|
|
* Add virtual items to the provided target.
|
|
*
|
|
* Arguments:
|
|
* 0: Target <OBJECT>
|
|
* 1: Items <ARRAY of strings> <BOOL>
|
|
* 2: Add globally <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_addVirtualItems
|
|
* [_box, true, false] call ace_arsenal_fnc_addVirtualItems
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
#include "script_component.hpp"
|
|
#include "..\defines.hpp"
|
|
|
|
params [["_object", objNull, [objNull]], ["_items", [], [true, []]], ["_global", false, [false]]];
|
|
|
|
if (_object == objNull) exitWith {};
|
|
if (_items isEqualType [] && {count _items == 0}) exitWith {};
|
|
|
|
private _cargo = _object getVariable [QGVAR(virtualItems), [
|
|
[[], [], []], // Weapons 0, primary, secondary, handgun
|
|
[[], [], [], []], // WeaponAccessories 1, optic,side,muzzle,bipod
|
|
[ ], // Magazines 2
|
|
[ ], // Headgear 3
|
|
[ ], // Uniform 4
|
|
[ ], // Vest 5
|
|
[ ], // Backpacks 6
|
|
[ ], // Goggles 7
|
|
[ ], // NVGs 8
|
|
[ ], // Binoculars 9
|
|
[ ], // Map 10
|
|
[ ], // Compass 11
|
|
[ ], // Radio slot 12
|
|
[ ], // Watch slot 13
|
|
[ ], // Comms slot 14
|
|
[ ], // WeaponThrow 15
|
|
[ ], // WeaponPut 16
|
|
[ ] // InventoryItems 17
|
|
]];
|
|
|
|
private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in variable for perf improvement
|
|
|
|
if (_items isEqualType true && {_items}) then {
|
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
|
|
|
{
|
|
(_x select 0) append (_x select 1);
|
|
(_x select 2) set [(_x select 3), (_x select 0) arrayIntersect (_x select 0)];
|
|
} forEach [
|
|
[(_cargo select 0 select 0),(_configItems select 0 select 0), _cargo select 0, 0],
|
|
[(_cargo select 0 select 1),(_configItems select 0 select 1), _cargo select 0, 1],
|
|
[(_cargo select 0 select 2),(_configItems select 0 select 2), _cargo select 0, 2],
|
|
[(_cargo select 1 select 0),(_configItems select 1 select 0), _cargo select 1, 0],
|
|
[(_cargo select 1 select 1),(_configItems select 1 select 1), _cargo select 1, 1],
|
|
[(_cargo select 1 select 2),(_configItems select 1 select 2), _cargo select 1, 2],
|
|
[(_cargo select 1 select 3),(_configItems select 1 select 3), _cargo select 1, 3]
|
|
];
|
|
|
|
for "_index" from 2 to 17 do {
|
|
(_cargo select _index) append (_configItems select _index);
|
|
_cargo set [_index, (_cargo select _index) arrayIntersect (_cargo select _index)];
|
|
};
|
|
|
|
} else {
|
|
{
|
|
if (_x isEqualType "") then {
|
|
private _configItemInfo = _configCfgWeapons >> _x >> "ItemInfo";
|
|
private _simulationType = getText (_configCfgWeapons >> _x >> "simulation");
|
|
switch true do {
|
|
case (isClass (_configCfgWeapons >> _x)): {
|
|
switch true do {
|
|
/* Weapon acc */
|
|
case (
|
|
isClass (_configItemInfo) &&
|
|
{(getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302]} &&
|
|
{!(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}
|
|
): {
|
|
switch (getNumber (_configItemInfo >> "type")) do {
|
|
case 201: {
|
|
(_cargo select 1) select 0 pushBackUnique _x;
|
|
};
|
|
case 301: {
|
|
(_cargo select 1) select 1 pushBackUnique _x;
|
|
};
|
|
case 101: {
|
|
(_cargo select 1) select 2 pushBackUnique _x;
|
|
};
|
|
case 302: {
|
|
(_cargo select 1) select 3 pushBackUnique _x;
|
|
};
|
|
};
|
|
};
|
|
/* Headgear */
|
|
case (isClass (_configItemInfo) &&
|
|
{getNumber (_configItemInfo >> "type") == 605}): {
|
|
(_cargo select 3) pushBackUnique _x;
|
|
};
|
|
/* Uniform */
|
|
case (isClass (_configItemInfo) &&
|
|
{getNumber (_configItemInfo >> "type") == 801}): {
|
|
(_cargo select 4) pushBackUnique _x;
|
|
};
|
|
/* Vest */
|
|
case (isClass (_configItemInfo) &&
|
|
{getNumber (_configItemInfo >> "type") == 701}): {
|
|
(_cargo select 5) pushBackUnique _x;
|
|
};
|
|
/* NVgs */
|
|
case (_simulationType == "NVGoggles"): {
|
|
(_cargo select 8) pushBackUnique _x;
|
|
};
|
|
/* Binos */
|
|
case (_simulationType == "Binocular" ||
|
|
{(_simulationType == 'Weapon') && {(getNumber (_configCfgWeapons >> _x >> 'type') == 4096)}}): {
|
|
(_cargo select 9) pushBackUnique _x;
|
|
};
|
|
/* Map */
|
|
case (_simulationType == "ItemMap"): {
|
|
(_cargo select 10) pushBackUnique _x;
|
|
};
|
|
/* Compass */
|
|
case (_simulationType == "ItemCompass"): {
|
|
(_cargo select 11) pushBackUnique _x;
|
|
};
|
|
/* Radio */
|
|
case (_simulationType == "ItemRadio"): {
|
|
(_cargo select 12) pushBackUnique _x;
|
|
};
|
|
/* Watch */
|
|
case (_simulationType == "ItemWatch"): {
|
|
(_cargo select 13) pushBackUnique _x;
|
|
};
|
|
/* GPS */
|
|
case (_simulationType == "ItemGPS"): {
|
|
(_cargo select 14) pushBackUnique _x;
|
|
};
|
|
/* UAV terminals */
|
|
case (isClass (_configItemInfo) &&
|
|
{getNumber (_configItemInfo >> "type") == 621}): {
|
|
(_cargo select 14) pushBackUnique _x;
|
|
};
|
|
/* Weapon, at the bottom to avoid adding binos */
|
|
case (isClass (_configCfgWeapons >> _x >> "WeaponSlotsInfo") &&
|
|
{getNumber (_configCfgWeapons >> _x >> 'type') != 4096}): {
|
|
switch (getNumber (_configCfgWeapons >> _x >> "type")) do {
|
|
case 1: {
|
|
(_cargo select 0) select 0 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
};
|
|
case 2: {
|
|
(_cargo select 0) select 2 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
};
|
|
case 4: {
|
|
(_cargo select 0) select 1 pushBackUnique ([_x] call bis_fnc_baseWeapon);
|
|
};
|
|
};
|
|
};
|
|
/* Misc items */
|
|
case (
|
|
isClass (_configItemInfo) &&
|
|
((getNumber (_configItemInfo >> "type")) in [101, 201, 301, 302] &&
|
|
{(_x isKindOf ["CBA_MiscItem", (_configCfgWeapons)])}) ||
|
|
{(getNumber (_configItemInfo >> "type")) in [401, 619, 620]} ||
|
|
{(getText (_configCfgWeapons >> _x >> "simulation")) == "ItemMineDetector"}
|
|
): {
|
|
(_cargo select 17) pushBackUnique _x;
|
|
};
|
|
};
|
|
};
|
|
case (isClass (configFile >> "CfgMagazines" >> _x)): {
|
|
// Lists to check against
|
|
private _grenadeList = [];
|
|
{
|
|
_grenadeList append getArray (_configCfgWeapons >> "Throw" >> _x >> "magazines");
|
|
false
|
|
} count getArray (_configCfgWeapons >> "Throw" >> "muzzles");
|
|
|
|
private _putList = [];
|
|
{
|
|
_putList append getArray (_configCfgWeapons >> "Put" >> _x >> "magazines");
|
|
false
|
|
} count getArray (_configCfgWeapons >> "Put" >> "muzzles");
|
|
|
|
// Check what the magazine actually is
|
|
switch true do {
|
|
// Rifle, handgun, secondary weapons mags
|
|
case (
|
|
(getNumber (configFile >> "CfgMagazines" >> _x >> "type") in [256,512,1536,16]) &&
|
|
{!(_x in _grenadeList)} &&
|
|
{!(_x in _putList)}
|
|
): {
|
|
(_cargo select 2) pushBackUnique _x;
|
|
};
|
|
// Grenades
|
|
case (_x in _grenadeList): {
|
|
(_cargo select 15) pushBackUnique _x;
|
|
};
|
|
// Put
|
|
case (_x in _putList): {
|
|
(_cargo select 16) pushBackUnique _x;
|
|
};
|
|
};
|
|
};
|
|
case (isClass (configFile >> "CfgVehicles" >> _x)): {
|
|
if (getText (configFile >> "CfgVehicles" >> _x >> "vehicleClass") == "Backpacks") then {
|
|
(_cargo select 6) pushBackUnique _x;
|
|
};
|
|
};
|
|
case (isClass (configFile >> "CfgGlasses" >> _x)): {
|
|
(_cargo select 7) pushBackUnique _x;
|
|
};
|
|
};
|
|
};
|
|
} foreach _items;
|
|
};
|
|
|
|
_object setVariable [QGVAR(virtualItems), _cargo, _global];
|