From 2b956b441a7ab39c24b2568100268303dfa1bedd Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 25 Feb 2019 22:50:37 +0100 Subject: [PATCH 01/16] preload 3den ammo box item list --- addons/ui/XEH_preStart.sqf | 7 ++ addons/ui/fnc_preload3DEN.sqf | 167 +++++++++++++++++++++++++++++++++ addons/ui/script_component.hpp | 1 + addons/ui/test_preload.sqf | 18 ++++ 4 files changed, 193 insertions(+) create mode 100644 addons/ui/fnc_preload3DEN.sqf create mode 100644 addons/ui/test_preload.sqf diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index 076187991..95cd1676b 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -5,3 +5,10 @@ PREP(initDisplayMultiplayerSetup); PREP(initDisplayOptionsLayout); PREP(initDisplayPassword); PREP(initDisplayRemoteMissions); + +// preload 3den item list +PREP(preload3DEN); + +private _timeStart = diag_tickTime; +call FUNC(preload3DEN); +INFO_1("3DEN item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf new file mode 100644 index 000000000..6d6d6ac57 --- /dev/null +++ b/addons/ui/fnc_preload3DEN.sqf @@ -0,0 +1,167 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Internal Function: cba_ui_fnc_preload3DEN + +Description: + Preload 3den editor ammo box item list. + +Parameters: + None + +Returns: + true: preloaded successfully, false: already preloaded + +Examples: + (begin example) + call cba_ui_fnc_preload3DEN + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ + +if (!isNil {uiNamespace getVariable "AmmoBox_list"}) exitWith { + INFO("3DEN item list already preloaded."); + false +}; + +private _list = [[],[],[],[],[],[],[],[],[],[],[],[]]; +uiNamespace setVariable ["AmmoBox_list", _list]; + +private _types = [ + ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], + ["MachineGun"], + ["SniperRifle"], + ["Launcher","MissileLauncher","RocketLauncher"], + ["Handgun"], + ["UnknownWeapon"], + ["AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod"], + ["Uniform"], + ["Vest"], + ["Backpack"], + ["Headgear","Glasses"], + ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] +]; + +//--- Weapons, Magazines and Items +private _cfgWeapons = configFile >> "CfgWeapons"; +private _cfgMagazines = configFile >> "CfgMagazines"; + +private _magazines = []; + +{ + private _item = toLower configName _x; + (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; + + private _index = -1; + { + if (_itemType in _x) exitWith { + _index = _forEachIndex; + }; + } forEach _types; + + if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { + private _isPublic = getNumber (_x >> "scope") == 2; + private _listItem = _list select _index; + + if (_isPublic) then { + _displayName = getText (_x >> "displayName"); + + // append display name with attachment names + { + _displayName = format [ + "%1 + %2", + _displayName, + getText (_cfgWeapons >> getText (_x >> "item") >> "displayName") + ]; + } forEach ("true" configClasses (_x >> "linkeditems")); //configProperties [_x >> "linkeditems", "isClass _x"]; + + _listItem pushBack [ + _displayName, + _item, + getText (_x >> "picture"), + parseNumber (getNumber (_x >> "type") in [4096, 131072]), + false + ]; + }; + + //--- Magazines + if (_isPublic || {_item in ["throw","put"]}) then { + private _weaponConfig = _x; + + { + private _muzzleConfig = _weaponConfig; + + if (_x != "this") then { + _muzzleConfig = _weaponConfig >> _x; + }; + + { + private _item = tolower _x; + + if ({_x select 1 == _item} count _listItem == 0) then { + private _magazineConfig = _cfgMagazines >> _item; + + if (getNumber (_magazineConfig >> "scope") == 2) then { + _listItem pushBack [ + getText (_magazineConfig >> "displayName"), + _item, + getText (_magazineConfig >> "picture"), + 2, + _item in _magazines + ]; + + _magazines pushBack _item; + }; + }; + } forEach getArray (_muzzleConfig >> "magazines"); + } forEach getArray (_weaponConfig >> "muzzles"); + }; + }; +} forEach ("true" configClasses _cfgWeapons); + +//--- Backpacks +{ + if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) then { + private _item = toLower configName _x; + private _itemType = _item call BIS_fnc_itemType select 1; + + private _index = -1; + { + if (_itemType in _x) exitWith { + _index = _forEachIndex; + }; + } forEach _types; + + if (_index >= 0) then { + (_list select _index) pushBack [ + getText (_x >> "displayName"), + _item, + getText (_x >> "picture"), + 3, + false + ]; + }; + }; +} forEach ("true" configClasses (configFile >> "CfgVehicles")); + +//--- Glasses +private _listHeadgear = _list select 10; + +{ + if (getNumber (_x >> "scope") == 2) then { + _listHeadgear pushBack [ + getText (_x >> "displayName"), + toLower configName _x, + getText (_x >> "picture"), + 3, + false + ]; + }; +} forEach ("true" configClasses (configFile >> "CfgGlasses")); + +{ + _x sort true; +} forEach _list; + +true diff --git a/addons/ui/script_component.hpp b/addons/ui/script_component.hpp index 7c6bed8f5..739e89540 100644 --- a/addons/ui/script_component.hpp +++ b/addons/ui/script_component.hpp @@ -13,6 +13,7 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_UI #endif +#define DEBUG_SYNCHRONOUS #include "\x\cba\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineCommonGrids.inc" diff --git a/addons/ui/test_preload.sqf b/addons/ui/test_preload.sqf new file mode 100644 index 000000000..2333a3542 --- /dev/null +++ b/addons/ui/test_preload.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +// execVM "\x\cba\addons\ui\test_preload.sqf"; + +isNil { + with uiNamespace do { + TEST_DEFINED(QFUNC(preload3DEN),""); + + AmmoBox_list = nil; + ["onLoad", [controlNull]] call compile preprocessFile "\a3\3den\UI\Attributes\AmmoBox.sqf"; + private _vanilla = AmmoBox_list; + + AmmoBox_list = nil; + call FUNC(preload3DEN); + private _cba = AmmoBox_list; + + TEST_TRUE(_vanilla isEqualTo _cba,QFUNC(preload3DEN)); + }; +}; From fd36e2b63bf93aa797a5a6debf498d604de3920d Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 25 Feb 2019 22:59:32 +0100 Subject: [PATCH 02/16] =?UTF-8?q?preload=20=C4=87urator=20ammo=20box=20ite?= =?UTF-8?q?m=20list,=20wip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/ui/XEH_preStart.sqf | 7 +- addons/ui/fnc_preloadCurator.sqf | 141 +++++++++++++++++++++++++++++++ addons/ui/test_preload.sqf | 4 + 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 addons/ui/fnc_preloadCurator.sqf diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index 95cd1676b..e7e336367 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -6,9 +6,14 @@ PREP(initDisplayOptionsLayout); PREP(initDisplayPassword); PREP(initDisplayRemoteMissions); -// preload 3den item list +// preload 3den and curator item lists PREP(preload3DEN); +PREP(preloadCurator); private _timeStart = diag_tickTime; call FUNC(preload3DEN); INFO_1("3DEN item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); + +_timeStart = diag_tickTime; +call FUNC(preloadCurator); +INFO_1("Curator item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf new file mode 100644 index 000000000..cc1e875e1 --- /dev/null +++ b/addons/ui/fnc_preloadCurator.sqf @@ -0,0 +1,141 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Internal Function: cba_ui_fnc_preloadCurator + +Description: + Preload Zeus ammo box item list. + +Parameters: + None + +Returns: + true: preloaded successfully, false: already preloaded + +Examples: + (begin example) + call cba_ui_fnc_preloadCurator + (end) + +Notes: + - curator needs a similar function + - function can be run without adjustments to the ui init script (opposed to curator) + - BIS_fnc_itemType caching + //"\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf" + +Author: + commy2 +---------------------------------------------------------------------------- */ + + + + + + +//--- Get weapons and magazines from curator addons +_curator = getassignedcuratorlogic player; +_weaponAddons = missionnamespace getvariable ["RscAttrbuteInventory_weaponAddons",[]]; +_types = [ + ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], + ["MachineGun"], + ["SniperRifle"], + ["Launcher","MissileLauncher","RocketLauncher"], + ["Handgun"], + ["UnknownWeapon"], + ["AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod"], + ["Uniform"], + ["Vest"], + ["Backpack"], + ["Headgear","Glasses"], + ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] +]; +_typeMagazine = _types find "Magazine"; +_list = [[],[],[],[],[],[],[],[],[],[],[],[]]; +_magazines = []; //--- Store magazines in an array and mark duplicates, so nthey don't appear in the list of all items +{ + _addon = tolower _x; + _addonList = [[],[],[],[],[],[],[],[],[],[],[],[]]; + _addonID = _weaponAddons find _addon; + if (_addonID < 0) then { + { + _weapon = tolower _x; + _weaponType = (_weapon call bis_fnc_itemType); + _weaponTypeCategory = _weaponType select 0; + _weaponTypeSpecific = _weaponType select 1; + _weaponTypeID = -1; + { + if (_weaponTypeSpecific in _x) exitwith {_weaponTypeID = _foreachindex;}; + } foreach _types; + //_weaponTypeID = _types find (_weaponType select 0); + if (_weaponTypeCategory != "VehicleWeapon" && _weaponTypeID >= 0) then { + _weaponCfg = configfile >> "cfgweapons" >> _weapon; + _weaponPublic = getnumber (_weaponCfg >> "scope") == 2; + _addonListType = _addonList select _weaponTypeID; + if (_weaponPublic) then { + _displayName = gettext (_weaponCfg >> "displayName"); + _picture = gettext (_weaponCfg >> "picture"); + { + _item = gettext (_x >> "item"); + _itemName = gettext (configfile >> "cfgweapons" >> _item >> "displayName"); + _displayName = _displayName + " + " + _itemName; + } foreach ((_weaponCfg >> "linkeditems") call bis_fnc_returnchildren); + _displayNameShort = _displayName; + _displayNameShortArray = toarray _displayNameShort; + if (count _displayNameShortArray > 41) then { //--- Cut when the name is too long (41 chars is approximate) + _displayNameShortArray resize 41; + _displayNameShort = tostring _displayNameShortArray + "..."; + }; + _type = if (getnumber (configfile >> "cfgweapons" >> _weapon >> "type") in [4096,131072]) then {1} else {0}; + _addonListType pushback [_weapon,_displayName,_displayNameShort,_picture,_type,false]; + }; + //--- Add magazines compatible with the weapon + if (_weaponPublic || _weapon in ["throw","put"]) then { + //_addonListType = _addonList select _typeMagazine; + { + _muzzle = if (_x == "this") then {_weaponCfg} else {_weaponCfg >> _x}; + { + _mag = tolower _x; + if ({(_x select 0) == _mag} count _addonListType == 0) then { + _magCfg = configfile >> "cfgmagazines" >> _mag; + if (getnumber (_magCfg >> "scope") == 2) then { + _displayName = gettext (_magCfg >> "displayName"); + _picture = gettext (_magCfg >> "picture"); + _addonListType pushback [_mag,_displayName,_displayName,_picture,2,_mag in _magazines]; + _magazines pushback _mag; + }; + }; + } foreach getarray (_muzzle >> "magazines"); + } foreach getarray (_weaponCfg >> "muzzles"); + }; + }; + } foreach getarray (configfile >> "cfgpatches" >> _x >> "weapons"); + { + _weapon = tolower _x; + _weaponType = _weapon call bis_fnc_itemType; + _weaponTypeSpecific = _weaponType select 1; + _weaponTypeID = -1; + { + if (_weaponTypeSpecific in _x) exitwith {_weaponTypeID = _foreachindex;}; + } foreach _types; + //_weaponTypeID = _types find (_weaponType select 0); + if (_weaponTypeID >= 0) then { + _weaponCfg = configfile >> "cfgvehicles" >> _weapon; + if (getnumber (_weaponCfg >> "scope") == 2) then { + _displayName = gettext (_weaponCfg >> "displayName"); + _picture = gettext (_weaponCfg >> "picture"); + _addonListType = _addonList select _weaponTypeID; + _addonListType pushback [_weapon,_displayName,_displayName,_picture,3,false]; + }; + }; + } foreach getarray (configfile >> "cfgpatches" >> _x >> "units"); + _weaponAddons set [count _weaponAddons,_addon]; + _weaponAddons set [count _weaponAddons,_addonList]; + } else { + _addonList = _weaponAddons select (_addonID + 1); + }; + { + _current = _list select _foreachindex; + _list set [_foreachindex,_current + (_x - _current)]; + } foreach _addonList; +} foreach (curatoraddons _curator); +missionnamespace setvariable ["RscAttrbuteInventory_weaponAddons",_weaponAddons]; +RscAttributeInventory_list = _list; diff --git a/addons/ui/test_preload.sqf b/addons/ui/test_preload.sqf index 2333a3542..f2d455f38 100644 --- a/addons/ui/test_preload.sqf +++ b/addons/ui/test_preload.sqf @@ -3,6 +3,7 @@ isNil { with uiNamespace do { + // 3DEN TEST_DEFINED(QFUNC(preload3DEN),""); AmmoBox_list = nil; @@ -14,5 +15,8 @@ isNil { private _cba = AmmoBox_list; TEST_TRUE(_vanilla isEqualTo _cba,QFUNC(preload3DEN)); + + // Curator + TEST_DEFINED(QFUNC(preloadCurator),""); }; }; From 88eeb90f4f0df2908a18f3f71e8ed394ff0853de Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 17:59:25 +0100 Subject: [PATCH 03/16] preload zeus ammo box item list --- addons/ui/XEH_preInit.sqf | 2 ++ addons/ui/XEH_preStart.sqf | 20 +++++++++++--------- addons/ui/fnc_preloadCurator.sqf | 27 +++++++++++---------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/addons/ui/XEH_preInit.sqf b/addons/ui/XEH_preInit.sqf index b2b0c6be3..d9a2258a4 100644 --- a/addons/ui/XEH_preInit.sqf +++ b/addons/ui/XEH_preInit.sqf @@ -29,4 +29,6 @@ if (hasInterface) then { QGVAR(ProgressBar) cutRsc [QGVAR(ProgressBar), "PLAIN"]; }; }]; + + RscAttrbuteInventory_weaponAddons = uiNamespace getVariable QGVAR(curatorItemCache); // spelling is "Attrbute" }; diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index e7e336367..a165a570e 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -6,14 +6,16 @@ PREP(initDisplayOptionsLayout); PREP(initDisplayPassword); PREP(initDisplayRemoteMissions); -// preload 3den and curator item lists -PREP(preload3DEN); -PREP(preloadCurator); +if (hasInterface) then { + // preload 3den and curator item lists + PREP(preload3DEN); + PREP(preloadCurator); -private _timeStart = diag_tickTime; -call FUNC(preload3DEN); -INFO_1("3DEN item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); + _timeStart = diag_tickTime; + call FUNC(preload3DEN); + INFO_1("3DEN item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); -_timeStart = diag_tickTime; -call FUNC(preloadCurator); -INFO_1("Curator item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); + private _timeStart = diag_tickTime; + call FUNC(preloadCurator); + INFO_1("Curator item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); +}; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index cc1e875e1..9076d9cd3 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -17,23 +17,22 @@ Examples: (end) Notes: - - curator needs a similar function - - function can be run without adjustments to the ui init script (opposed to curator) - - BIS_fnc_itemType caching - //"\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf" + To disable cache use in init.sqf: RscAttrbuteInventory_weaponAddons = nil; Author: commy2 ---------------------------------------------------------------------------- */ +if (!isNil {uiNamespace getVariable QGVAR(curatorItemCache)}) exitWith { + INFO("Curator item list already preloaded."); + false +}; - - - +private _weaponAddons = []; +uiNamespace setVariable [QGVAR(curatorItemCache), _weaponAddons]; //--- Get weapons and magazines from curator addons _curator = getassignedcuratorlogic player; -_weaponAddons = missionnamespace getvariable ["RscAttrbuteInventory_weaponAddons",[]]; _types = [ ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], ["MachineGun"], @@ -49,7 +48,7 @@ _types = [ ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] ]; _typeMagazine = _types find "Magazine"; -_list = [[],[],[],[],[],[],[],[],[],[],[],[]]; + _magazines = []; //--- Store magazines in an array and mark duplicates, so nthey don't appear in the list of all items { _addon = tolower _x; @@ -132,10 +131,6 @@ _magazines = []; //--- Store magazines in an array and mark duplicates, so nthey } else { _addonList = _weaponAddons select (_addonID + 1); }; - { - _current = _list select _foreachindex; - _list set [_foreachindex,_current + (_x - _current)]; - } foreach _addonList; -} foreach (curatoraddons _curator); -missionnamespace setvariable ["RscAttrbuteInventory_weaponAddons",_weaponAddons]; -RscAttributeInventory_list = _list; +} forEach call EGVAR(common,addons); + +true From 392bc3817360f1da48f7642c1103955a70d2605b Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 19:28:08 +0100 Subject: [PATCH 04/16] curator preload test --- addons/ui/fnc_preload3DEN.sqf | 3 +++ addons/ui/test_preload.sqf | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 6d6d6ac57..70153a56c 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -16,6 +16,9 @@ Examples: call cba_ui_fnc_preload3DEN (end) +Notes: + To disable cache use: uiNamespace setVariable ["AmmoBox_list", nil]; + Author: commy2 ---------------------------------------------------------------------------- */ diff --git a/addons/ui/test_preload.sqf b/addons/ui/test_preload.sqf index f2d455f38..03aa62401 100644 --- a/addons/ui/test_preload.sqf +++ b/addons/ui/test_preload.sqf @@ -18,5 +18,33 @@ isNil { // Curator TEST_DEFINED(QFUNC(preloadCurator),""); + + private _unit = player; + private _curator = getAssignedCuratorLogic _unit; + + if (isNull _curator) then { + _curator = createGroup sideLogic createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"]; + _curator spawn { + private _group = group _this; + deleteVehicle _this; + deleteGroup _group; + }; + + _unit assignCurator _curator; + _curator removeCuratorAddons call EGVAR(common,addons); + _curator addCuratorAddons call EGVAR(common,addons); + }; + + missionNamespace setVariable ["RscAttrbuteInventory_weaponAddons", nil]; + ["onLoad", [displayNull], objNull] call compile preprocessFile "\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf"; + _vanilla = RscAttributeInventory_list; + + GVAR(curatorItemCache) = nil; + call FUNC(preloadCurator); + missionNamespace setVariable ["RscAttrbuteInventory_weaponAddons", GVAR(curatorItemCache)]; + ["onLoad", [displayNull], objNull] call compile preprocessFile "\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf"; + _cba = RscAttributeInventory_list; + + TEST_TRUE(_vanilla isEqualTo _cba,QFUNC(preloadCurator)); }; }; From e7c807804252a0fb08aafd1373b1dee027e70c14 Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 20:52:18 +0100 Subject: [PATCH 05/16] preload curator ammo box item list --- addons/ui/XEH_preStart.sqf | 4 +- addons/ui/fnc_preload3DEN.sqf | 13 +- addons/ui/fnc_preloadCurator.sqf | 201 +++++++++++++++++++------------ addons/ui/test_preload.sqf | 11 +- 4 files changed, 132 insertions(+), 97 deletions(-) diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index a165a570e..7bb7d6c44 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -13,9 +13,9 @@ if (hasInterface) then { _timeStart = diag_tickTime; call FUNC(preload3DEN); - INFO_1("3DEN item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); + INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); private _timeStart = diag_tickTime; call FUNC(preloadCurator); - INFO_1("Curator item list preloaded. Time: %1 ms",(diag_tickTime - _timeStart) * 1000); + INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); }; diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 70153a56c..271464b26 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -64,11 +64,12 @@ private _magazines = []; } forEach _types; if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { - private _isPublic = getNumber (_x >> "scope") == 2; + private _weaponConfig = _x; + private _isPublic = getNumber (_weaponConfig >> "scope") == 2; private _listItem = _list select _index; if (_isPublic) then { - _displayName = getText (_x >> "displayName"); + _displayName = getText (_weaponConfig >> "displayName"); // append display name with attachment names { @@ -77,21 +78,19 @@ private _magazines = []; _displayName, getText (_cfgWeapons >> getText (_x >> "item") >> "displayName") ]; - } forEach ("true" configClasses (_x >> "linkeditems")); //configProperties [_x >> "linkeditems", "isClass _x"]; + } forEach ("true" configClasses (_weaponConfig >> "linkeditems")); //configProperties [_weaponConfig >> "linkeditems", "isClass _x"]; _listItem pushBack [ _displayName, _item, - getText (_x >> "picture"), - parseNumber (getNumber (_x >> "type") in [4096, 131072]), + getText (_weaponConfig >> "picture"), + parseNumber (getNumber (_weaponConfig >> "type") in [4096, 131072]), false ]; }; //--- Magazines if (_isPublic || {_item in ["throw","put"]}) then { - private _weaponConfig = _x; - { private _muzzleConfig = _weaponConfig; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 9076d9cd3..3d38d2772 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -28,12 +28,10 @@ if (!isNil {uiNamespace getVariable QGVAR(curatorItemCache)}) exitWith { false }; -private _weaponAddons = []; -uiNamespace setVariable [QGVAR(curatorItemCache), _weaponAddons]; +private _list = []; +uiNamespace setVariable [QGVAR(curatorItemCache), _list]; -//--- Get weapons and magazines from curator addons -_curator = getassignedcuratorlogic player; -_types = [ +private _types = [ ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], ["MachineGun"], ["SniperRifle"], @@ -47,90 +45,133 @@ _types = [ ["Headgear","Glasses"], ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] ]; -_typeMagazine = _types find "Magazine"; -_magazines = []; //--- Store magazines in an array and mark duplicates, so nthey don't appear in the list of all items +//--- Weapons, Magazines and Items +private _cfgPatches = configFile >> "CfgPatches"; +private _cfgVehicles = configFile >> "CfgVehicles"; +private _cfgWeapons = configFile >> "CfgWeapons"; +private _cfgMagazines = configFile >> "CfgMagazines"; + +private _magazines = []; + { + private _patchConfig = _cfgPatches >> _x; _addon = tolower _x; - _addonList = [[],[],[],[],[],[],[],[],[],[],[],[]]; - _addonID = _weaponAddons find _addon; - if (_addonID < 0) then { + + private _addonList = [[],[],[],[],[],[],[],[],[],[],[],[]]; + + { + private _item = tolower _x; + (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; + + private _index = -1; { - _weapon = tolower _x; - _weaponType = (_weapon call bis_fnc_itemType); - _weaponTypeCategory = _weaponType select 0; - _weaponTypeSpecific = _weaponType select 1; - _weaponTypeID = -1; - { - if (_weaponTypeSpecific in _x) exitwith {_weaponTypeID = _foreachindex;}; - } foreach _types; - //_weaponTypeID = _types find (_weaponType select 0); - if (_weaponTypeCategory != "VehicleWeapon" && _weaponTypeID >= 0) then { - _weaponCfg = configfile >> "cfgweapons" >> _weapon; - _weaponPublic = getnumber (_weaponCfg >> "scope") == 2; - _addonListType = _addonList select _weaponTypeID; - if (_weaponPublic) then { - _displayName = gettext (_weaponCfg >> "displayName"); - _picture = gettext (_weaponCfg >> "picture"); - { - _item = gettext (_x >> "item"); - _itemName = gettext (configfile >> "cfgweapons" >> _item >> "displayName"); - _displayName = _displayName + " + " + _itemName; - } foreach ((_weaponCfg >> "linkeditems") call bis_fnc_returnchildren); - _displayNameShort = _displayName; - _displayNameShortArray = toarray _displayNameShort; - if (count _displayNameShortArray > 41) then { //--- Cut when the name is too long (41 chars is approximate) - _displayNameShortArray resize 41; - _displayNameShort = tostring _displayNameShortArray + "..."; - }; - _type = if (getnumber (configfile >> "cfgweapons" >> _weapon >> "type") in [4096,131072]) then {1} else {0}; - _addonListType pushback [_weapon,_displayName,_displayNameShort,_picture,_type,false]; + if (_itemType in _x) exitWith { + _index = _forEachIndex; + }; + } forEach _types; + + if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { + private _weaponConfig = _cfgWeapons >> _item; + private _isPublic = getNumber (_weaponConfig >> "scope") == 2; + private _listItem = _addonList select _index; + + if (_isPublic) then { + _displayName = getText (_weaponConfig >> "displayName"); + + // append display name with attachment names + { + _displayName = format [ + "%1 + %2", + _displayName, + getText (_cfgWeapons >> getText (_x >> "item") >> "displayName") + ]; + } forEach ("true" configClasses (_weaponConfig >> "linkeditems")); //configProperties [_weaponConfig >> "linkeditems", "isClass _x"]; + + private _displayNameShort = _displayName; + private _displayNameShortArray = toArray _displayNameShort; + + if (count _displayNameShortArray > 41) then { + _displayNameShortArray resize 41; + _displayNameShort = format ["%1...", toString _displayNameShortArray]; }; - //--- Add magazines compatible with the weapon - if (_weaponPublic || _weapon in ["throw","put"]) then { - //_addonListType = _addonList select _typeMagazine; + + _listItem pushBack [ + _item, + _displayName, + _displayNameShort, + getText (_weaponConfig >> "picture"), + parseNumber (getNumber (_weaponConfig >> "type") in [4096, 131072]), + false + ]; + }; + + //--- Magazines + if (_isPublic || {_item in ["throw","put"]}) then { + { + private _muzzleConfig = _weaponConfig; + + if (_x != "this") then { + _muzzleConfig = _weaponConfig >> _x; + }; + { - _muzzle = if (_x == "this") then {_weaponCfg} else {_weaponCfg >> _x}; - { - _mag = tolower _x; - if ({(_x select 0) == _mag} count _addonListType == 0) then { - _magCfg = configfile >> "cfgmagazines" >> _mag; - if (getnumber (_magCfg >> "scope") == 2) then { - _displayName = gettext (_magCfg >> "displayName"); - _picture = gettext (_magCfg >> "picture"); - _addonListType pushback [_mag,_displayName,_displayName,_picture,2,_mag in _magazines]; - _magazines pushback _mag; - }; + private _item = tolower _x; + + if ({_x select 0 == _item} count _listItem == 0) then { + private _magazineConfig = _cfgMagazines >> _item; + + if (getNumber (_magazineConfig >> "scope") == 2) then { + private _displayName = getText (_magazineConfig >> "displayName"); + + _listItem pushBack [ + _item, + _displayName, + _displayName, + getText (_magazineConfig >> "picture"), + 2, + _item in _magazines + ]; + + _magazines pushBack _item; }; - } foreach getarray (_muzzle >> "magazines"); - } foreach getarray (_weaponCfg >> "muzzles"); - }; + }; + } forEach getArray (_muzzleConfig >> "magazines"); + } forEach getArray (_weaponConfig >> "muzzles"); }; - } foreach getarray (configfile >> "cfgpatches" >> _x >> "weapons"); + }; + } forEach getArray (_patchConfig >> "weapons"); + + { + private _item = toLower _x; + private _itemType = _item call BIS_fnc_itemType select 1; + + private _index = -1; { - _weapon = tolower _x; - _weaponType = _weapon call bis_fnc_itemType; - _weaponTypeSpecific = _weaponType select 1; - _weaponTypeID = -1; - { - if (_weaponTypeSpecific in _x) exitwith {_weaponTypeID = _foreachindex;}; - } foreach _types; - //_weaponTypeID = _types find (_weaponType select 0); - if (_weaponTypeID >= 0) then { - _weaponCfg = configfile >> "cfgvehicles" >> _weapon; - if (getnumber (_weaponCfg >> "scope") == 2) then { - _displayName = gettext (_weaponCfg >> "displayName"); - _picture = gettext (_weaponCfg >> "picture"); - _addonListType = _addonList select _weaponTypeID; - _addonListType pushback [_weapon,_displayName,_displayName,_picture,3,false]; - }; + if (_itemType in _x) exitWith { + _index = _forEachIndex; + }; + } forEach _types; + + if (_index >= 0) then { + private _weaponConfig = _cfgVehicles >> _item; + + if (getNumber (_weaponConfig >> "scope") == 2) then { + private _displayName = getText (_weaponConfig >> "displayName"); + + (_addonList select _index) pushBack [ + _item, + _displayName, + _displayName, + getText (_weaponConfig >> "picture"), + 3, + false + ]; }; - } foreach getarray (configfile >> "cfgpatches" >> _x >> "units"); - _weaponAddons set [count _weaponAddons,_addon]; - _weaponAddons set [count _weaponAddons,_addonList]; - } else { - _addonList = _weaponAddons select (_addonID + 1); - }; -} forEach call EGVAR(common,addons); + }; + } forEach getArray (_patchConfig >> "units"); + + _list append [_addon, _addonList]; +} forEach call (uiNamespace getVariable QEGVAR(common,addons)); true diff --git a/addons/ui/test_preload.sqf b/addons/ui/test_preload.sqf index 03aa62401..4c9628a7e 100644 --- a/addons/ui/test_preload.sqf +++ b/addons/ui/test_preload.sqf @@ -24,17 +24,12 @@ isNil { if (isNull _curator) then { _curator = createGroup sideLogic createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"]; - _curator spawn { - private _group = group _this; - deleteVehicle _this; - deleteGroup _group; - }; - _unit assignCurator _curator; - _curator removeCuratorAddons call EGVAR(common,addons); - _curator addCuratorAddons call EGVAR(common,addons); }; + _curator removeCuratorAddons call EGVAR(common,addons); + _curator addCuratorAddons call EGVAR(common,addons); + missionNamespace setVariable ["RscAttrbuteInventory_weaponAddons", nil]; ["onLoad", [displayNull], objNull] call compile preprocessFile "\a3\ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf"; _vanilla = RscAttributeInventory_list; From 36a72eb2612f84080cf59f55a655254b5d61a04e Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 22:16:44 +0100 Subject: [PATCH 06/16] preload curator ammo box item list --- addons/ui/XEH_preStart.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index 7bb7d6c44..1fc8d20d7 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -11,11 +11,11 @@ if (hasInterface) then { PREP(preload3DEN); PREP(preloadCurator); - _timeStart = diag_tickTime; + private _timeStart = diag_tickTime; call FUNC(preload3DEN); INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); - private _timeStart = diag_tickTime; + _timeStart = diag_tickTime; call FUNC(preloadCurator); INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); }; From a2d90dc79b97a9a0be5525a99da1b91dcaecb28b Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 22:43:15 +0100 Subject: [PATCH 07/16] preload curator ammo box item list --- addons/ui/fnc_preloadCurator.sqf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 3d38d2772..4d5a0e0cd 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -144,19 +144,19 @@ private _magazines = []; { private _item = toLower _x; - private _itemType = _item call BIS_fnc_itemType select 1; + private _weaponConfig = _cfgVehicles >> _item; - private _index = -1; - { - if (_itemType in _x) exitWith { - _index = _forEachIndex; - }; - } forEach _types; + if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { + private _itemType = _item call BIS_fnc_itemType select 1; - if (_index >= 0) then { - private _weaponConfig = _cfgVehicles >> _item; + private _index = -1; + { + if (_itemType in _x) exitWith { + _index = _forEachIndex; + }; + } forEach _types; - if (getNumber (_weaponConfig >> "scope") == 2) then { + if (_index >= 0) then { private _displayName = getText (_weaponConfig >> "displayName"); (_addonList select _index) pushBack [ From c24de1efd4f0a887d13915648880d6a63262515b Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 26 Feb 2019 22:46:11 +0100 Subject: [PATCH 08/16] preload curator ammo box item list --- addons/ui/fnc_preload3DEN.sqf | 2 +- addons/ui/fnc_preloadCurator.sqf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 271464b26..24b7f7be0 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -99,7 +99,7 @@ private _magazines = []; }; { - private _item = tolower _x; + private _item = toLower _x; if ({_x select 1 == _item} count _listItem == 0) then { private _magazineConfig = _cfgMagazines >> _item; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 4d5a0e0cd..42a761d81 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -56,12 +56,12 @@ private _magazines = []; { private _patchConfig = _cfgPatches >> _x; - _addon = tolower _x; + _addon = toLower _x; private _addonList = [[],[],[],[],[],[],[],[],[],[],[],[]]; { - private _item = tolower _x; + private _item = toLower _x; (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; private _index = -1; @@ -116,7 +116,7 @@ private _magazines = []; }; { - private _item = tolower _x; + private _item = toLower _x; if ({_x select 0 == _item} count _listItem == 0) then { private _magazineConfig = _cfgMagazines >> _item; From e1e879d6c2d952a87d6963e04b1d3db895959b1a Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 27 Feb 2019 19:57:22 +0100 Subject: [PATCH 09/16] optimize --- addons/ui/XEH_preStart.sqf | 12 +++---- addons/ui/fnc_preload3DEN.sqf | 55 +++++++++++++++++--------------- addons/ui/fnc_preloadCurator.sqf | 55 +++++++++++++++++--------------- 3 files changed, 64 insertions(+), 58 deletions(-) diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index 1fc8d20d7..b1d46ac6d 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -1,12 +1,12 @@ #include "script_component.hpp" -PREP(initDisplayInterrupt); -PREP(initDisplayMultiplayerSetup); -PREP(initDisplayOptionsLayout); -PREP(initDisplayPassword); -PREP(initDisplayRemoteMissions); - if (hasInterface) then { + PREP(initDisplayInterrupt); + PREP(initDisplayMultiplayerSetup); + PREP(initDisplayOptionsLayout); + PREP(initDisplayPassword); + PREP(initDisplayRemoteMissions); + // preload 3den and curator item lists PREP(preload3DEN); PREP(preloadCurator); diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 24b7f7be0..b9b7f541c 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -31,19 +31,34 @@ if (!isNil {uiNamespace getVariable "AmmoBox_list"}) exitWith { private _list = [[],[],[],[],[],[],[],[],[],[],[],[]]; uiNamespace setVariable ["AmmoBox_list", _list]; +private _itemTypes = [ + "AssaultRifle","Shotgun","Rifle","SubmachineGun", + "MachineGun", + "SniperRifle", + "Launcher","MissileLauncher","RocketLauncher", + "Handgun", + "UnknownWeapon", + "AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod", + "Uniform", + "Vest", + "Backpack", + "Headgear","Glasses", + "Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal" +]; + private _types = [ - ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], - ["MachineGun"], - ["SniperRifle"], - ["Launcher","MissileLauncher","RocketLauncher"], - ["Handgun"], - ["UnknownWeapon"], - ["AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod"], - ["Uniform"], - ["Vest"], - ["Backpack"], - ["Headgear","Glasses"], - ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] + 0,0,0,0, + 1, + 2, + 3,3,3, + 4, + 5, + 6,6,6,6, + 7, + 8, + 9, + 10,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11 ]; //--- Weapons, Magazines and Items @@ -56,13 +71,7 @@ private _magazines = []; private _item = toLower configName _x; (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; - private _index = -1; - { - if (_itemType in _x) exitWith { - _index = _forEachIndex; - }; - } forEach _types; - + private _index = _types param [_itemTypes find _itemType, -1]; if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { private _weaponConfig = _x; private _isPublic = getNumber (_weaponConfig >> "scope") == 2; @@ -128,13 +137,7 @@ private _magazines = []; private _item = toLower configName _x; private _itemType = _item call BIS_fnc_itemType select 1; - private _index = -1; - { - if (_itemType in _x) exitWith { - _index = _forEachIndex; - }; - } forEach _types; - + private _index = _types param [_itemTypes find _itemType, -1]; if (_index >= 0) then { (_list select _index) pushBack [ getText (_x >> "displayName"), diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 42a761d81..eb707b2ac 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -31,19 +31,34 @@ if (!isNil {uiNamespace getVariable QGVAR(curatorItemCache)}) exitWith { private _list = []; uiNamespace setVariable [QGVAR(curatorItemCache), _list]; +private _itemTypes = [ + "AssaultRifle","Shotgun","Rifle","SubmachineGun", + "MachineGun", + "SniperRifle", + "Launcher","MissileLauncher","RocketLauncher", + "Handgun", + "UnknownWeapon", + "AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod", + "Uniform", + "Vest", + "Backpack", + "Headgear","Glasses", + "Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal" +]; + private _types = [ - ["AssaultRifle","Shotgun","Rifle","SubmachineGun"], - ["MachineGun"], - ["SniperRifle"], - ["Launcher","MissileLauncher","RocketLauncher"], - ["Handgun"], - ["UnknownWeapon"], - ["AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod"], - ["Uniform"], - ["Vest"], - ["Backpack"], - ["Headgear","Glasses"], - ["Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal"] + 0,0,0,0, + 1, + 2, + 3,3,3, + 4, + 5, + 6,6,6,6, + 7, + 8, + 9, + 10,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11 ]; //--- Weapons, Magazines and Items @@ -64,13 +79,7 @@ private _magazines = []; private _item = toLower _x; (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; - private _index = -1; - { - if (_itemType in _x) exitWith { - _index = _forEachIndex; - }; - } forEach _types; - + private _index = _types param [_itemTypes find _itemType, -1]; if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { private _weaponConfig = _cfgWeapons >> _item; private _isPublic = getNumber (_weaponConfig >> "scope") == 2; @@ -149,13 +158,7 @@ private _magazines = []; if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { private _itemType = _item call BIS_fnc_itemType select 1; - private _index = -1; - { - if (_itemType in _x) exitWith { - _index = _forEachIndex; - }; - } forEach _types; - + private _index = _types param [_itemTypes find _itemType, -1]; if (_index >= 0) then { private _displayName = getText (_weaponConfig >> "displayName"); From b5ca7a76907df88664a6d7480834d1fabf655db5 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 07:28:05 +0100 Subject: [PATCH 10/16] prevent an indent --- addons/ui/XEH_preStart.sqf | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index b1d46ac6d..a8c2c0435 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -1,21 +1,21 @@ #include "script_component.hpp" -if (hasInterface) then { - PREP(initDisplayInterrupt); - PREP(initDisplayMultiplayerSetup); - PREP(initDisplayOptionsLayout); - PREP(initDisplayPassword); - PREP(initDisplayRemoteMissions); +if (!hasInterface) exitWith {}; - // preload 3den and curator item lists - PREP(preload3DEN); - PREP(preloadCurator); +PREP(initDisplayInterrupt); +PREP(initDisplayMultiplayerSetup); +PREP(initDisplayOptionsLayout); +PREP(initDisplayPassword); +PREP(initDisplayRemoteMissions); - private _timeStart = diag_tickTime; - call FUNC(preload3DEN); - INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); +// preload 3den and curator item lists +PREP(preload3DEN); +PREP(preloadCurator); - _timeStart = diag_tickTime; - call FUNC(preloadCurator); - INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); -}; +private _timeStart = diag_tickTime; +call FUNC(preload3DEN); +INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); + +_timeStart = diag_tickTime; +call FUNC(preloadCurator); +INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); From 4a042287782ac011c2673ff59959fdf2616968df Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 13:48:41 +0100 Subject: [PATCH 11/16] move preload functions away from preStart --- addons/ui/CfgEventHandlers.hpp | 6 +++ addons/ui/XEH_preInit.sqf | 2 - addons/ui/XEH_preStart.sqf | 11 +---- addons/ui/fnc_initDisplay3DEN.sqf | 9 ++++ addons/ui/fnc_initDisplayCurator.sqf | 11 +++++ addons/ui/fnc_preload3DEN.sqf | 67 +++++++++++++++------------- addons/ui/fnc_preloadCurator.sqf | 67 +++++++++++++++------------- 7 files changed, 100 insertions(+), 73 deletions(-) create mode 100644 addons/ui/fnc_initDisplay3DEN.sqf create mode 100644 addons/ui/fnc_initDisplayCurator.sqf diff --git a/addons/ui/CfgEventHandlers.hpp b/addons/ui/CfgEventHandlers.hpp index b9df43f07..9b8ec74bd 100644 --- a/addons/ui/CfgEventHandlers.hpp +++ b/addons/ui/CfgEventHandlers.hpp @@ -29,4 +29,10 @@ class Extended_DisplayLoad_EventHandlers { class RscDisplayRemoteMissions { ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayRemoteMissions)')); }; + class Display3DEN { + ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplay3DEN)')); + }; + class RscDisplayCurator { + ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayCurator)')); + }; }; diff --git a/addons/ui/XEH_preInit.sqf b/addons/ui/XEH_preInit.sqf index d9a2258a4..b2b0c6be3 100644 --- a/addons/ui/XEH_preInit.sqf +++ b/addons/ui/XEH_preInit.sqf @@ -29,6 +29,4 @@ if (hasInterface) then { QGVAR(ProgressBar) cutRsc [QGVAR(ProgressBar), "PLAIN"]; }; }]; - - RscAttrbuteInventory_weaponAddons = uiNamespace getVariable QGVAR(curatorItemCache); // spelling is "Attrbute" }; diff --git a/addons/ui/XEH_preStart.sqf b/addons/ui/XEH_preStart.sqf index a8c2c0435..572bd302c 100644 --- a/addons/ui/XEH_preStart.sqf +++ b/addons/ui/XEH_preStart.sqf @@ -7,15 +7,8 @@ PREP(initDisplayMultiplayerSetup); PREP(initDisplayOptionsLayout); PREP(initDisplayPassword); PREP(initDisplayRemoteMissions); +PREP(initDisplay3DEN); +PREP(initDisplayCurator); -// preload 3den and curator item lists PREP(preload3DEN); PREP(preloadCurator); - -private _timeStart = diag_tickTime; -call FUNC(preload3DEN); -INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); - -_timeStart = diag_tickTime; -call FUNC(preloadCurator); -INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); diff --git a/addons/ui/fnc_initDisplay3DEN.sqf b/addons/ui/fnc_initDisplay3DEN.sqf new file mode 100644 index 000000000..87a1f1fe7 --- /dev/null +++ b/addons/ui/fnc_initDisplay3DEN.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +params ["_display"]; + +with uiNamespace do { + private _timeStart = diag_tickTime; + call FUNC(preload3DEN); + INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); +}; diff --git a/addons/ui/fnc_initDisplayCurator.sqf b/addons/ui/fnc_initDisplayCurator.sqf new file mode 100644 index 000000000..2834bd108 --- /dev/null +++ b/addons/ui/fnc_initDisplayCurator.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +params ["_display"]; + +with uiNamespace do { + private _timeStart = diag_tickTime; + call FUNC(preloadCurator); + INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); +}; + +RscAttrbuteInventory_weaponAddons = uiNamespace getVariable QGVAR(curatorItemCache); // spelling is "Attrbute" diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index b9b7f541c..861c73c09 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -31,35 +31,40 @@ if (!isNil {uiNamespace getVariable "AmmoBox_list"}) exitWith { private _list = [[],[],[],[],[],[],[],[],[],[],[],[]]; uiNamespace setVariable ["AmmoBox_list", _list]; -private _itemTypes = [ - "AssaultRifle","Shotgun","Rifle","SubmachineGun", - "MachineGun", - "SniperRifle", - "Launcher","MissileLauncher","RocketLauncher", - "Handgun", - "UnknownWeapon", - "AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod", - "Uniform", - "Vest", - "Backpack", - "Headgear","Glasses", - "Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal" -]; - -private _types = [ - 0,0,0,0, - 1, - 2, - 3,3,3, - 4, - 5, - 6,6,6,6, - 7, - 8, - 9, - 10,10, - 11,11,11,11,11,11,11,11,11,11,11,11,11 -]; +private _itemTypes = call CBA_fnc_createNamespace; +_itemTypes setVariable ["AssaultRifle", 0]; +_itemTypes setVariable ["Shotgun", 0]; +_itemTypes setVariable ["Rifle", 0]; +_itemTypes setVariable ["SubmachineGun", 0]; +_itemTypes setVariable ["MachineGun", 1]; +_itemTypes setVariable ["SniperRifle", 2]; +_itemTypes setVariable ["Launcher", 3]; +_itemTypes setVariable ["MissileLauncher", 3]; +_itemTypes setVariable ["RocketLauncher", 3]; +_itemTypes setVariable ["Handgun", 4]; +_itemTypes setVariable ["UnknownWeapon", 5]; +_itemTypes setVariable ["AccessoryMuzzle", 6]; +_itemTypes setVariable ["AccessoryPointer", 6]; +_itemTypes setVariable ["AccessorySights", 6]; +_itemTypes setVariable ["AccessoryBipod", 6]; +_itemTypes setVariable ["Uniform", 7]; +_itemTypes setVariable ["Vest", 8]; +_itemTypes setVariable ["Backpack", 9]; +_itemTypes setVariable ["Headgear", 10]; +_itemTypes setVariable ["Glasses", 10]; +_itemTypes setVariable ["Binocular", 11]; +_itemTypes setVariable ["Compass", 11]; +_itemTypes setVariable ["FirstAidKit", 11]; +_itemTypes setVariable ["GPS", 11]; +_itemTypes setVariable ["LaserDesignator", 11]; +_itemTypes setVariable ["Map", 11]; +_itemTypes setVariable ["Medikit", 11]; +_itemTypes setVariable ["MineDetector", 11]; +_itemTypes setVariable ["NVGoggles", 11]; +_itemTypes setVariable ["Radio", 11]; +_itemTypes setVariable ["Toolkit", 11]; +_itemTypes setVariable ["Watch", 11]; +_itemTypes setVariable ["UAVTerminal", 11]; //--- Weapons, Magazines and Items private _cfgWeapons = configFile >> "CfgWeapons"; @@ -71,7 +76,7 @@ private _magazines = []; private _item = toLower configName _x; (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; - private _index = _types param [_itemTypes find _itemType, -1]; + private _index = _itemTypes getVariable [_itemType, -1]; if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { private _weaponConfig = _x; private _isPublic = getNumber (_weaponConfig >> "scope") == 2; @@ -137,7 +142,7 @@ private _magazines = []; private _item = toLower configName _x; private _itemType = _item call BIS_fnc_itemType select 1; - private _index = _types param [_itemTypes find _itemType, -1]; + private _index = _itemTypes getVariable [_itemType, -1]; if (_index >= 0) then { (_list select _index) pushBack [ getText (_x >> "displayName"), diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index eb707b2ac..b20df8fee 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -31,35 +31,40 @@ if (!isNil {uiNamespace getVariable QGVAR(curatorItemCache)}) exitWith { private _list = []; uiNamespace setVariable [QGVAR(curatorItemCache), _list]; -private _itemTypes = [ - "AssaultRifle","Shotgun","Rifle","SubmachineGun", - "MachineGun", - "SniperRifle", - "Launcher","MissileLauncher","RocketLauncher", - "Handgun", - "UnknownWeapon", - "AccessoryMuzzle","AccessoryPointer","AccessorySights","AccessoryBipod", - "Uniform", - "Vest", - "Backpack", - "Headgear","Glasses", - "Binocular","Compass","FirstAidKit","GPS","LaserDesignator","Map","Medikit","MineDetector","NVGoggles","Radio","Toolkit","Watch","UAVTerminal" -]; - -private _types = [ - 0,0,0,0, - 1, - 2, - 3,3,3, - 4, - 5, - 6,6,6,6, - 7, - 8, - 9, - 10,10, - 11,11,11,11,11,11,11,11,11,11,11,11,11 -]; +private _itemTypes = call CBA_fnc_createNamespace; +_itemTypes setVariable ["AssaultRifle", 0]; +_itemTypes setVariable ["Shotgun", 0]; +_itemTypes setVariable ["Rifle", 0]; +_itemTypes setVariable ["SubmachineGun", 0]; +_itemTypes setVariable ["MachineGun", 1]; +_itemTypes setVariable ["SniperRifle", 2]; +_itemTypes setVariable ["Launcher", 3]; +_itemTypes setVariable ["MissileLauncher", 3]; +_itemTypes setVariable ["RocketLauncher", 3]; +_itemTypes setVariable ["Handgun", 4]; +_itemTypes setVariable ["UnknownWeapon", 5]; +_itemTypes setVariable ["AccessoryMuzzle", 6]; +_itemTypes setVariable ["AccessoryPointer", 6]; +_itemTypes setVariable ["AccessorySights", 6]; +_itemTypes setVariable ["AccessoryBipod", 6]; +_itemTypes setVariable ["Uniform", 7]; +_itemTypes setVariable ["Vest", 8]; +_itemTypes setVariable ["Backpack", 9]; +_itemTypes setVariable ["Headgear", 10]; +_itemTypes setVariable ["Glasses", 10]; +_itemTypes setVariable ["Binocular", 11]; +_itemTypes setVariable ["Compass", 11]; +_itemTypes setVariable ["FirstAidKit", 11]; +_itemTypes setVariable ["GPS", 11]; +_itemTypes setVariable ["LaserDesignator", 11]; +_itemTypes setVariable ["Map", 11]; +_itemTypes setVariable ["Medikit", 11]; +_itemTypes setVariable ["MineDetector", 11]; +_itemTypes setVariable ["NVGoggles", 11]; +_itemTypes setVariable ["Radio", 11]; +_itemTypes setVariable ["Toolkit", 11]; +_itemTypes setVariable ["Watch", 11]; +_itemTypes setVariable ["UAVTerminal", 11]; //--- Weapons, Magazines and Items private _cfgPatches = configFile >> "CfgPatches"; @@ -79,7 +84,7 @@ private _magazines = []; private _item = toLower _x; (_item call BIS_fnc_itemType) params ["_itemCategory", "_itemType"]; - private _index = _types param [_itemTypes find _itemType, -1]; + private _index = _itemTypes getVariable [_itemType, -1]; if (_index >= 0 && {_itemCategory != "VehicleWeapon"}) then { private _weaponConfig = _cfgWeapons >> _item; private _isPublic = getNumber (_weaponConfig >> "scope") == 2; @@ -158,7 +163,7 @@ private _magazines = []; if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { private _itemType = _item call BIS_fnc_itemType select 1; - private _index = _types param [_itemTypes find _itemType, -1]; + private _index = _itemTypes getVariable [_itemType, -1]; if (_index >= 0) then { private _displayName = getText (_weaponConfig >> "displayName"); From 79ddfe849ac99d56bc623dcf87ce12f6799fa680 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 13:53:44 +0100 Subject: [PATCH 12/16] log --- addons/ui/fnc_initDisplay3DEN.sqf | 5 +++-- addons/ui/fnc_initDisplayCurator.sqf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/ui/fnc_initDisplay3DEN.sqf b/addons/ui/fnc_initDisplay3DEN.sqf index 87a1f1fe7..0a227520b 100644 --- a/addons/ui/fnc_initDisplay3DEN.sqf +++ b/addons/ui/fnc_initDisplay3DEN.sqf @@ -4,6 +4,7 @@ params ["_display"]; with uiNamespace do { private _timeStart = diag_tickTime; - call FUNC(preload3DEN); - INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); + if (call FUNC(preload3DEN)) then { + INFO_1("3DEN item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); + }; }; diff --git a/addons/ui/fnc_initDisplayCurator.sqf b/addons/ui/fnc_initDisplayCurator.sqf index 2834bd108..56cb94175 100644 --- a/addons/ui/fnc_initDisplayCurator.sqf +++ b/addons/ui/fnc_initDisplayCurator.sqf @@ -4,8 +4,9 @@ params ["_display"]; with uiNamespace do { private _timeStart = diag_tickTime; - call FUNC(preloadCurator); - INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); + if (call FUNC(preloadCurator)) then { + INFO_1("Curator item list preloaded. Time: %1 ms",round ((diag_tickTime - _timeStart) * 1000)); + }; }; RscAttrbuteInventory_weaponAddons = uiNamespace getVariable QGVAR(curatorItemCache); // spelling is "Attrbute" From a1281bbd56712235d3b813886ad5187f4cc0c404 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 20:29:50 +0100 Subject: [PATCH 13/16] optimize bigly --- addons/ui/fnc_preload3DEN.sqf | 10 +++++++++- addons/ui/fnc_preloadCurator.sqf | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 861c73c09..0a4a1ae94 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -71,6 +71,7 @@ private _cfgWeapons = configFile >> "CfgWeapons"; private _cfgMagazines = configFile >> "CfgMagazines"; private _magazines = []; +private _magazinesLists = []; { private _item = toLower configName _x; @@ -115,7 +116,7 @@ private _magazines = []; { private _item = toLower _x; - if ({_x select 1 == _item} count _listItem == 0) then { + if (_magazinesLists pushBackUnique [_item, _listItem] != -1) then { private _magazineConfig = _cfgMagazines >> _item; if (getNumber (_magazineConfig >> "scope") == 2) then { @@ -138,7 +139,14 @@ private _magazines = []; //--- Backpacks { +// In case you are executing the unit test with addons loaded, should an addon +// use the same classname in CfgVehicles and CfgWeapons this isBackpack +// optimization prevents the item from added by twice. +#ifdef DEBUG_MODE_FULL + if (getNumber (_x >> "scope") == 2) then { +#else if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) then { +#endif private _item = toLower configName _x; private _itemType = _item call BIS_fnc_itemType select 1; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index b20df8fee..94467a7f0 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -73,6 +73,7 @@ private _cfgWeapons = configFile >> "CfgWeapons"; private _cfgMagazines = configFile >> "CfgMagazines"; private _magazines = []; +private _magazinesLists = []; { private _patchConfig = _cfgPatches >> _x; @@ -132,7 +133,7 @@ private _magazines = []; { private _item = toLower _x; - if ({_x select 0 == _item} count _listItem == 0) then { + if (_magazinesLists pushBackUnique [_item, _listItem] != -1) then { private _magazineConfig = _cfgMagazines >> _item; if (getNumber (_magazineConfig >> "scope") == 2) then { @@ -160,7 +161,14 @@ private _magazines = []; private _item = toLower _x; private _weaponConfig = _cfgVehicles >> _item; +// In case you are executing the unit test with addons loaded, should an addon +// use the same classname in CfgVehicles and CfgWeapons this isBackpack +// optimization prevents the item from added by twice. +#ifdef DEBUG_MODE_FULL + if (getNumber (_weaponConfig >> "scope") == 2) then { +#else if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { +#endif private _itemType = _item call BIS_fnc_itemType select 1; private _index = _itemTypes getVariable [_itemType, -1]; From 51a1ba75426645152ab555858c27194a4f12e58c Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 20:35:28 +0100 Subject: [PATCH 14/16] travis --- addons/ui/fnc_preload3DEN.sqf | 2 +- addons/ui/fnc_preloadCurator.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 0a4a1ae94..8e13bb74f 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -145,7 +145,7 @@ private _magazinesLists = []; #ifdef DEBUG_MODE_FULL if (getNumber (_x >> "scope") == 2) then { #else - if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) then { + if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) then { //} #endif private _item = toLower configName _x; private _itemType = _item call BIS_fnc_itemType select 1; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 94467a7f0..e706a998a 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -167,7 +167,7 @@ private _magazinesLists = []; #ifdef DEBUG_MODE_FULL if (getNumber (_weaponConfig >> "scope") == 2) then { #else - if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { + if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { //} #endif private _itemType = _item call BIS_fnc_itemType select 1; From e0f11315a1def217eb3e6f074890cf1939e7f89b Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 20:39:31 +0100 Subject: [PATCH 15/16] travis --- addons/ui/fnc_preload3DEN.sqf | 5 +++-- addons/ui/fnc_preloadCurator.sqf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 8e13bb74f..65a2e9dfa 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -143,10 +143,11 @@ private _magazinesLists = []; // use the same classname in CfgVehicles and CfgWeapons this isBackpack // optimization prevents the item from added by twice. #ifdef DEBUG_MODE_FULL - if (getNumber (_x >> "scope") == 2) then { + if (getNumber (_x >> "scope") == 2) #else - if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) then { //} + if (getNumber (_x >> "isBackpack") == 1 && {getNumber (_x >> "scope") == 2}) #endif + then { private _item = toLower configName _x; private _itemType = _item call BIS_fnc_itemType select 1; diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index e706a998a..2299bbb08 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -165,10 +165,11 @@ private _magazinesLists = []; // use the same classname in CfgVehicles and CfgWeapons this isBackpack // optimization prevents the item from added by twice. #ifdef DEBUG_MODE_FULL - if (getNumber (_weaponConfig >> "scope") == 2) then { + if (getNumber (_weaponConfig >> "scope") == 2) #else - if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) then { //} + if (getNumber (_weaponConfig >> "isBackpack") == 1 && {getNumber (_weaponConfig >> "scope") == 2}) #endif + then { private _itemType = _item call BIS_fnc_itemType select 1; private _index = _itemTypes getVariable [_itemType, -1]; From b9d5a8667c655ec9baa688feffe1f2142ddbe16e Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 1 Mar 2019 23:13:01 +0100 Subject: [PATCH 16/16] delete namespaces after use --- addons/ui/fnc_preload3DEN.sqf | 2 ++ addons/ui/fnc_preloadCurator.sqf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/addons/ui/fnc_preload3DEN.sqf b/addons/ui/fnc_preload3DEN.sqf index 65a2e9dfa..5f3c228f2 100644 --- a/addons/ui/fnc_preload3DEN.sqf +++ b/addons/ui/fnc_preload3DEN.sqf @@ -183,4 +183,6 @@ private _listHeadgear = _list select 10; _x sort true; } forEach _list; +_itemTypes call CBA_fnc_deleteNamespace; + true diff --git a/addons/ui/fnc_preloadCurator.sqf b/addons/ui/fnc_preloadCurator.sqf index 2299bbb08..773e54f76 100644 --- a/addons/ui/fnc_preloadCurator.sqf +++ b/addons/ui/fnc_preloadCurator.sqf @@ -191,4 +191,6 @@ private _magazinesLists = []; _list append [_addon, _addonList]; } forEach call (uiNamespace getVariable QEGVAR(common,addons)); +_itemTypes call CBA_fnc_deleteNamespace; + true