mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3119 from acemod/explosives_detonateAll
Add action to detonate all explosives on a detonator
This commit is contained in:
commit
e38a80a712
@ -28,6 +28,7 @@ PREP(canDefuse);
|
||||
PREP(canDetonate);
|
||||
PREP(defuseExplosive);
|
||||
PREP(detonateExplosive);
|
||||
PREP(detonateExplosiveAll);
|
||||
PREP(dialPhone);
|
||||
PREP(dialingPhone);
|
||||
|
||||
|
@ -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
|
||||
[
|
||||
[
|
||||
@ -40,13 +43,30 @@ _children = [];
|
||||
{(_this select 2) call FUNC(detonateExplosive);},
|
||||
{true},
|
||||
{},
|
||||
[ACE_player,_range,_x]
|
||||
[_unit,_range,_x]
|
||||
] call EFUNC(interact_menu,createAction),
|
||||
[],
|
||||
ACE_Player
|
||||
_unit
|
||||
];
|
||||
};
|
||||
};
|
||||
} forEach _result;
|
||||
|
||||
// Add action to detonate all explosives tied to the detonator
|
||||
if (count _explosivesList > 0) then {
|
||||
_children pushBack [
|
||||
[
|
||||
"Explosive_All",
|
||||
localize LSTRING(DetonateAll),
|
||||
getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"),
|
||||
{(_this select 2) call FUNC(detonateExplosiveAll);},
|
||||
{true},
|
||||
{},
|
||||
[_unit,_range,_explosivesList]
|
||||
] call EFUNC(interact_menu,createAction),
|
||||
[],
|
||||
_unit
|
||||
];
|
||||
};
|
||||
|
||||
_children
|
||||
|
@ -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;
|
||||
|
||||
|
27
addons/explosives/functions/fnc_detonateExplosiveAll.sqf
Normal file
27
addons/explosives/functions/fnc_detonateExplosiveAll.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: VKing
|
||||
* Causes the unit to detonate all passed explosives.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Range (-1 to ignore) <NUMBER>
|
||||
* 2: Explosives to detonate <ARRAY>
|
||||
* 0: Explosive <OBJECT>
|
||||
* 1: Fuse time <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, -1, [[c4,0.5]]] call ACE_Explosives_fnc_detonateExplosiveAll;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_range", "_explosivesList"];
|
||||
TRACE_3("Params",_unit,_range,_explosivesList);
|
||||
|
||||
{
|
||||
[_unit,_range,_x] call FUNC(detonateExplosive);
|
||||
} forEach _explosivesList;
|
@ -37,6 +37,12 @@
|
||||
<Portuguese>Detonar >></Portuguese>
|
||||
<Russian>Подрыв >></Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Explosives_DetonateAll">
|
||||
<English>Detonate All</English>
|
||||
<German>Zünden Alles</German>
|
||||
<Spanish>Detonar Todo</Spanish>
|
||||
<Russian>Подрыв всех</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Explosives_DetonateCode">
|
||||
<English>Explosive code: %1</English>
|
||||
<German>Sprengstoffcode: %1</German>
|
||||
|
Loading…
Reference in New Issue
Block a user