From 21e9674ab786f36c5a2d4be75123551e6f96c887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20E=C4=9Fitmen?= Date: Thu, 21 Sep 2017 17:19:49 +0300 Subject: [PATCH] Add "Load Into Cargo" Zeus Module (#5528) * Initial commit * Finish TODOs * Remove "
" from showing up on zeus messages * Add check for scheduled environment, cargo enabled --- addons/cargo/UI/Icon_load.paa | Bin 5625 -> 0 bytes addons/cargo/functions/fnc_initObject.sqf | 2 +- addons/zeus/CfgVehicles.hpp | 15 ++-- addons/zeus/XEH_PREP.hpp | 1 + addons/zeus/config.cpp | 8 +++ .../functions/fnc_moduleLoadIntoCargo.sqf | 66 ++++++++++++++++++ .../functions/fnc_moduleSuppressiveFire.sqf | 11 ++- addons/zeus/stringtable.xml | 23 +++--- 8 files changed, 105 insertions(+), 21 deletions(-) delete mode 100644 addons/cargo/UI/Icon_load.paa create mode 100644 addons/zeus/functions/fnc_moduleLoadIntoCargo.sqf diff --git a/addons/cargo/UI/Icon_load.paa b/addons/cargo/UI/Icon_load.paa deleted file mode 100644 index ccd77761e46ba3d7c587dd2929f837e55a04870e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5625 zcmeHLe`p(Z6n~dombN5qn7uhn%c9%ODf7of+7$=6pr)-j3@q0MHl^(ZCp7UN9sXfi z>jwR&t}>_~tm+^Bs~cq;D3nEu`)3peicN{^A2%3m>mQSE0w zuZQtF8Ui@p3^1Vp{D$A^h6Wk{TDVW6R02?ZM9Un6lL?LCf9_n#m+shu5^f_ZfQNfM zs^{zG@5T@Ideok;o4*_1-}U(S`MUYL@x5J-TJhaJWu)^)`bB=;zd1!X_%`DW9fVtR zjQKaAdc3~%s1;v#{JXE5d+$;_bBXzI78%zkM_P0EVeFp2cD(v}+$~?}G0acf;7c5z ze;?&*@<+xJbf4JPeL`mZ+-{P8@-<`Ml|kb& zb&}7nD0l1IxO_cC9J;PM<)A1IY)0C9z&IE-`okR0=9|$%wy9wG_dxfj$bTElhjWJp zZvUCt&-j;HiQ9BdgM7L9@A|d-Myd42qbzU!{qdIE>2#j49iKUKEce~XnU0e)m2#n} z+4^|p=I6kyx6+xsNj^pIMSe1V*x%-xNZ!Gp=ZokhNqWMy9-Gb-#|wuuR{fM3X@AL&~S9>-hn zT8~F&gMoQ0VU}}zl~~Z%Y&l-xdN}zbwB)R})-&bL=d;((tTtWmeG`k{=*Rq#WkqSe z9xcoq!IH&6cl=k4AW#Y4L!5QkADhSIM+@go?>2vqmtvwpIFYdVn0Ko`N~&>iM&t|G zzpCq*52QZa&oF;z3!kS9z|!-N81rvqGorO)w1@e%=bQfa91ae$e@$6GKeSqtL2Q?+ ze>Tqbard~q{(0Vmdj6mP!;$|8L~#4DstAF#wb0EwVM_CAukm-9U#+~-AKkG>LomxWy}#(;??6}etuUQ>DfW{?Y4N!V%xyhHcy1@hhx#=&(Wfv zu_s)vzg^h#Jjrr9zVdkf{s|=$y1w%nZu3afQy(aDTRu09RS_Dw+Lb99c3XGq`jH!3 zq90jpyYI7+p!u^*`gL;r8qX(tT7r%=Na}9ObX_6;);6mupad32hjODuY%AxcL-?w3~^b0ZiI*=(@d6s&LD*4jH9 z+nlPZ?bbGD*5Aq)4W?45rj8M+7qLy^E?nUcwZw?vkvY)~HzsfBUL_d~r|$AtxK9aX zJVfy8oWnRoe+5b?G)DwaPBn5nq1Jnr#3%#kN%ajgj^G99WB0%G_G9V?$BlH@@LG?F ze<#-PmqqJsDIoMe#x$DtHd);@K!d70HI#kf+5JOk_4*Oj&wD@_<6ZpUR9yNQj^Mez#%*evUHPzM@-_ceNY`Y~*i zM&LMNbi-jb9z8ekep{cwUazD!oc&?XEDQ>q&1xwbe^GHgH@sz}XS?3X(zJIm0CW5U DND8iv diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index d59249c31b..5020f885b6 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -66,7 +66,7 @@ private _statement = { [_player, _target] call FUNC(startLoadIn); }; private _text = localize LSTRING(loadObject); -private _icon = QPATHTOF(UI\Icon_load.paa); +private _icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa"; private _action = [QGVAR(load), _text, _icon, _statement, _condition, {call FUNC(addCargoVehiclesActions)}] call EFUNC(interact_menu,createAction); if (_canLoadConfig) then { diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 9918764462..d123684648 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -98,14 +98,14 @@ class CfgVehicles { category = QGVAR(Repair); displayName = CSTRING(ModuleAddSpareTrack_DisplayName); function = QFUNC(moduleAddSpareTrack); - icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo + icon = "a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa"; }; class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(Repair); displayName = CSTRING(ModuleAddSpareWheel_DisplayName); function = QFUNC(moduleAddSpareWheel); - icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo + icon = "a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa"; }; class GVAR(moduleAddOrRemoveFRIES): GVAR(moduleBase) { curatorCanAttach = 1; @@ -143,6 +143,13 @@ class CfgVehicles { displayName = CSTRING(ModuleGroupSide_DisplayName); curatorInfoType = QGVAR(RscGroupSide); }; + class GVAR(moduleLoadIntoCargo): GVAR(moduleBase) { + curatorCanAttach = 1; + category = QGVAR(Utility); + displayName = CSTRING(ModuleLoadIntoCargo_DisplayName); + function = QFUNC(moduleLoadIntoCargo); + icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa"; + }; class GVAR(modulePatrolArea): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(AI); @@ -217,13 +224,13 @@ class CfgVehicles { class GVAR(AddFullArsenal): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(Utility); - displayName = CSTRING(moduleAddFullArsenal_displayName); + displayName = CSTRING(ModuleAddFullArsenal_DisplayName); function = QFUNC(moduleAddArsenal); }; class GVAR(RemoveFullArsenal): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(Utility); - displayName = CSTRING(moduleRemoveArsenal_displayName); + displayName = CSTRING(ModuleRemoveArsenal_DisplayName); function = QFUNC(moduleRemoveArsenal); }; }; diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index a3f269f638..263b5e60b9 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -13,6 +13,7 @@ PREP(moduleAddOrRemoveFRIES); PREP(moduleCaptive); PREP(moduleGlobalSetSkill); PREP(moduleGroupSide); +PREP(moduleLoadIntoCargo); PREP(moduleRemoveArsenal); PREP(moduleSearchNearby); PREP(moduleSetMedic); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index d81ac5c074..16a2e6a678 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -8,6 +8,7 @@ class CfgPatches { QGVAR(moduleEditableObjects), QGVAR(moduleGlobalSetSkill), QGVAR(moduleGroupSide), + QGVAR(moduleLoadIntoCargo), QGVAR(modulePatrolArea), QGVAR(moduleSearchArea), QGVAR(moduleSearchNearby), @@ -25,6 +26,7 @@ class CfgPatches { url = ECSTRING(main,URL); VERSION_CONFIG; }; + // Use additional CfgPatches to contextually remove modules from zeus class GVAR(captives): ADDON { units[] = { @@ -40,6 +42,11 @@ class CfgPatches { QGVAR(moduleSetMedicalFacility) }; }; + class GVAR(cargo): ADDON { + units[] = { + QGVAR(moduleLoadIntoCargo) + }; + }; class GVAR(cargoAndRepair): ADDON { units[] = { QGVAR(moduleAddSpareTrack), @@ -56,6 +63,7 @@ class CfgPatches { class ACE_Curator { GVAR(captives) = "ace_captives"; GVAR(medical) = "ace_medical"; + GVAR(cargo) = "ace_cargo"; GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"}; GVAR(fastroping) = "ace_fastroping"; }; diff --git a/addons/zeus/functions/fnc_moduleLoadIntoCargo.sqf b/addons/zeus/functions/fnc_moduleLoadIntoCargo.sqf new file mode 100644 index 0000000000..cf3ae547c8 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleLoadIntoCargo.sqf @@ -0,0 +1,66 @@ +/* + * Author: 654wak654 + * Loads the object module is placed on into selected vehicle. + * + * Arguments: + * 0: Module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleLoadIntoCargo + * + * Public: No + */ +#include "script_component.hpp" + +if (canSuspend) exitWith {[FUNC(moduleSuppressiveFire), _this] call CBA_fnc_directCall;}; + +params ["_logic", "_units", "_activated"]; + +if !(_activated && {local _logic}) exitWith {}; + +private _cargo = attachedTo _logic; + +deleteVehicle _logic; + +if !(missionNamespace getVariable [QEGVAR(cargo,enable), false]) exitWith { + [LSTRING(RequiresAddon)] call FUNC(showMessage); +}; +if (isNull _cargo) exitWith { + [LSTRING(NothingSelected)] call FUNC(showMessage); +}; +if (!alive _cargo) exitWith { + [LSTRING(OnlyAlive)] call FUNC(showMessage); +}; + +[ + _cargo, + { + params ["_successful", "_cargo", "_mousePosASL"]; + if (!_successful) exitWith {}; + + private _holder = (nearestObjects [ASLToAGL _mousePosASL, EGVAR(cargo,cargoHolderTypes), 5]) param [0, objNull]; + if (isNull _holder) exitWith { + [LSTRING(NothingSelected)] call FUNC(showMessage); + }; + if (!alive _holder) exitWith { + [LSTRING(OnlyAlive)] call FUNC(showMessage); + }; + + private _displayName = [_cargo] call EFUNC(common,getName); + if ([_cargo, _holder] call EFUNC(cargo,loadItem)) then { + private _loadedItem = [localize ELSTRING(cargo,LoadedItem), "
", " "] call CBA_fnc_replace; + private _holderDisplayName = [_holder] call EFUNC(common,getName); + [_loadedItem, _displayName, _holderDisplayName] call FUNC(showMessage); + } else { + private _loadingFailed = [localize ELSTRING(cargo,LoadingFailed), "
", " "] call CBA_fnc_replace; + [_loadingFailed, _displayName] call FUNC(showMessage); + }; + }, + localize LSTRING(ModuleLoadIntoCargo_DisplayName), + "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa" +] call FUNC(getModuleDestination); diff --git a/addons/zeus/functions/fnc_moduleSuppressiveFire.sqf b/addons/zeus/functions/fnc_moduleSuppressiveFire.sqf index 1d510fec55..b2c9ba88a7 100644 --- a/addons/zeus/functions/fnc_moduleSuppressiveFire.sqf +++ b/addons/zeus/functions/fnc_moduleSuppressiveFire.sqf @@ -3,7 +3,7 @@ * Commands the selected unit or group to start suppressive fire on the unit, group or location the module is placed on * * Arguments: - * 0: The module logic + * 0: Module logic * 1: Synchronized units * 2: Activated * @@ -22,7 +22,7 @@ if (canSuspend) exitWith {[FUNC(moduleSuppressiveFire), _this] call CBA_fnc_dire params ["_logic", "_units", "_activated"]; -if !(_activated && local _logic) exitWith {}; +if !(_activated && {local _logic}) exitWith {}; // Validate the module target private _unit = effectiveCommander (attachedTo _logic); @@ -34,7 +34,7 @@ if (isNull _unit) exitWith { [LSTRING(NothingSelected)] call FUNC(showMessage); }; if (!alive _unit) exitWith { - [localize LSTRING(OnlyAlive)] call FUNC(showMessage); + [LSTRING(OnlyAlive)] call FUNC(showMessage); }; if ([_unit] call EFUNC(common,isPlayer)) exitWith { ["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call FUNC(showMessage); @@ -43,8 +43,7 @@ if ([_unit] call EFUNC(common,isPlayer)) exitWith { [_unit, { params ["_successful", "_unit", "_mousePosASL"]; TRACE_3("getModuleDestination return",_successful,_unit,_mousePosASL); - if (!_successful) exitWith {}; - if (!alive _unit) exitWith {}; + if !(_successful && {alive _unit}) exitWith {}; private _vehicle = vehicle _unit; private _targetASL = _mousePosASL vectorAdd [0,0,0.6]; // mouse pos is at ground level zero, raise up a bit; @@ -117,4 +116,4 @@ if ([_unit] call EFUNC(common,isPlayer)) exitWith { }; #endif -}, (localize LSTRING(ModuleSuppressiveFire_DisplayName))] call FUNC(getModuleDestination); +}, localize LSTRING(ModuleSuppressiveFire_DisplayName)] call FUNC(getModuleDestination); diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 449d495ee4..f528ff7a80 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1017,23 +1017,26 @@ 火力壓制 Ogień zaporowy - - Add full arsenal to object - Ajouter arsenal complet à l'objet - Aggiunge arsenale completo all'oggetto + + Add Full Arsenal + Ajouter Arsenal Complet + Aggiunge Arsenale Completo オブジェクトに完全なアーセナルを追加 增加完整的虚拟军火库到物件上 增加完整的虛擬軍火庫到物件上 - Dodaj Wirtualny Arsenał do obiektu + Dodaj Wirtualny Arsenał - - Remove arsenal from object - Retirer arsenal de l'objet - Rimuove arsenale completo dall'oggetto + + Remove Arsenal + Retirer Arsenal + Rimuove Arsenale オブジェクトからアーセナルを削除 移除物件上的虚拟军火库 移除物件上的虛擬軍火庫 - Usuń Wirtualny Arsenał z obiektu + Usuń Wirtualny Arsenał + + + Load into Cargo