From 03b4cfd6f4718c699c30bfc618ef903c7fbf15ff Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Sun, 8 May 2022 11:36:33 +0200 Subject: [PATCH 1/3] Add: copy and paste inventory --- .../core/def/param.hpp | 2 +- .../core/fnc/compile.sqf | 6 ++- .../core/fnc/int/add_actions.sqf | 30 ++++++++++---- .../core/fnc/log/inventoryCopy.sqf | 33 ++++++++++++++++ .../core/fnc/log/inventoryPaste.sqf | 39 +++++++++++++++++++ .../stringtable.xml | 12 ++++++ 6 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf create mode 100644 =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp index fe7a43a9e..ce0554c03 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp @@ -459,6 +459,6 @@ class Params { title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_OTHER_DEBUG"]); values[]={0,1,2}; texts[]={$STR_DISABLED,$STR_ENABLED, $STR_BTC_HAM_PARAM_OTHER_DEBUG_LOGONLY}; // texts[]={"Off","On","Log only"}; - default = 0; + default = 1; }; }; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf index 19acdbe8f..3f0098c87 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf @@ -200,11 +200,9 @@ if (isServer) then { //LOG btc_log_fnc_createVehicle = compileScript ["core\fnc\log\createVehicle.sqf"]; btc_log_fnc_init = compileScript ["core\fnc\log\init.sqf"]; - btc_log_fnc_inventorySet = compileScript ["core\fnc\log\inventorySet.sqf"]; btc_log_fnc_server_delete = compileScript ["core\fnc\log\server_delete.sqf"]; btc_log_fnc_create_s = compileScript ["core\fnc\log\create_s.sqf"]; btc_log_fnc_server_repair_wreck = compileScript ["core\fnc\log\server_repair_wreck.sqf"]; - btc_log_fnc_inventoryGet = compileScript ["core\fnc\log\inventoryGet.sqf"]; //DEAF btc_deaf_fnc_earringing = compileScript ["core\fnc\deaf\earringing.sqf"]; @@ -269,6 +267,8 @@ btc_int_fnc_ask_var = compileScript ["core\fnc\int\ask_var.sqf"]; //LOG btc_log_fnc_place_destroy_camera = compileScript ["core\fnc\log\place_destroy_camera.sqf"]; +btc_log_fnc_inventoryGet = compileScript ["core\fnc\log\inventoryGet.sqf"]; +btc_log_fnc_inventorySet = compileScript ["core\fnc\log\inventorySet.sqf"]; //MIL btc_mil_fnc_class = compileScript ["core\fnc\mil\class.sqf"]; @@ -389,6 +389,8 @@ if (!isDedicated) then { btc_log_fnc_paste = compileScript ["core\fnc\log\paste.sqf"]; btc_log_fnc_refuelSource = compileScript ["core\fnc\log\refuelSource.sqf"]; btc_log_fnc_rearmSource = compileScript ["core\fnc\log\rearmSource.sqf"]; + btc_log_fnc_inventoryCopy = compileScript ["core\fnc\log\inventoryCopy.sqf"]; + btc_log_fnc_inventoryPaste = compileScript ["core\fnc\log\inventoryPaste.sqf"]; //REP btc_rep_fnc_treatment = compileScript ["core\fnc\rep\treatment.sqf"]; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/add_actions.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/add_actions.sqf index a6fa61e68..746b5dcd9 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/add_actions.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/add_actions.sqf @@ -45,6 +45,7 @@ _action = ["Search_intel", localize "STR_A3_Showcase_Marksman_BIS_tskIntel_title { _x params ["_object", "_helipad"]; + //Logistic _action = ["Logistic", localize "STR_BTC_HAM_ACTION_LOC_MAIN", "\A3\ui_f\data\igui\cfg\simpleTasks\letters\L_ca.paa", {}, {true}] call ace_interact_menu_fnc_createAction; [_object, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject; _action = ["Require_object", localize "STR_BTC_HAM_ACTION_LOGPOINT_REQOBJ", "\A3\ui_f\data\igui\cfg\simpleTasks\letters\D_ca.paa", { @@ -69,25 +70,40 @@ _action = ["Search_intel", localize "STR_A3_Showcase_Marksman_BIS_tskIntel_title [_object, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToObject; _action = ["Require_veh", localize "STR_BTC_HAM_ACTION_LOGPOINT_REQVEH", "\A3\ui_f\data\map\vehicleicons\iconCar_ca.paa", { params ["", "", "_params"]; - _params spawn btc_arsenal_fnc_garage}, {(serverCommandAvailable "#logout" || !isMultiplayer) and btc_p_garage}, {}, [_helipad], [0, 0, 0], 5] call ace_interact_menu_fnc_createAction; + _params spawn btc_arsenal_fnc_garage + }, {(serverCommandAvailable "#logout" || !isMultiplayer) and btc_p_garage}, {}, [_helipad], [0, 0, 0], 5] call ace_interact_menu_fnc_createAction; [_object, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToObject; + _action = ["Require_delete", localize "STR_3DEN_Delete", "\z\ace\addons\arsenal\data\iconClearContainer.paa", { + params ["", "", "_params"]; + _params call btc_log_fnc_delete + }, {true}, {}, [_helipad], [0, 0, 0.4], 5] call ace_interact_menu_fnc_createAction; + [_object, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToObject; + + //Tool _action = ["Tool", localize "str_3den_display3den_menubar_tools_text", "\A3\ui_f\data\igui\cfg\simpleTasks\letters\T_ca.paa", {}, {true}] call ace_interact_menu_fnc_createAction; [_object, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject; - _action = ["Copy", localize "STR_BTC_HAM_ACTION_COPYPASTE_COPY", "\A3\ui_f\data\igui\cfg\simpleTasks\types\download_ca.paa", { + _action = ["Copy_container", localize "STR_BTC_HAM_ACTION_COPYPASTE_COPY", "\A3\ui_f\data\igui\cfg\simpleTasks\types\download_ca.paa", { params ["", "", "_params"]; _params call btc_log_fnc_copy }, {true}, {}, [_helipad], [0, 0, 0.4], 5] call ace_interact_menu_fnc_createAction; [_object, 0, ["ACE_MainActions", "Tool"], _action] call ace_interact_menu_fnc_addActionToObject; - _action = ["Paste", localize "STR_BTC_HAM_ACTION_COPYPASTE_PASTE", "\A3\ui_f\data\igui\cfg\simpleTasks\types\upload_ca.paa", { + _action = ["Paste_container", localize "STR_BTC_HAM_ACTION_COPYPASTE_PASTE", "\A3\ui_f\data\igui\cfg\simpleTasks\types\upload_ca.paa", { params ["", "", "_params"]; [btc_copy_container, _params] call btc_log_fnc_paste }, {!isNil "btc_copy_container"}, {}, _helipad, [0, 0, 0.4], 5] call ace_interact_menu_fnc_createAction; [_object, 0, ["ACE_MainActions", "Tool"], _action] call ace_interact_menu_fnc_addActionToObject; - _action = ["Require_delete", localize "STR_3DEN_Delete", "\z\ace\addons\arsenal\data\iconClearContainer.paa", { + _action = ["Copy_inventory", localize "STR_BTC_HAM_ACTION_COPYPASTE_COPYI", "\A3\ui_f\data\igui\cfg\simpleTasks\types\download_ca.paa", { params ["", "", "_params"]; - _params call btc_log_fnc_delete + _params call btc_log_fnc_inventoryCopy }, {true}, {}, [_helipad], [0, 0, 0.4], 5] call ace_interact_menu_fnc_createAction; - [_object, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToObject; + [_object, 0, ["ACE_MainActions", "Tool"], _action] call ace_interact_menu_fnc_addActionToObject; + _action = ["Paste_inventory", localize "STR_BTC_HAM_ACTION_COPYPASTE_PASTEI", "\A3\ui_f\data\igui\cfg\simpleTasks\types\upload_ca.paa", { + params ["", "", "_params"]; + [btc_copy_inventory, _params] call btc_log_fnc_inventoryPaste + }, {!isNil "btc_copy_inventory"}, {}, _helipad, [0, 0, 0.4], 5] call ace_interact_menu_fnc_createAction; + [_object, 0, ["ACE_MainActions", "Tool"], _action] call ace_interact_menu_fnc_addActionToObject; + + //Bodybag if (btc_p_respawn_ticketsAtStart isNotEqualTo -1) then { _action = ["Bodybag", localize "STR_BTC_HAM_ACTION_LOGPOINT_BODYBAG", "\A3\Data_F_AoW\Logos\arma3_aow_logo_ca.paa", { params ["", "", "_params"]; @@ -97,7 +113,7 @@ _action = ["Search_intel", localize "STR_A3_Showcase_Marksman_BIS_tskIntel_title }; } forEach [[btc_create_object, btc_create_object_point]]; -//Logistic +//Place _action = ["Logistic", localize "STR_BTC_HAM_ACTION_LOC_MAIN", "\A3\ui_f\data\igui\cfg\simpleTasks\letters\L_ca.paa", {}, {true}] call ace_interact_menu_fnc_createAction; {[_x, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToClass;} forEach btc_log_def_loadable; _action = ["Place", localize "STR_ACE_Dragging_Carry", "\z\ace\addons\dragging\UI\icons\box_carry.paa", {_target call btc_log_fnc_place}, {!btc_log_placing && !(player getVariable ["ace_dragging_isCarrying", false])}] call ace_interact_menu_fnc_createAction; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf new file mode 100644 index 000000000..5e94b03f6 --- /dev/null +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf @@ -0,0 +1,33 @@ + +/* ---------------------------------------------------------------------------- +Function: btc_log_fnc_inventoryCopy + +Description: + Fill me when you edit me ! + +Parameters: + _searchLocation - Object to search around. [Object] + +Returns: + +Examples: + (begin example) + _result = [] call btc_log_fnc_inventoryCopy; + (end) + +Author: + Vdauphin + +---------------------------------------------------------------------------- */ + +params [ + ["_searchLocation", objNull, [objNull]] +]; + +private _objects = nearestObjects [_searchLocation, ["allVehicles"], 3]; + +if (_objects isEqualTo []) exitWith {(localize "STR_BTC_HAM_O_COPY_NOOBJECTS") call CBA_fnc_notify}; + +btc_copy_inventory = [_objects select 0] call btc_log_fnc_inventoryGet; + +(localize "str_mission_completed") call CBA_fnc_notify; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf new file mode 100644 index 000000000..0eed6b198 --- /dev/null +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf @@ -0,0 +1,39 @@ + +/* ---------------------------------------------------------------------------- +Function: btc_log_fnc_inventoryPaste + +Description: + Fill me when you edit me ! + +Parameters: + _copy_container - [Array] + _searchLocation - Object to search around. [Object] + +Returns: + +Examples: + (begin example) + _result = [] call btc_log_fnc_inventoryPaste; + (end) + +Author: + Vdauphin + +---------------------------------------------------------------------------- */ + +params [ + ["_inventory", [], [[]]], + ["_searchLocation", objNull, [objNull]] +]; + +private _objects = nearestObjects [_searchLocation, ["allVehicles"], 3]; + +if ( + isNil "_inventory" || + {flatten _inventory isEqualTo []} +) exitWith {(localize "STR_BTC_HAM_O_PASTE_NOCOPIEDI") call CBA_fnc_notify}; +if (_objects isEqualTo []) exitWith {(localize "STR_BTC_HAM_O_COPY_NOOBJECTS") call CBA_fnc_notify}; + +[_objects select 0, _inventory] call btc_log_fnc_inventorySet; + +(localize "str_mission_completed") call CBA_fnc_notify; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml b/=BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml index c2d49e954..395a5e479 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml +++ b/=BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml @@ -2107,6 +2107,12 @@ Coller le conteneur Vložit kontejner + + Copy inventory + + + Paste inventory + @@ -2759,6 +2765,12 @@ Conteneur et cargaison copiés ! Nettoyez la zone avant de faire un coller. Kontejner a obsah zkopírovány! Vyčistěte oblast pro přidání nové. + + No copied inventory! + + + No objects around! + From ce766d987f6abe461fefe5bd47410c4e72a7030f Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Sun, 8 May 2022 13:10:54 +0200 Subject: [PATCH 2/3] FIX: full box --- .../core/fnc/log/inventoryCopy.sqf | 2 +- .../core/fnc/log/inventoryPaste.sqf | 2 +- .../core/fnc/log/inventorySet.sqf | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf index 5e94b03f6..d571dd586 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryCopy.sqf @@ -24,7 +24,7 @@ params [ ["_searchLocation", objNull, [objNull]] ]; -private _objects = nearestObjects [_searchLocation, ["allVehicles"], 3]; +private _objects = nearestObjects [_searchLocation, ["AllVehicles", "ThingX"], 3]; if (_objects isEqualTo []) exitWith {(localize "STR_BTC_HAM_O_COPY_NOOBJECTS") call CBA_fnc_notify}; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf index 0eed6b198..bae9e83d3 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventoryPaste.sqf @@ -26,7 +26,7 @@ params [ ["_searchLocation", objNull, [objNull]] ]; -private _objects = nearestObjects [_searchLocation, ["allVehicles"], 3]; +private _objects = nearestObjects [_searchLocation, ["AllVehicles", "ThingX"], 3]; if ( isNil "_inventory" || diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventorySet.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventorySet.sqf index 4155819d5..69e6e7796 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventorySet.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/inventorySet.sqf @@ -39,14 +39,17 @@ _inventory params [ ]; { + if (load _object > 1) exitWith {}; _object addMagazineCargoGlobal [_x, (_magazines select 1) select _forEachIndex]; } forEach (_magazines select 0); { + if (load _object > 1) exitWith {}; _object addWeaponWithAttachmentsCargoGlobal [_x, 1]; } forEach _weapons; { + if (load _object > 1) exitWith {}; private _containerType = _x select 0; if (_containerType in _items) then { _object addItemCargoGlobal [_containerType, 1]; @@ -60,5 +63,6 @@ _inventory params [ } forEach _everyContainer; { + if (load _object > 1) exitWith {}; _object addItemCargoGlobal [_x, 1]; } forEach _items; From 40fc9cafa60016e9cde1b348dbe540cbabd12e42 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Sat, 14 May 2022 01:52:35 +0200 Subject: [PATCH 3/3] Remove debug --- =BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp index ce0554c03..fe7a43a9e 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp @@ -459,6 +459,6 @@ class Params { title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_OTHER_DEBUG"]); values[]={0,1,2}; texts[]={$STR_DISABLED,$STR_ENABLED, $STR_BTC_HAM_PARAM_OTHER_DEBUG_LOGONLY}; // texts[]={"Off","On","Log only"}; - default = 1; + default = 0; }; };