From 71ddfac4e071a36dbfabc1f06ae74fb3d7ef9add Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Thu, 20 Oct 2016 16:26:25 +0200 Subject: [PATCH 1/5] Add zeus arsenal modules --- addons/zeus/CfgVehicles.hpp | 10 ++++ addons/zeus/XEH_PREP.hpp | 2 + addons/zeus/config.cpp | 2 + .../zeus/functions/fnc_moduleAddArsenal.sqf | 43 +++++++++++++++++ .../functions/fnc_moduleRemoveArsenal.sqf | 47 +++++++++++++++++++ addons/zeus/stringtable.xml | 6 +++ 6 files changed, 110 insertions(+) create mode 100644 addons/zeus/functions/fnc_moduleAddArsenal.sqf create mode 100644 addons/zeus/functions/fnc_moduleRemoveArsenal.sqf diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 4ab9ad871c3..de93e8070b9 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -174,4 +174,14 @@ class CfgVehicles { function = QFUNC(moduleUnconscious); icon = QPATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa); }; + class GVAR(AddFullArsenal): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(moduleAddFullArsenal_displayName); + function = QFUNC(moduleAddArsenal); + }; + class GVAR(RemoveFullArsenal): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(moduleRemoveArsenal_displayName); + function = QFUNC(moduleRemoveArsenal); + }; }; diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index eb70a8529d3..7577358bec4 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -5,11 +5,13 @@ PREP(bi_moduleMine); PREP(bi_moduleProjectile); PREP(bi_moduleRemoteControl); PREP(handleZeusUnitAssigned); +PREP(moduleAddArsenal); PREP(moduleAddSpareTrack); PREP(moduleAddSpareWheel); PREP(moduleCaptive); PREP(moduleGlobalSetSkill); PREP(moduleGroupSide); +PREP(moduleRemoveArsenal); PREP(moduleSearchNearby); PREP(moduleSetMedic); PREP(moduleSetMedicalVehicle); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index ac7ac9832a1..829996715a0 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -10,6 +10,8 @@ class CfgPatches { QGVAR(modulePatrolArea), QGVAR(moduleSearchArea), QGVAR(moduleSearchNearby), + QGVAR(AddFullArsenal), + QGVAR(RemoveFullArsenal), QGVAR(moduleTeleportPlayers) }; weapons[] = {}; diff --git a/addons/zeus/functions/fnc_moduleAddArsenal.sqf b/addons/zeus/functions/fnc_moduleAddArsenal.sqf new file mode 100644 index 00000000000..3122c347260 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddArsenal.sqf @@ -0,0 +1,43 @@ +/* + * Author: alganthe + * Add a full arsenal to an object + * + * Arguments: + * 0: The module logic + * + * Return Value: + * None + * + * Public: No +*/ + +#include "script_component.hpp" + +params ["_logic"]; + +private _object = attachedTo _logic; + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +if !(isNull _object) then { + switch (false) do { + case !(isPlayer _object): { + [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; + }; + case (alive _object): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; + }; +} else { + deleteVehicle _logic; +}; + +["AmmoboxInit", [_object, true]] call BIS_fnc_arsenal; +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf new file mode 100644 index 00000000000..98ae81ea68a --- /dev/null +++ b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf @@ -0,0 +1,47 @@ +/* + * Author: alganthe + * Remove arsenal from an object + * + * Arguments: + * 0: The module logic + * + * Return Value: + * None + * + * Public: No +*/ + +#include "script_component.hpp" + +params ["_logic"]; + +private _object = attachedTo _logic; + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +if !(isNull _object) then { + switch (false) do { + case !(isPlayer _object): { + [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; + }; + case (alive _object): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; + }; +} else { + deleteVehicle _logic; +}; + +[ _object , (_object call BIS_fnc_getVirtualItemCargo), true] call BIS_fnc_removeVirtualItemCargo; +[ _object , (_object call BIS_fnc_getVirtualWeaponCargo), true] call BIS_fnc_removeVirtualWeaponCargo; +[ _object , (_object call BIS_fnc_getVirtualMagazineCargo), true] call BIS_fnc_removeVirtualMagazineCargo; +[ _object , (_object call BIS_fnc_getVirtualBackpackCargo), true] call BIS_fnc_removeVirtualBackpackCargo; + +deleteVehicle _logic; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 6a6f75a4503..51ed3d18b4c 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -664,5 +664,11 @@ 無効な半径が入力されました Wpisano nieprawidłowy promień + + Add full arsenal to object + + + Remove arsenal from object + From 5d74fa4227de0b3e8c381be16d32d3ac2a80256b Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Thu, 20 Oct 2016 17:13:55 +0200 Subject: [PATCH 2/5] Add french strings to arsenal modules --- addons/zeus/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 51ed3d18b4c..279934f0176 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -666,9 +666,11 @@ Add full arsenal to object + Ajouter arsenal complet à l'objet Remove arsenal from object + Retirer arsenal de l'object - + \ No newline at end of file From c68956ccef9135c1e3c27c07b43cceedfd5d24f1 Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Thu, 20 Oct 2016 18:06:52 +0200 Subject: [PATCH 3/5] Fix typo in french string --- addons/zeus/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 279934f0176..495321243a0 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -670,7 +670,7 @@ Remove arsenal from object - Retirer arsenal de l'object + Retirer arsenal de l'objet \ No newline at end of file From 7c5a2a2359b85094fd4528d8cbcac72acc36b8b5 Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Tue, 25 Oct 2016 18:35:07 +0200 Subject: [PATCH 4/5] Make changes to fit review --- addons/zeus/functions/fnc_moduleAddArsenal.sqf | 6 +++--- addons/zeus/functions/fnc_moduleRemoveArsenal.sqf | 6 +++--- addons/zeus/stringtable.xml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/zeus/functions/fnc_moduleAddArsenal.sqf b/addons/zeus/functions/fnc_moduleAddArsenal.sqf index 3122c347260..5b0922cba69 100644 --- a/addons/zeus/functions/fnc_moduleAddArsenal.sqf +++ b/addons/zeus/functions/fnc_moduleAddArsenal.sqf @@ -27,11 +27,11 @@ private _fnc_errorAndClose = { }; if !(isNull _object) then { - switch (false) do { - case !(isPlayer _object): { + switch (true) do { + case (isPlayer _object): { [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; }; - case (alive _object): { + case (!alive _object): { [LSTRING(OnlyAlive)] call _fnc_errorAndClose; }; }; diff --git a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf index 98ae81ea68a..739398d3756 100644 --- a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf +++ b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf @@ -27,11 +27,11 @@ private _fnc_errorAndClose = { }; if !(isNull _object) then { - switch (false) do { - case !(isPlayer _object): { + switch (true) do { + case (isPlayer _object): { [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; }; - case (alive _object): { + case (!alive _object): { [LSTRING(OnlyAlive)] call _fnc_errorAndClose; }; }; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 495321243a0..df0bd80e878 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -673,4 +673,4 @@ Retirer arsenal de l'objet - \ No newline at end of file + From fa4a56c3f0ed04791534b911093faf9bb999b457 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 30 May 2017 19:11:24 -0500 Subject: [PATCH 5/5] locality check, use showMessage, set categroy --- addons/zeus/CfgVehicles.hpp | 2 + .../zeus/functions/fnc_moduleAddArsenal.sqf | 39 ++++++++--------- .../functions/fnc_moduleRemoveArsenal.sqf | 42 ++++++++----------- 3 files changed, 37 insertions(+), 46 deletions(-) diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index ca376819e5c..9918764462f 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -216,11 +216,13 @@ class CfgVehicles { }; class GVAR(AddFullArsenal): GVAR(moduleBase) { curatorCanAttach = 1; + category = QGVAR(Utility); displayName = CSTRING(moduleAddFullArsenal_displayName); function = QFUNC(moduleAddArsenal); }; class GVAR(RemoveFullArsenal): GVAR(moduleBase) { curatorCanAttach = 1; + category = QGVAR(Utility); displayName = CSTRING(moduleRemoveArsenal_displayName); function = QFUNC(moduleRemoveArsenal); }; diff --git a/addons/zeus/functions/fnc_moduleAddArsenal.sqf b/addons/zeus/functions/fnc_moduleAddArsenal.sqf index 5b0922cba69..b8eed64d76f 100644 --- a/addons/zeus/functions/fnc_moduleAddArsenal.sqf +++ b/addons/zeus/functions/fnc_moduleAddArsenal.sqf @@ -9,35 +9,30 @@ * None * * Public: No -*/ - + */ #include "script_component.hpp" params ["_logic"]; +if (!local _logic) exitWith {}; private _object = attachedTo _logic; +TRACE_3("moduleAddArsenal",_logic,_object,typeOf _object); -scopeName "Main"; -private _fnc_errorAndClose = { - params ["_msg"]; - _display closeDisplay 0; - deleteVehicle _logic; - [_msg] call EFUNC(common,displayTextStructured); - breakOut "Main"; -}; - -if !(isNull _object) then { - switch (true) do { - case (isPlayer _object): { - [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; - }; - case (!alive _object): { - [LSTRING(OnlyAlive)] call _fnc_errorAndClose; - }; +switch (true) do { + case (isNull _object): { + [LSTRING(NothingSelected)] call FUNC(showMessage); + }; + case (isPlayer _object): { + ["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call FUNC(showMessage); + }; + case (!alive _object): { + [LSTRING(OnlyAlive)] call FUNC(showMessage); + }; + default { + TRACE_1("BIS_fnc_arsenal: AmmoboxInit",_object); + // Global Effects: "Action to access the Arsenal will be added automatically on all clients." + ["AmmoboxInit", [_object, true]] call BIS_fnc_arsenal; }; -} else { - deleteVehicle _logic; }; -["AmmoboxInit", [_object, true]] call BIS_fnc_arsenal; deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf index 739398d3756..9e267e4cf51 100644 --- a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf +++ b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf @@ -14,34 +14,28 @@ #include "script_component.hpp" params ["_logic"]; +if (!local _logic) exitWith {}; private _object = attachedTo _logic; +TRACE_3("moduleRemoveArsenal",_logic,_object,typeOf _object); -scopeName "Main"; -private _fnc_errorAndClose = { - params ["_msg"]; - _display closeDisplay 0; - deleteVehicle _logic; - [_msg] call EFUNC(common,displayTextStructured); - breakOut "Main"; -}; - -if !(isNull _object) then { - switch (true) do { - case (isPlayer _object): { - [LSTRING(OnlyNonPlayer)] call _fnc_errorAndClose; - }; - case (!alive _object): { - [LSTRING(OnlyAlive)] call _fnc_errorAndClose; - }; +switch (true) do { + case (isNull _object): { + [LSTRING(NothingSelected)] call FUNC(showMessage); + }; + case (isPlayer _object): { + ["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call FUNC(showMessage); + }; + case (!alive _object): { + [LSTRING(OnlyAlive)] call FUNC(showMessage); + }; + default { + TRACE_1("Calling removeVirtualXXXCargo functions",_object); + [_object, (_object call BIS_fnc_getVirtualItemCargo), true] call BIS_fnc_removeVirtualItemCargo; + [_object, (_object call BIS_fnc_getVirtualWeaponCargo), true] call BIS_fnc_removeVirtualWeaponCargo; + [_object, (_object call BIS_fnc_getVirtualMagazineCargo), true] call BIS_fnc_removeVirtualMagazineCargo; + [_object, (_object call BIS_fnc_getVirtualBackpackCargo), true] call BIS_fnc_removeVirtualBackpackCargo; }; -} else { - deleteVehicle _logic; }; -[ _object , (_object call BIS_fnc_getVirtualItemCargo), true] call BIS_fnc_removeVirtualItemCargo; -[ _object , (_object call BIS_fnc_getVirtualWeaponCargo), true] call BIS_fnc_removeVirtualWeaponCargo; -[ _object , (_object call BIS_fnc_getVirtualMagazineCargo), true] call BIS_fnc_removeVirtualMagazineCargo; -[ _object , (_object call BIS_fnc_getVirtualBackpackCargo), true] call BIS_fnc_removeVirtualBackpackCargo; - deleteVehicle _logic;