From cc08a9ff9a98348edd7f8dabaf49af6107155c1f Mon Sep 17 00:00:00 2001 From: Andx Date: Wed, 19 Aug 2026 11:27:17 +0200 Subject: [PATCH 1/2] Add ZEN compatibility with new IED placement features and context menu integration --- .hemtt/launch.toml | 9 ++- .../mission.sqm | 20 +++--- addons/modules/XEH_PREP.hpp | 4 ++ addons/modules/XEH_preInit.sqf | 3 +- .../functions/fnc_zenConfirmPlaceIed.sqf | 39 +++++++++++ addons/modules/functions/fnc_zenIedTypes.sqf | 29 ++++++++ .../functions/fnc_zenOpenPlaceDialog.sqf | 67 +++++++++++++++++++ .../functions/fnc_zenRegisterActions.sqf | 27 ++++++++ addons/modules/initSettings.inc.sqf | 10 +++ .../modules/modules_zen/CfgEventHandlers.hpp | 6 ++ addons/modules/modules_zen/XEH_postInit.sqf | 5 ++ addons/modules/modules_zen/config.cpp | 16 +++++ .../modules/modules_zen/script_component.hpp | 3 + addons/modules/stringtable.xml | 8 +++ 14 files changed, 232 insertions(+), 14 deletions(-) create mode 100644 addons/modules/functions/fnc_zenConfirmPlaceIed.sqf create mode 100644 addons/modules/functions/fnc_zenIedTypes.sqf create mode 100644 addons/modules/functions/fnc_zenOpenPlaceDialog.sqf create mode 100644 addons/modules/functions/fnc_zenRegisterActions.sqf create mode 100644 addons/modules/initSettings.inc.sqf create mode 100644 addons/modules/modules_zen/CfgEventHandlers.hpp create mode 100644 addons/modules/modules_zen/XEH_postInit.sqf create mode 100644 addons/modules/modules_zen/config.cpp create mode 100644 addons/modules/modules_zen/script_component.hpp diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index 72231b45..07391161 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -41,4 +41,11 @@ parameters = [ "-setThreadCharacteristics", "-limitFPS=144", ] -executable = "arma3serverprofiling_x64" \ No newline at end of file +executable = "arma3serverprofiling_x64" + +[zen] +extends = "dev" + +workshop = [ + "1779063631" # Zeus Enhanced +] \ No newline at end of file diff --git a/.hemtt/missions/0000_IEDD_NOTEBOOK_TEST.Stratis/mission.sqm b/.hemtt/missions/0000_IEDD_NOTEBOOK_TEST.Stratis/mission.sqm index 66c287fc..09a69ce3 100644 --- a/.hemtt/missions/0000_IEDD_NOTEBOOK_TEST.Stratis/mission.sqm +++ b/.hemtt/missions/0000_IEDD_NOTEBOOK_TEST.Stratis/mission.sqm @@ -6,6 +6,10 @@ class EditorData scaleGridStep=1; autoGroupingDist=10; toggles=5; + mods[]= + { + "3denEnhanced" + }; class ItemIDProvider { nextID=4; @@ -15,7 +19,7 @@ class EditorData pos[]={1913.8051,53.913181,5762.4653}; dir[]={-0.63605744,-0.74849755,-0.18761359}; up[]={-0.71791911,0.66313916,-0.21175961}; - aside[]={-0.28291476,6.9077942e-008,0.95915174}; + aside[]={-0.28291476,6.9077942e-08,0.95915174}; }; }; binarizationWanted=0; @@ -23,14 +27,13 @@ sourceName="0000_iedd_notebook_test"; addons[]= { "A3_Characters_F", - "ace_explosives", "A3_Modules_F_Curator_Curator" }; class AddonsMetaData { class List { - items=3; + items=2; class Item0 { className="A3_Characters_F"; @@ -39,13 +42,6 @@ class AddonsMetaData url="https://www.arma3.com"; }; class Item1 - { - className="ace_explosives"; - name="ACE3 - Explosives"; - author="ACE-Team"; - url="https://ace3.acemod.org/"; - }; - class Item2 { className="A3_Modules_F_Curator"; name="Arma 3 Zeus Update - Scripted Modules"; @@ -144,14 +140,14 @@ class Mission }; id=1; type="B_soldier_exp_F"; - atlOffset=4.7683716e-007; + atlOffset=4.7683716e-07; }; }; class Attributes { }; id=0; - atlOffset=4.7683716e-007; + atlOffset=4.7683716e-07; }; class Item1 { diff --git a/addons/modules/XEH_PREP.hpp b/addons/modules/XEH_PREP.hpp index 451122ec..68773c81 100644 --- a/addons/modules/XEH_PREP.hpp +++ b/addons/modules/XEH_PREP.hpp @@ -14,3 +14,7 @@ PREP(setSuicide); PREP(setVbied); PREP(sliderMove); PREP(vbiedSelected); +PREP(zenConfirmPlaceIed); +PREP(zenIedTypes); +PREP(zenOpenPlaceDialog); +PREP(zenRegisterActions); diff --git a/addons/modules/XEH_preInit.sqf b/addons/modules/XEH_preInit.sqf index 2ae7e5a8..89477353 100644 --- a/addons/modules/XEH_preInit.sqf +++ b/addons/modules/XEH_preInit.sqf @@ -5,6 +5,7 @@ ADDON = false; PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; - + +#include "initSettings.inc.sqf" ADDON = true; diff --git a/addons/modules/functions/fnc_zenConfirmPlaceIed.sqf b/addons/modules/functions/fnc_zenConfirmPlaceIed.sqf new file mode 100644 index 00000000..8b15618a --- /dev/null +++ b/addons/modules/functions/fnc_zenConfirmPlaceIed.sqf @@ -0,0 +1,39 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Confirm handler for the ZEN "Spawn IED" dialog. + * Spawns the selected IED at the position the ZEN context menu was opened at. + * Uses the same iedd_modules_createIed server event as the vanilla "Place IED" Zeus module. + * + * Arguments: + * 0: Dialog return values + * 1: Position (ASL, passed through from fnc_zenOpenPlaceDialog.sqf) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_values", "_position"]; +_values params ["_typeNum", "_variation", "_size", "_dud", "_dist", "_timer", "_value"]; + +private _types = call FUNC(zenIedTypes); +private _type = (_types select _typeNum) select 0; + +// Resolve "Random" variation the same way the Zeus module dialog does (fnc_setIed.sqf) +private _varData = "getText (_x >> 'name') isEqualTo localize 'STR_iedd_ied_Name_Random'" configClasses (configFile >> "CfgVehicles" >> _type >> "Attributes" >> "iedd_ied_variation" >> "Values") apply {getNumber (_x >> 'value')}; +private _random = _varData select 0; +if (_variation == _random) then { + _variation = floor (random _random); +}; + +_dist = round _dist; +_value = round _value; + +// Drop to a 2D position so createVehicle snaps the IED directly onto the surface +// instead of using ZEN's cursor-ray Z as-is, which can leave it a hair above ground +_position resize 2; + +// Bucket lid state/open-close are not exposed here, matching the current Zeus module dialog's controls +[QGVAR(createIed), [_type, _position, _variation, _dud, _size, _timer, _value, _dist, _typeNum, -1, 0, 0]] call CBA_fnc_serverEvent; diff --git a/addons/modules/functions/fnc_zenIedTypes.sqf b/addons/modules/functions/fnc_zenIedTypes.sqf new file mode 100644 index 00000000..7570823e --- /dev/null +++ b/addons/modules/functions/fnc_zenIedTypes.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Returns the IED types available for placement via the ZEN context menu. + * Mirrors the type list of the "Place IED" Zeus module (see ui\RcsIeds.hpp). + * + * Arguments: + * None + * + * Return Value: + * Array of [Class Name , Type Index , Display Name ] + * + * Public: No + */ + +[ + [QEGVAR(ied,CanisterPlastic), 0, ELSTRING(ied,PlasticCanister_DisplayName)], + [QEGVAR(ied,CanisterFuel), 1, ELSTRING(ied,FuelCanister_Green)], + [QEGVAR(ied,CanisterFuel), 2, ELSTRING(ied,FuelCanister_Blue)], + [QEGVAR(ied,CanisterFuel), 3, ELSTRING(ied,FuelCanister_Red)], + [QEGVAR(ied,CanisterFuel), 4, ELSTRING(ied,FuelCanister_White)], + [QEGVAR(ied,Cardboard), 5, ELSTRING(ied,Cardboard_DisplayName)], + [QEGVAR(ied,Cinder), 6, ELSTRING(ied,Cinder_DisplayName)], + [QEGVAR(ied,Barrel), 7, ELSTRING(ied,Barrel_DisplayName)], + [QEGVAR(ied,Barrel_Grey), 8, ELSTRING(ied,BarrelGrey_DisplayName)], + [QEGVAR(ied,Metal), 9, ELSTRING(ied,MetalBarrel_DisplayName)], + [QEGVAR(ied,Metal_English), 10, ELSTRING(ied,MetalBarrelEnglish_DisplayName)], + [QEGVAR(ied,Bucket), 11, ELSTRING(ied,Bucket_DisplayName)] +] diff --git a/addons/modules/functions/fnc_zenOpenPlaceDialog.sqf b/addons/modules/functions/fnc_zenOpenPlaceDialog.sqf new file mode 100644 index 00000000..5baf8299 --- /dev/null +++ b/addons/modules/functions/fnc_zenOpenPlaceDialog.sqf @@ -0,0 +1,67 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Opens the ZEN "Spawn IED" parameter dialog for the given position. + * Confirming the dialog spawns the IED exactly at that position, see fnc_zenConfirmPlaceIed.sqf. + * + * Arguments: + * 0: Position (ASL, as captured by the ZEN context menu click) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_position"]; + +private _types = call FUNC(zenIedTypes); +private _typeValues = _types apply {_x select 1}; +private _typeLabels = _types apply {_x select 2}; + +[ + localize LSTRING(Zeus_Place_Ied), + [ + ["COMBO", [LSTRING(Zeus_Type), LSTRING(Zeus_Type_Tooltip)], [_typeValues, _typeLabels, 0]], + ["COMBO", [LSTRING(Zeus_Variation), LSTRING(Zeus_Ied_Var_Tooltip)], [ + [0, 1, 2, 3, 4, 5, 6], + [ + ELSTRING(ied,Variation_1), + ELSTRING(ied,Variation_2), + ELSTRING(ied,Variation_3), + ELSTRING(ied,Variation_4), + ELSTRING(ied,Variation_5), + ELSTRING(ied,Variation_X), + ELSTRING(ied,Name_Random) + ], + 6 + ]], + ["COMBO", [LSTRING(Zeus_Size), LSTRING(Zeus_Size_Tooltip)], [ + [0, 1, 2, 3, 4, 5], + [ + ELSTRING(ied,Name_Tiny), + ELSTRING(ied,Name_Small), + ELSTRING(ied,Name_Medium), + ELSTRING(ied,Name_Large), + ELSTRING(ied,Name_Huge), + ELSTRING(ied,Name_Random) + ], + 3 + ]], + ["SLIDER:PERCENT", [LSTRING(Zeus_Dud_Category)], [0, 1, 0]], + ["SLIDER", [LSTRING(Zeus_Distance_Category)], [0, 30, 0]], + ["COMBO", [LSTRING(Zeus_Timer)], [ + [0, 1, 2], + [ + ELSTRING(ied,Name_Disabled), + ELSTRING(ied,Name_Enabled), + ELSTRING(ied,Name_Random) + ], + 0 + ]], + ["SLIDER", [LSTRING(Zeus_TimerValue_Category), LSTRING(Zeus_TimerValue_Tooltip)], [0, 300, (EGVAR(ied,defaultTimerValue))]] + ], + FUNC(zenConfirmPlaceIed), + {}, + _position +] call zen_dialog_fnc_create; diff --git a/addons/modules/functions/fnc_zenRegisterActions.sqf b/addons/modules/functions/fnc_zenRegisterActions.sqf new file mode 100644 index 00000000..32c50b43 --- /dev/null +++ b/addons/modules/functions/fnc_zenRegisterActions.sqf @@ -0,0 +1,27 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Registers IEDD's actions in Zeus Enhanced's (ZEN) right-click context menu. + * Only called when ZEN is loaded, see modules_zen\XEH_postInit.sqf. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +private _category = ["IEDD", "IEDD", [QPATHTOF(ui\moduleicon.paa)]] call zen_context_menu_fnc_createAction; +private _categoryPath = [_category, [], 50] call zen_context_menu_fnc_addAction; + +private _placeIed = [ + "PlaceIED", + localize LSTRING(Zeus_Place_Ied), + "", + {[_position] call FUNC(zenOpenPlaceDialog)}, + {GVAR(zenContextMenuEnabled)} +] call zen_context_menu_fnc_createAction; + +[_placeIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; diff --git a/addons/modules/initSettings.inc.sqf b/addons/modules/initSettings.inc.sqf new file mode 100644 index 00000000..81b7dabb --- /dev/null +++ b/addons/modules/initSettings.inc.sqf @@ -0,0 +1,10 @@ +[ + QGVAR(zenContextMenuEnabled), + "CHECKBOX", + [LSTRING(ZenContextMenuEnabled), LSTRING(ZenContextMenuEnabled_Description)], + [localize "STR_iedd_main_Category_Main", "Zeus Enhanced"], + true, + true, + {}, + false +] call CBA_fnc_addSetting; diff --git a/addons/modules/modules_zen/CfgEventHandlers.hpp b/addons/modules/modules_zen/CfgEventHandlers.hpp new file mode 100644 index 00000000..12fbfcd2 --- /dev/null +++ b/addons/modules/modules_zen/CfgEventHandlers.hpp @@ -0,0 +1,6 @@ +class Extended_PostInit_EventHandlers { + class SUBADDON { + //Path adjusted for being in a SUBADDON + init = QUOTE(call COMPILE_SCRIPT(modules_zen\XEH_postInit)); + }; +}; diff --git a/addons/modules/modules_zen/XEH_postInit.sqf b/addons/modules/modules_zen/XEH_postInit.sqf new file mode 100644 index 00000000..d90b31e4 --- /dev/null +++ b/addons/modules/modules_zen/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +[] call FUNC(zenRegisterActions); diff --git a/addons/modules/modules_zen/config.cpp b/addons/modules/modules_zen/config.cpp new file mode 100644 index 00000000..8ef05010 --- /dev/null +++ b/addons/modules/modules_zen/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + addonRootClass = QUOTE(ADDON); + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"zen_context_menu", "zen_dialog"}; + units[] = {}; + weapons[] = {}; + VERSION_CONFIG; + + skipWhenMissingDependencies = 1; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/modules/modules_zen/script_component.hpp b/addons/modules/modules_zen/script_component.hpp new file mode 100644 index 00000000..0b9f689f --- /dev/null +++ b/addons/modules/modules_zen/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT zen +#define SUBCOMPONENT_BEAUTIFIED ZEN +#include "..\script_component.hpp" diff --git a/addons/modules/stringtable.xml b/addons/modules/stringtable.xml index 02801655..418dfa8c 100644 --- a/addons/modules/stringtable.xml +++ b/addons/modules/stringtable.xml @@ -196,6 +196,14 @@ YAW YAW + + Enable ZEN Context Menu + Enable ZEN Context Menu + + + Adds a "Spawn IED" action to Zeus Enhanced's (ZEN) right-click context menu. + Adds a "Spawn IED" action to Zeus Enhanced's (ZEN) right-click context menu. + ACTIVATION DISTANCE ACTIVATION DISTANCE From 151e4751be5cf1a220377d6c5803af02f196dd8d Mon Sep 17 00:00:00 2001 From: Andx Date: Wed, 19 Aug 2026 12:19:56 +0200 Subject: [PATCH 2/2] Add ZEN compatibility features including new IED actions, context menu integration, and training IED types. Implement force defuse, bury/unbury functionality, and various dialog handlers for enhanced user interaction. --- addons/ied/XEH_PREP.hpp | 2 + addons/ied/XEH_postInit.sqf | 9 ++ addons/ied/functions/fnc_forceDefuse.sqf | 55 ++++++++++ addons/ied/functions/fnc_setBury.sqf | 40 +++++++ addons/main/script_classes.hpp | 12 +++ addons/modules/XEH_PREP.hpp | 13 +++ addons/modules/XEH_postInit.sqf | 1 + .../functions/fnc_makeSuicideBomber.sqf | 46 ++++++++ .../modules/functions/fnc_zenActivateIed.sqf | 20 ++++ .../modules/functions/fnc_zenConfirmBury.sqf | 33 ++++++ .../functions/fnc_zenConfirmSuicide.sqf | 28 +++++ .../functions/fnc_zenConfirmTraining.sqf | 32 ++++++ addons/modules/functions/fnc_zenDigUpIed.sqf | 23 ++++ .../modules/functions/fnc_zenExplodeIed.sqf | 20 ++++ .../functions/fnc_zenForceDefuseIed.sqf | 21 ++++ .../functions/fnc_zenOpenBuryDialog.sqf | 41 +++++++ .../functions/fnc_zenOpenSuicideDialog.sqf | 67 ++++++++++++ .../functions/fnc_zenOpenTrainingDialog.sqf | 43 ++++++++ .../functions/fnc_zenRegisterActions.sqf | 101 +++++++++++++++++- .../functions/fnc_zenResetTrainingIed.sqf | 21 ++++ .../functions/fnc_zenTrainingIedTypes.sqf | 25 +++++ addons/modules/initSettings.inc.sqf | 23 ++-- addons/modules/stringtable.xml | 12 +++ 23 files changed, 675 insertions(+), 13 deletions(-) create mode 100644 addons/ied/functions/fnc_forceDefuse.sqf create mode 100644 addons/ied/functions/fnc_setBury.sqf create mode 100644 addons/modules/functions/fnc_makeSuicideBomber.sqf create mode 100644 addons/modules/functions/fnc_zenActivateIed.sqf create mode 100644 addons/modules/functions/fnc_zenConfirmBury.sqf create mode 100644 addons/modules/functions/fnc_zenConfirmSuicide.sqf create mode 100644 addons/modules/functions/fnc_zenConfirmTraining.sqf create mode 100644 addons/modules/functions/fnc_zenDigUpIed.sqf create mode 100644 addons/modules/functions/fnc_zenExplodeIed.sqf create mode 100644 addons/modules/functions/fnc_zenForceDefuseIed.sqf create mode 100644 addons/modules/functions/fnc_zenOpenBuryDialog.sqf create mode 100644 addons/modules/functions/fnc_zenOpenSuicideDialog.sqf create mode 100644 addons/modules/functions/fnc_zenOpenTrainingDialog.sqf create mode 100644 addons/modules/functions/fnc_zenResetTrainingIed.sqf create mode 100644 addons/modules/functions/fnc_zenTrainingIedTypes.sqf diff --git a/addons/ied/XEH_PREP.hpp b/addons/ied/XEH_PREP.hpp index cc15c268..cb78ab66 100644 --- a/addons/ied/XEH_PREP.hpp +++ b/addons/ied/XEH_PREP.hpp @@ -27,6 +27,7 @@ PREP(disarmAction); PREP(dud); PREP(dudWires); PREP(explosion); +PREP(forceDefuse); PREP(getDigActions); PREP(getTrainingActions); PREP(handleEntityCreated); @@ -45,6 +46,7 @@ PREP(openCloseBucket); PREP(removeEvents); PREP(resetAction); PREP(setAttributes); +PREP(setBury); PREP(sides_onAttributeLoad); PREP(suicide); PREP(suicideAct); diff --git a/addons/ied/XEH_postInit.sqf b/addons/ied/XEH_postInit.sqf index 7395c0e9..0f76b1e5 100644 --- a/addons/ied/XEH_postInit.sqf +++ b/addons/ied/XEH_postInit.sqf @@ -102,6 +102,14 @@ TRACE_2("Defused: ",_unit,_object); }] call CBA_fnc_addEventHandler; +[QGVAR(forceDefuse), { + _this call FUNC(forceDefuse); +}] call CBA_fnc_addEventHandler; + +[QGVAR(setBury), { + _this call FUNC(setBury); +}] call CBA_fnc_addEventHandler; + [QGVAR(addLocal), { params ["_unit"]; private _killedEhId = _unit getVariable [QGVAR(KilledEhId), -1]; @@ -144,6 +152,7 @@ _bombObj setDir _dir; _bombObj setVectorDirAndUp _vectorDirAndUp; _bombObj setPosATL _pos; + {_x addCuratorEditableObjects [[_bombObj], true]} forEach allCurators; }] call CBA_fnc_addEventHandler; if (isServer) then { diff --git a/addons/ied/functions/fnc_forceDefuse.sqf b/addons/ied/functions/fnc_forceDefuse.sqf new file mode 100644 index 00000000..8781965a --- /dev/null +++ b/addons/ied/functions/fnc_forceDefuse.sqf @@ -0,0 +1,55 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Marks the given IED(s) as defused, skipping the wire-cutting sequence entirely. + * Mirrors the "all wires cut correctly" branch of fnc_cutWire.sqf. + * + * Arguments: + * 0: IED objects + * 1: Player to attribute the defuse to (optional) + * + * Return Value: + * None + * + * Public: Server only + */ + +params ["_objects", ["_player", objNull, [objNull]]]; + +{ + private _bombObj = _x; + + if !(_bombObj getVariable [QGVAR(bomb), false]) exitWith {}; + + _bombObj setVariable [QGVAR(bomb), false, true]; + + // Wires are normally deleted one by one as they're cut (fnc_cutWire.sqf); do that in one go here + { + if !(isNull _x) then { + deleteVehicle _x; + }; + } forEach (_bombObj getVariable [QGVAR(wires), []]); + _bombObj setVariable [QGVAR(wires), [], true]; + + private _attachedObjects = attachedObjects _bombObj; + private _index = _attachedObjects findIf {typeOf _x == QGVAR(Charge_Ammo)}; + if (_index > -1) then { + deleteVehicle (_attachedObjects select _index); + }; + + private _typeOf = typeOf _bombObj; + if (_typeOf == QGVAR(Charge)) then { + private _unit = attachedTo _bombObj; + private _jipId = [QGVAR(detachAction), [_bombObj]] call CBA_fnc_globalEventJIP; + [_jipId, _bombObj] call CBA_fnc_removeGlobalEventJIP; + [QGVAR(events), [_unit]] call CBA_fnc_serverEvent; + }; + if (_typeOf == QEGVAR(vbied,box)) then { + private _vehicle = attachedTo _bombObj; + [QEGVAR(vbied,events), [_vehicle]] call CBA_fnc_serverEvent; + private _jipId = [QEGVAR(vbied,detachAction), [_bombObj, _vehicle]] call CBA_fnc_globalEventJIP; + [_jipId, _bombObj] call CBA_fnc_removeGlobalEventJIP; + }; + + [QGVAR(defused), [_player, _bombObj]] call CBA_fnc_globalEvent; +} forEach _objects; diff --git a/addons/ied/functions/fnc_setBury.sqf b/addons/ied/functions/fnc_setBury.sqf new file mode 100644 index 00000000..4b76879f --- /dev/null +++ b/addons/ied/functions/fnc_setBury.sqf @@ -0,0 +1,40 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Buries or unburies the given IED(s) directly, without the interactive Zeus "Bury IED" + * module dialog. Reuses fnc_buryIED.sqf for the actual position/rotation math. + * + * Arguments: + * 0: IED objects + * 1: Depth in steps, 0-20; 0 unburies and restores the original position + * 2: [Vector Dir, Vector Up] to bury at, defaults to each object's current orientation (optional) + * + * Return Value: + * None + * + * Public: Server only + */ + +params ["_objects", ["_depth", 10, [0]], ["_vectorDirUp", [], [[]]]]; + +{ + private _ied = _x; + private _isBury = _ied getVariable [QGVAR(isBury), false]; + + if (_depth > 0 && {_isBury}) exitWith {}; // already buried + if (_depth <= 0 && {!_isBury}) exitWith {}; // already unburied + + if (_depth > 0) then { + private _vectorDir = if (_vectorDirUp isEqualTo []) then {vectorDir _ied} else {_vectorDirUp select 0}; + private _vectorUp = if (_vectorDirUp isEqualTo []) then {vectorUp _ied} else {_vectorDirUp select 1}; + _ied setVariable [QGVAR(bury), [_depth, _vectorDir, _vectorUp]]; + _ied setVariable [QGVAR(isBury), true, true]; + } else { + // Keep the stored pre-bury vectorDir/vectorUp so fnc_buryIED.sqf restores the original orientation + private _bury = _ied getVariable [QGVAR(bury), [0, vectorDir _ied, vectorUp _ied]]; + _bury set [0, 0]; + _ied setVariable [QGVAR(bury), _bury]; + }; + + [_ied] call FUNC(buryIED); +} forEach _objects; diff --git a/addons/main/script_classes.hpp b/addons/main/script_classes.hpp index 58132069..647abf35 100644 --- a/addons/main/script_classes.hpp +++ b/addons/main/script_classes.hpp @@ -20,6 +20,18 @@ "iedd_ied_Bucket"\ ] +#define IEDD_TRAINING_CLASSES [\ + "iedd_ied_Training_CanisterPlastic",\ + "iedd_ied_Training_CanisterFuel",\ + "iedd_ied_Training_Cardboard",\ + "iedd_ied_Training_Cinder",\ + "iedd_ied_Training_Metal",\ + "iedd_ied_Training_Metal_English",\ + "iedd_ied_Training_Barrel",\ + "iedd_ied_Training_Barrel_Grey",\ + "iedd_ied_Training_Bucket"\ +] + #define IEDD_FAKE_CLASSES [\ "iedd_ied_CanisterPlastic_Fake",\ "iedd_ied_CanisterFuel_Fake",\ diff --git a/addons/modules/XEH_PREP.hpp b/addons/modules/XEH_PREP.hpp index 68773c81..f088d8f6 100644 --- a/addons/modules/XEH_PREP.hpp +++ b/addons/modules/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(attributes); PREP(activateVbied); PREP(explodeVbied); +PREP(makeSuicideBomber); PREP(moduleActivate); PREP(moduleExplode); PREP(multi); @@ -14,7 +15,19 @@ PREP(setSuicide); PREP(setVbied); PREP(sliderMove); PREP(vbiedSelected); +PREP(zenActivateIed); +PREP(zenConfirmBury); PREP(zenConfirmPlaceIed); +PREP(zenConfirmSuicide); +PREP(zenConfirmTraining); +PREP(zenDigUpIed); +PREP(zenExplodeIed); +PREP(zenForceDefuseIed); PREP(zenIedTypes); +PREP(zenOpenBuryDialog); PREP(zenOpenPlaceDialog); +PREP(zenOpenSuicideDialog); +PREP(zenOpenTrainingDialog); PREP(zenRegisterActions); +PREP(zenResetTrainingIed); +PREP(zenTrainingIedTypes); diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index bee9901f..b2aef60b 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -47,6 +47,7 @@ _bombObj setVariable ["iedd_ied_openCloseEOD",_oce]; _bombObj setVariable ["iedd_ied_openClose",_oc]; }; + {_x addCuratorEditableObjects [[_bombObj], true]} forEach allCurators; }] call CBA_fnc_addEventHandler; [QGVAR(explode), { diff --git a/addons/modules/functions/fnc_makeSuicideBomber.sqf b/addons/modules/functions/fnc_makeSuicideBomber.sqf new file mode 100644 index 00000000..f5a43a56 --- /dev/null +++ b/addons/modules/functions/fnc_makeSuicideBomber.sqf @@ -0,0 +1,46 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Turns the given unit into a suicide bomber. Same effect as the interactive Zeus + * "Set Suicide" module's confirm action (fnc_setSuicide.sqf), callable directly. + * + * Arguments: + * 0: Unit + * 1: Variation, 0-4 real or 5+ for random + * 2: Dud chance, 0-1 + * 3: Size, 0-3 real or 4+ for random + * 4: Activation distance + * 5: Explosion distance + * 6: Sides, 4 elements each either -1 (excluded) or its own index (included) + * 7: Dead man switch + * + * Return Value: + * None + * + * Public: No + */ + +params ["_unit", "_variation", "_dud", "_size", "_actDist", "_expDist", "_sides", "_isDms"]; + +if !(_unit isKindOf "CAManBase") exitWith {}; +if !(alive _unit) exitWith {}; +if (_unit getVariable [QEGVAR(ied,isCharge), false]) exitWith {}; + +if (_size > 3) then { + _size = selectRandom [0, 1, 2, 3]; +}; + +// These variables belong to the "ied" component's namespace (read by EFUNC(ied,charge) and friends), +// even though this helper - like the original Zeus module it replaces - lives in "modules" +_unit setVariable [QEGVAR(ied,isSuicide), true, true]; +_unit setVariable [QEGVAR(ied,c_variation), _variation, true]; +_unit setVariable [QEGVAR(ied,c_dud), _dud, true]; +_unit setVariable [QEGVAR(ied,c_size), _size, true]; +_unit setVariable [QEGVAR(ied,actDist), _actDist, true]; +_unit setVariable [QEGVAR(ied,expDist), _expDist, true]; +_unit setVariable [QEGVAR(ied,sides), _sides, true]; +_unit setVariable [QEGVAR(ied,isDeadManSwitch), _isDms, true]; + +[QGVAR(addBombVest), [_unit, true]] call CBA_fnc_serverEvent; +_unit setVariable [QEGVAR(ied,isCharge), true, true]; +[QGVAR(remove), [_unit], _unit] call CBA_fnc_targetEvent; diff --git a/addons/modules/functions/fnc_zenActivateIed.sqf b/addons/modules/functions/fnc_zenActivateIed.sqf new file mode 100644 index 00000000..f3e18abf --- /dev/null +++ b/addons/modules/functions/fnc_zenActivateIed.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * ZEN context menu statement: activates the selected/hovered IED(s), respecting their dud chance. + * Mirrors fnc_moduleActivate.sqf, retargeted at the ZEN selection instead of an attached logic. + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +{ + [QEGVAR(ied,explosion), [_x]] call CBA_fnc_serverEvent; +} forEach (_objects select {typeOf _x in IEDD_CLASSES}); diff --git a/addons/modules/functions/fnc_zenConfirmBury.sqf b/addons/modules/functions/fnc_zenConfirmBury.sqf new file mode 100644 index 00000000..c61ef735 --- /dev/null +++ b/addons/modules/functions/fnc_zenConfirmBury.sqf @@ -0,0 +1,33 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Confirm handler for the ZEN "Bury IED" dialog. + * Applies the chosen pitch/roll/yaw/depth to all matched objects, reusing fnc_buryIED.sqf + * for the actual positioning - the same math the interactive Zeus module uses, applied at once. + * + * Arguments: + * 0: Dialog return values + * 1: Objects (passed through from fnc_zenOpenBuryDialog.sqf) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_values", "_objects"]; +_values params ["_pitch", "_roll", "_yaw", "_depth"]; + +// Same pitch/roll/yaw -> vectorDir/vectorUp conversion as the Zeus module's slider handler +private _vectorDir = [ + sin(_yaw) * cos(_pitch), + cos(_yaw) * cos(_pitch), + sin(_pitch) +]; +private _vectorUp = [ + (-sin(_roll) * cos(_yaw)) - (cos(_roll) * sin(_pitch) * sin(_yaw)), + ( sin(_roll) * sin(_yaw)) - (cos(_roll) * sin(_pitch) * cos(_yaw)), + cos(_roll) * cos(_pitch) +]; + +[QEGVAR(ied,setBury), [_objects, _depth, [_vectorDir, _vectorUp]]] call CBA_fnc_serverEvent; diff --git a/addons/modules/functions/fnc_zenConfirmSuicide.sqf b/addons/modules/functions/fnc_zenConfirmSuicide.sqf new file mode 100644 index 00000000..50d69c93 --- /dev/null +++ b/addons/modules/functions/fnc_zenConfirmSuicide.sqf @@ -0,0 +1,28 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Confirm handler for the ZEN "Make Suicide Bomber" dialog. + * Applies the chosen parameters to every matched unit via fnc_makeSuicideBomber.sqf. + * + * Arguments: + * 0: Dialog return values + * 1: Objects (passed through from fnc_zenOpenSuicideDialog.sqf) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_values", "_objects"]; +_values params ["_variation", "_size", "_dud", "_actDist", "_expDist", "_isDms", "_selectedSides"]; + +private _sides = [-1, -1, -1, -1]; +{ + private _id = [_x] call BIS_fnc_sideID; + _sides set [_id, _id]; +} forEach _selectedSides; + +{ + [_x, _variation, _dud, _size, _actDist, _expDist, _sides, _isDms] call FUNC(makeSuicideBomber); +} forEach _objects; diff --git a/addons/modules/functions/fnc_zenConfirmTraining.sqf b/addons/modules/functions/fnc_zenConfirmTraining.sqf new file mode 100644 index 00000000..702e26fa --- /dev/null +++ b/addons/modules/functions/fnc_zenConfirmTraining.sqf @@ -0,0 +1,32 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Confirm handler for the ZEN "Spawn Training IED" dialog. + * Uses the same iedd_ied_training server event as fnc_resetAction.sqf. + * + * Arguments: + * 0: Dialog return values + * 1: Position (ASL, passed through from fnc_zenOpenTrainingDialog.sqf) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_values", "_position"]; +_values params ["_type", "_variation"]; + +private _varData = "getText (_x >> 'name') isEqualTo localize 'STR_iedd_ied_Name_Random'" configClasses (configFile >> "CfgVehicles" >> _type >> "Attributes" >> "iedd_ied_variation" >> "Values") apply {getNumber (_x >> 'value')}; +private _random = _varData select 0; +if (_variation == _random) then { + _variation = floor (random _random); +}; + +// The iedd_ied_training event handler also calls setPosATL after createVehicle, which requires +// a 3-element array (unlike createVehicle's 2-element auto-snap) - convert to ATL and zero the +// height instead, which still lands exactly on the surface without erroring on the setPosATL call +_position = ASLToATL _position; +_position set [2, 0]; + +[QEGVAR(ied,training), [_type, _position, _variation, 0, [[0,1,0],[0,0,1]]]] call CBA_fnc_serverEvent; diff --git a/addons/modules/functions/fnc_zenDigUpIed.sqf b/addons/modules/functions/fnc_zenDigUpIed.sqf new file mode 100644 index 00000000..a495f825 --- /dev/null +++ b/addons/modules/functions/fnc_zenDigUpIed.sqf @@ -0,0 +1,23 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * ZEN context menu statement: digs up (unburies) the selected/hovered, buried IED(s). + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +private _matched = _objects select { + (typeOf _x in (IEDD_CLASSES + IEDD_FAKE_CLASSES)) && + {_x getVariable [QEGVAR(ied,isBury), false]} +}; +if (_matched isEqualTo []) exitWith {}; + +[QEGVAR(ied,setBury), [_matched, 0]] call CBA_fnc_serverEvent; diff --git a/addons/modules/functions/fnc_zenExplodeIed.sqf b/addons/modules/functions/fnc_zenExplodeIed.sqf new file mode 100644 index 00000000..c1c784ad --- /dev/null +++ b/addons/modules/functions/fnc_zenExplodeIed.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * ZEN context menu statement: force-explodes the selected/hovered IED(s), ignoring dud/timer state. + * Mirrors fnc_moduleExplode.sqf, retargeted at the ZEN selection instead of an attached logic. + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +{ + [QGVAR(explode), [_x]] call CBA_fnc_serverEvent; +} forEach (_objects select {typeOf _x in IEDD_CLASSES}); diff --git a/addons/modules/functions/fnc_zenForceDefuseIed.sqf b/addons/modules/functions/fnc_zenForceDefuseIed.sqf new file mode 100644 index 00000000..53cb6b5d --- /dev/null +++ b/addons/modules/functions/fnc_zenForceDefuseIed.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * ZEN context menu statement: marks the selected/hovered IED(s) as defused, + * skipping the wire-cutting sequence. See EFUNC(ied,forceDefuse). + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +private _matched = _objects select {typeOf _x in IEDD_CLASSES}; +if (_matched isEqualTo []) exitWith {}; + +[QEGVAR(ied,forceDefuse), [_matched, player]] call CBA_fnc_serverEvent; diff --git a/addons/modules/functions/fnc_zenOpenBuryDialog.sqf b/addons/modules/functions/fnc_zenOpenBuryDialog.sqf new file mode 100644 index 00000000..b4b2711b --- /dev/null +++ b/addons/modules/functions/fnc_zenOpenBuryDialog.sqf @@ -0,0 +1,41 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Opens the ZEN "Bury IED" parameter dialog for the selected/hovered, not-yet-buried IED(s). + * Exposes the same pitch/roll/yaw/depth controls as the interactive Zeus "Bury IED" module, + * applied in one shot on confirm instead of live-previewed while dragging. + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +private _matched = _objects select { + (typeOf _x in (IEDD_CLASSES + IEDD_FAKE_CLASSES)) && + {!(_x getVariable [QEGVAR(ied,isBury), false])} && + {_x call EFUNC(ied,canBuryIED)} +}; +if (_matched isEqualTo []) exitWith {}; + +private _reference = _matched select 0; +(_reference call BIS_fnc_getPitchBank) params ["_pitch", "_roll"]; +private _yaw = [getDir _reference] call CBA_fnc_simplifyAngle180; + +[ + localize ELSTRING(ied,IsBury), + [ + ["SLIDER", [LSTRING(Pitch)], [-180, 180, _pitch]], + ["SLIDER", [LSTRING(Roll)], [-180, 180, _roll]], + ["SLIDER", [LSTRING(Yaw)], [-180, 180, _yaw]], + ["SLIDER", [LSTRING(Depth)], [0, 20, 10]] + ], + FUNC(zenConfirmBury), + {}, + _matched +] call zen_dialog_fnc_create; diff --git a/addons/modules/functions/fnc_zenOpenSuicideDialog.sqf b/addons/modules/functions/fnc_zenOpenSuicideDialog.sqf new file mode 100644 index 00000000..82f2b83a --- /dev/null +++ b/addons/modules/functions/fnc_zenOpenSuicideDialog.sqf @@ -0,0 +1,67 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Opens the ZEN "Make Suicide Bomber" parameter dialog for the selected/hovered, + * eligible unit(s). Mirrors the interactive Zeus "Set Suicide" module's controls. + * + * Arguments: + * 0: Objects + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects"]; + +private _matched = _objects select { + (_x isKindOf "CAManBase") && + {alive _x} && + {!(_x getVariable [QEGVAR(ied,isCharge), false])} +}; +if (_matched isEqualTo []) exitWith {}; + +private _reference = _matched select 0; +private _defaultSides = [west, east, independent, civilian] - [side group _reference]; + +[ + localize LSTRING(Zeus_Suicide), + [ + ["COMBO", [LSTRING(Zeus_Variation), LSTRING(Zeus_Ied_Var_Tooltip)], [ + [0, 1, 2, 3, 4, 5], + [ + ELSTRING(ied,Variation_1), + ELSTRING(ied,Variation_2), + ELSTRING(ied,Variation_3), + ELSTRING(ied,Variation_4), + ELSTRING(ied,Variation_5), + ELSTRING(ied,Name_Random) + ], + 5 + ]], + ["COMBO", [LSTRING(Zeus_Size), LSTRING(Zeus_Size_Tooltip)], [ + [0, 1, 2, 3, 4], + [ + ELSTRING(ied,Name_Tiny), + ELSTRING(ied,Name_Small), + ELSTRING(ied,Name_Medium), + ELSTRING(ied,Name_Large), + ELSTRING(ied,Name_Random) + ], + 2 + ]], + ["SLIDER:PERCENT", [LSTRING(Zeus_Dud_Category)], [0, 1, 0]], + ["SLIDER", [LSTRING(Zeus_Act_Category), ELSTRING(ied,DistanceActivate_Tooltip)], [0, 1000, 300]], + ["SLIDER", [LSTRING(Zeus_Exp_Category), ELSTRING(ied,DistanceExplosion_Tooltip)], [0, 50, 15]], + ["COMBO", [LSTRING(Zeus_Dms_Category), ELSTRING(ied,isDeadManSwitch_Description)], [ + [0, 1], + [ELSTRING(ied,Name_Disabled), ELSTRING(ied,Name_Enabled)], + 0 + ]], + ["SIDES", [LSTRING(Zeus_Sides_Category), ELSTRING(ied,Sides_Description)], _defaultSides] + ], + FUNC(zenConfirmSuicide), + {}, + _matched +] call zen_dialog_fnc_create; diff --git a/addons/modules/functions/fnc_zenOpenTrainingDialog.sqf b/addons/modules/functions/fnc_zenOpenTrainingDialog.sqf new file mode 100644 index 00000000..cf865e9a --- /dev/null +++ b/addons/modules/functions/fnc_zenOpenTrainingDialog.sqf @@ -0,0 +1,43 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Opens the ZEN "Spawn Training IED" parameter dialog for the given position. + * Training IEDs are non-lethal - failed disarms pop a smoke instead of exploding. + * + * Arguments: + * 0: Position (ASL, as captured by the ZEN context menu click) + * + * Return Value: + * None + * + * Public: No + */ + +params ["_position"]; + +private _types = call FUNC(zenTrainingIedTypes); +private _typeValues = _types apply {_x select 0}; +private _typeLabels = _types apply {_x select 1}; + +[ + localize LSTRING(Zeus_Place_Training_Ied), + [ + ["COMBO", [LSTRING(Zeus_Type), LSTRING(Zeus_Type_Tooltip)], [_typeValues, _typeLabels, 0]], + ["COMBO", [LSTRING(Zeus_Variation), LSTRING(Zeus_Ied_Var_Tooltip)], [ + [0, 1, 2, 3, 4, 5, 6], + [ + ELSTRING(ied,Variation_1), + ELSTRING(ied,Variation_2), + ELSTRING(ied,Variation_3), + ELSTRING(ied,Variation_4), + ELSTRING(ied,Variation_5), + ELSTRING(ied,Variation_X), + ELSTRING(ied,Name_Random) + ], + 6 + ]] + ], + FUNC(zenConfirmTraining), + {}, + _position +] call zen_dialog_fnc_create; diff --git a/addons/modules/functions/fnc_zenRegisterActions.sqf b/addons/modules/functions/fnc_zenRegisterActions.sqf index 32c50b43..71ee801d 100644 --- a/addons/modules/functions/fnc_zenRegisterActions.sqf +++ b/addons/modules/functions/fnc_zenRegisterActions.sqf @@ -13,15 +13,110 @@ * Public: No */ -private _category = ["IEDD", "IEDD", [QPATHTOF(ui\moduleicon.paa)]] call zen_context_menu_fnc_createAction; +private _category = ["IEDD", "IEDD", [QPATHTOF(ui\moduleicon.paa)], {}, {GVAR(zenContextMenuEnabled)}] call zen_context_menu_fnc_createAction; private _categoryPath = [_category, [], 50] call zen_context_menu_fnc_addAction; +private _fnc_hasIed = {_objects findIf {typeOf _x in IEDD_CLASSES} != -1}; +private _fnc_onEmptyGround = {isNull _hoveredEntity}; + private _placeIed = [ "PlaceIED", localize LSTRING(Zeus_Place_Ied), "", {[_position] call FUNC(zenOpenPlaceDialog)}, - {GVAR(zenContextMenuEnabled)} + _fnc_onEmptyGround ] call zen_context_menu_fnc_createAction; - [_placeIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _activateIed = [ + "ActivateIED", + localize LSTRING(Zeus_Active), + "", + {[_objects] call FUNC(zenActivateIed)}, + _fnc_hasIed +] call zen_context_menu_fnc_createAction; +[_activateIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _explodeIed = [ + "ExplodeIED", + localize LSTRING(Zeus_Explode), + "", + {[_objects] call FUNC(zenExplodeIed)}, + _fnc_hasIed +] call zen_context_menu_fnc_createAction; +[_explodeIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _forceDefuseIed = [ + "ForceDefuseIED", + localize LSTRING(Zeus_ForceDefuse), + "", + {[_objects] call FUNC(zenForceDefuseIed)}, + _fnc_hasIed +] call zen_context_menu_fnc_createAction; +[_forceDefuseIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _fnc_hasUnburiedIed = {_objects findIf {(typeOf _x in (IEDD_CLASSES + IEDD_FAKE_CLASSES)) && {!(_x getVariable [QEGVAR(ied,isBury), false])}} != -1}; +private _fnc_hasBuriedIed = {_objects findIf {(typeOf _x in (IEDD_CLASSES + IEDD_FAKE_CLASSES)) && {_x getVariable [QEGVAR(ied,isBury), false]}} != -1}; + +private _buryIed = [ + "BuryIED", + localize ELSTRING(ied,IsBury), + "", + {[_objects] call FUNC(zenOpenBuryDialog)}, + _fnc_hasUnburiedIed +] call zen_context_menu_fnc_createAction; +[_buryIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _digUpIed = [ + "DigUpIED", + localize ELSTRING(ied,DigUp_DisplayName), + "", + {[_objects] call FUNC(zenDigUpIed)}, + _fnc_hasBuriedIed +] call zen_context_menu_fnc_createAction; +[_digUpIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _placeTrainingIed = [ + "PlaceTrainingIED", + localize LSTRING(Zeus_Place_Training_Ied), + "", + {[_position] call FUNC(zenOpenTrainingDialog)}, + _fnc_onEmptyGround +] call zen_context_menu_fnc_createAction; +[_placeTrainingIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _fnc_hasTrainingIed = {_objects findIf {typeOf _x in IEDD_TRAINING_CLASSES} != -1}; + +private _resetTrainingIed = [ + "ResetTrainingIED", + localize LSTRING(Zeus_ResetTrainingIED), + "", + {}, + _fnc_hasTrainingIed +] call zen_context_menu_fnc_createAction; +private _resetTrainingIedPath = [_resetTrainingIed, _categoryPath, 0] call zen_context_menu_fnc_addAction; + +private _resetTrainingRandom = [ + "Random", + localize ELSTRING(ied,Random_DisplayName), + "", + {[_objects, true] call FUNC(zenResetTrainingIed)} +] call zen_context_menu_fnc_createAction; +[_resetTrainingRandom, _resetTrainingIedPath, 0] call zen_context_menu_fnc_addAction; + +private _resetTrainingKeep = [ + "Keep", + localize ELSTRING(ied,Keep_DisplayName), + "", + {[_objects, false] call FUNC(zenResetTrainingIed)} +] call zen_context_menu_fnc_createAction; +[_resetTrainingKeep, _resetTrainingIedPath, 0] call zen_context_menu_fnc_addAction; + +private _makeSuicideBomber = [ + "MakeSuicideBomber", + localize LSTRING(Zeus_Suicide), + "", + {[_objects] call FUNC(zenOpenSuicideDialog)}, + {_objects findIf {(_x isKindOf "CAManBase") && {alive _x} && {!(_x getVariable [QEGVAR(ied,isCharge), false])}} != -1} +] call zen_context_menu_fnc_createAction; +[_makeSuicideBomber, _categoryPath, 0] call zen_context_menu_fnc_addAction; diff --git a/addons/modules/functions/fnc_zenResetTrainingIed.sqf b/addons/modules/functions/fnc_zenResetTrainingIed.sqf new file mode 100644 index 00000000..57fefe6c --- /dev/null +++ b/addons/modules/functions/fnc_zenResetTrainingIed.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * ZEN context menu statement: resets the selected/hovered training IED(s), + * reusing the same rearm logic as the player-facing "Reset" interact action. + * + * Arguments: + * 0: Objects + * 1: Use random variation + * + * Return Value: + * None + * + * Public: No + */ + +params ["_objects", "_useRandom"]; + +{ + [_x, _useRandom] call EFUNC(ied,resetAction); +} forEach (_objects select {typeOf _x in IEDD_TRAINING_CLASSES}); diff --git a/addons/modules/functions/fnc_zenTrainingIedTypes.sqf b/addons/modules/functions/fnc_zenTrainingIedTypes.sqf new file mode 100644 index 00000000..4c4d4a11 --- /dev/null +++ b/addons/modules/functions/fnc_zenTrainingIedTypes.sqf @@ -0,0 +1,25 @@ +#include "..\script_component.hpp" +/* + * Author: IEDD + * Returns the training IED types available for placement via the ZEN context menu. + * + * Arguments: + * None + * + * Return Value: + * Array of [Class Name , Display Name ] + * + * Public: No + */ + +[ + [QEGVAR(ied,Training_CanisterPlastic), ELSTRING(ied,Training_PlasticCanister_DisplayName)], + [QEGVAR(ied,Training_CanisterFuel), ELSTRING(ied,Training_FuelCanister_DisplayName)], + [QEGVAR(ied,Training_Cardboard), ELSTRING(ied,Training_Cardboard_DisplayName)], + [QEGVAR(ied,Training_Cinder), ELSTRING(ied,Training_Cinder_DisplayName)], + [QEGVAR(ied,Training_Barrel), ELSTRING(ied,Training_Barrel_DisplayName)], + [QEGVAR(ied,Training_Barrel_Grey), ELSTRING(ied,Training_BarrelGrey_DisplayName)], + [QEGVAR(ied,Training_Metal), ELSTRING(ied,Training_MetalBarrel_DisplayName)], + [QEGVAR(ied,Training_Metal_English), ELSTRING(ied,Training_MetalBarrelEnglish_DisplayName)], + [QEGVAR(ied,Training_Bucket), ELSTRING(ied,Training_Bucket_DisplayName)] +] diff --git a/addons/modules/initSettings.inc.sqf b/addons/modules/initSettings.inc.sqf index 81b7dabb..e436fa26 100644 --- a/addons/modules/initSettings.inc.sqf +++ b/addons/modules/initSettings.inc.sqf @@ -1,10 +1,13 @@ -[ - QGVAR(zenContextMenuEnabled), - "CHECKBOX", - [LSTRING(ZenContextMenuEnabled), LSTRING(ZenContextMenuEnabled_Description)], - [localize "STR_iedd_main_Category_Main", "Zeus Enhanced"], - true, - true, - {}, - false -] call CBA_fnc_addSetting; +if ("zen_main" call cba_fnc_isModLoaded) then { + [ + QGVAR(zenContextMenuEnabled), + "CHECKBOX", + [LSTRING(ZenContextMenuEnabled), LSTRING(ZenContextMenuEnabled_Description)], + [localize "STR_iedd_main_Category_Main", "Zeus Enhanced"], + true, + true, + {}, + false + ] call CBA_fnc_addSetting; +}; + diff --git a/addons/modules/stringtable.xml b/addons/modules/stringtable.xml index 418dfa8c..e913e935 100644 --- a/addons/modules/stringtable.xml +++ b/addons/modules/stringtable.xml @@ -240,6 +240,10 @@ Explode IED Explode IED + + Force Defuse + Force Defuse + GET IN GET IN @@ -260,6 +264,10 @@ Place IED Place IED + + Place Training IED + Place Training IED + Add VBIED Add VBIED @@ -272,6 +280,10 @@ Set position for VBIED. Set position for VBIED. + + Reset Training IED + Reset Training IED + ACTIVED BY SIDE ACTIVED BY SIDE