From cc8ac69feb4c188de3612e654d7b562c0c376507 Mon Sep 17 00:00:00 2001 From: VKing Date: Tue, 5 Jan 2016 23:40:27 +0100 Subject: [PATCH 1/5] Add function and action to detonate all explosives on a detonator --- addons/explosives/XEH_preInit.sqf | 1 + .../functions/fnc_addDetonateActions.sqf | 22 ++++++++++++++- .../functions/fnc_detonateExplosiveAll.sqf | 27 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 addons/explosives/functions/fnc_detonateExplosiveAll.sqf diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index 470cae661d..fec63776ff 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -28,6 +28,7 @@ PREP(canDefuse); PREP(canDetonate); PREP(defuseExplosive); PREP(detonateExplosive); +PREP(detonateExplosiveAll); PREP(dialPhone); PREP(dialingPhone); diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 04e78f0f82..e306b2fe30 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -19,18 +19,21 @@ params ["_unit", "_detonator"]; TRACE_2("params",_unit,_detonator); -private ["_result", "_item", "_children", "_range", "_required"]; +private ["_result", "_item", "_children", "_range", "_required","_explosivesList"]; _range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); _result = [_unit] call FUNC(getPlacedExplosives); _children = []; +_explosivesList = []; { if (!isNull(_x select 0)) then { _required = getArray (ConfigFile >> "ACE_Triggers" >> (_x select 4) >> "requires"); if (_detonator in _required) then { _item = ConfigFile >> "CfgMagazines" >> (_x select 3); + _explosivesList pushBack _x; + _children pushBack [ [ @@ -49,4 +52,21 @@ _children = []; }; } forEach _result; +// Add action to detonate all explosives tied to the detonator +if (count _explosivesList > 0) then { + _children pushBack [ + [ + "Explosive_All", + "Detonate All", + getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), + {(_this select 2) call FUNC(detonateExplosiveAll);}, + {true}, + {}, + [ACE_player,_range,_explosivesList] + ] call EFUNC(interact_menu,createAction), + [], + ACE_Player + ]; +}; + _children diff --git a/addons/explosives/functions/fnc_detonateExplosiveAll.sqf b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf new file mode 100644 index 0000000000..e1bc39cfd3 --- /dev/null +++ b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Causes the unit to detonate all passed explosives. + * + * Arguments: + * 0: Unit + * 1: Range (-1 to ignore) + * 2: Explosives to detonate + * 0: Explosive + * 1: Fuse time + * + * Return Value: + * None + * + * Example: + * [player, -1, "Command"] call ACE_Explosives_fnc_detonateExplosive; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_range", "_explosivesList"]; +TRACE_3("Params",_unit,_range,_explosivesList); + +{ + [_unit,_range,_x] call FUNC(detonateExplosive); +} forEach _explosivesList; From b6dce03c905ad305a582028f4b61f284a8e74c43 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 5 Jan 2016 17:16:47 -0600 Subject: [PATCH 2/5] Fix Header --- addons/explosives/functions/fnc_detonateExplosiveAll.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/explosives/functions/fnc_detonateExplosiveAll.sqf b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf index e1bc39cfd3..377dc0b93a 100644 --- a/addons/explosives/functions/fnc_detonateExplosiveAll.sqf +++ b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf @@ -13,7 +13,7 @@ * None * * Example: - * [player, -1, "Command"] call ACE_Explosives_fnc_detonateExplosive; + * [player, -1, [[c4,0.5]]] call ACE_Explosives_fnc_detonateExplosiveAll; * * Public: No */ From 4c229c92f54e67108a74064fd4ea4499378166ee Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 5 Jan 2016 17:29:01 -0600 Subject: [PATCH 3/5] Add Stringtable Entry --- addons/explosives/functions/fnc_addDetonateActions.sqf | 2 +- addons/explosives/stringtable.xml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index e306b2fe30..5529b2ebcd 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -57,7 +57,7 @@ if (count _explosivesList > 0) then { _children pushBack [ [ "Explosive_All", - "Detonate All", + localize LSTRING(DetonateAll), getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), {(_this select 2) call FUNC(detonateExplosiveAll);}, {true}, diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 6cf03d7be2..728eeb30c1 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -37,6 +37,12 @@ Detonar >> Подрыв >> + + Detonate All + Zünden Alles + Detonar Todo + Подрыв Все + Explosive code: %1 Sprengstoffcode: %1 From 9985988987c83e279b7fd001c01cd2a1036552ea Mon Sep 17 00:00:00 2001 From: VKing Date: Wed, 6 Jan 2016 18:05:06 +0100 Subject: [PATCH 4/5] Change ACE_Player to _unit --- addons/explosives/functions/fnc_addDetonateActions.sqf | 8 ++++---- addons/explosives/functions/fnc_addTransmitterActions.sqf | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 5529b2ebcd..2af4d6e772 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -43,10 +43,10 @@ _explosivesList = []; {(_this select 2) call FUNC(detonateExplosive);}, {true}, {}, - [ACE_player,_range,_x] + [_unit,_range,_x] ] call EFUNC(interact_menu,createAction), [], - ACE_Player + _unit ]; }; }; @@ -62,10 +62,10 @@ if (count _explosivesList > 0) then { {(_this select 2) call FUNC(detonateExplosiveAll);}, {true}, {}, - [ACE_player,_range,_explosivesList] + [_unit,_range,_explosivesList] ] call EFUNC(interact_menu,createAction), [], - ACE_Player + _unit ]; }; diff --git a/addons/explosives/functions/fnc_addTransmitterActions.sqf b/addons/explosives/functions/fnc_addTransmitterActions.sqf index 40ec8581d4..4397e743a0 100644 --- a/addons/explosives/functions/fnc_addTransmitterActions.sqf +++ b/addons/explosives/functions/fnc_addTransmitterActions.sqf @@ -33,10 +33,10 @@ _children = []; {}, {true}, {(_this select 2) call FUNC(addDetonateActions);}, - [ACE_player,_x] + [_unit,_x] ] call EFUNC(interact_menu,createAction), [], - ACE_Player + _unit ]; } forEach _detonators; From 099648b6b6183cccb0f87581d0fbf406cc5a0c62 Mon Sep 17 00:00:00 2001 From: VKing Date: Thu, 14 Jan 2016 18:51:14 +0100 Subject: [PATCH 5/5] Russian translation as suggested --- addons/explosives/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 728eeb30c1..166428f3d4 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -41,7 +41,7 @@ Detonate All Zünden Alles Detonar Todo - Подрыв Все + Подрыв всех Explosive code: %1