From 54150b93d0be516dc056690cd8a29cb5e774fccb Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:11:20 +0200 Subject: [PATCH] Explosives - Use detonator icon for consolidated detonate actions (#10394) --- .../functions/fnc_addDetonateActions.sqf | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 388b2cf7048..ddda60e4abd 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -19,7 +19,8 @@ params ["_unit", "_detonator"]; TRACE_2("params",_unit,_detonator); -private _range = getNumber (configFile >> "CfgWeapons" >> _detonator >> QGVAR(Range)); +private _detonatorConfig = configFile >> "CfgWeapons" >> _detonator; +private _range = getNumber (_detonatorConfig >> QGVAR(Range)); private _result = [_unit] call FUNC(getPlacedExplosives); private _children = []; @@ -32,20 +33,30 @@ private _explosivesList = []; _explosivesList pushBack _x; - _children pushBack + // Prevent consolidated detonate actions from having the same icon as consolidated place actions of the same explosive type + private _icon = if ( + EGVAR(interact_menu,consolidateSingleChild) && + {_detonator == GVAR(activeTrigger)} && + {count (_result select {(_x select 4) == getText (_detonatorConfig >> QGVAR(triggerType))}) < 2} + ) then { + getText (_detonatorConfig >> "picture") + } else { + getText (_item >> "picture") + }; + + _children pushBack [ [ - [ - format ["Explosive_%1", _forEachIndex], - _x select 2, - getText(_item >> "picture"), - {(_this select 2) call FUNC(detonateExplosive);}, - {true}, - {}, - [_unit,_range,_x,_detonator] - ] call EFUNC(interact_menu,createAction), - [], - _unit - ]; + format ["Explosive_%1", _forEachIndex], + _x select 2, + _icon, + {(_this select 2) call FUNC(detonateExplosive);}, + {true}, + {}, + [_unit,_range,_x,_detonator] + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; }; }; } forEach _result; @@ -81,7 +92,7 @@ if (_detonator != "ACE_DeadManSwitch") then { [ "Explosive_All", LLSTRING(DetonateAll), - getText (configFile >> "CfgWeapons" >> _detonator >> "picture"), + getText (_detonatorConfig >> "picture"), {(_this select 2) call FUNC(detonateExplosiveAll);}, {true}, {}, @@ -107,7 +118,7 @@ if (_detonator != "ACE_DeadManSwitch") then { [ "Explosive_All_Deadman", LLSTRING(DetonateAll), - getText (configFile >> "CfgWeapons" >> _detonator >> "picture"), + getText (_detonatorConfig >> "picture"), {[_player] call FUNC(onIncapacitated)}, {true} ] call EFUNC(interact_menu,createAction),