Explosives - Only add "detonate all" action for dead man switch when necessary (#10146)

Only add detonate all when necessary
This commit is contained in:
johnb432 2024-07-25 20:34:26 +02:00 committed by GitHub
parent e99d6d9381
commit b85150e6eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,19 +92,6 @@ if (_detonator != "ACE_DeadManSwitch") then {
];
};
} else {
//Add action to detonate all explosives (including the inventory explosive):
_children pushBack [
[
"Explosive_All_Deadman",
LLSTRING(DetonateAll),
getText (configFile >> "CfgWeapons" >> _detonator >> "picture"),
{[_player] call FUNC(onIncapacitated)},
{true}
] call EFUNC(interact_menu,createAction),
[],
_unit
];
//Adds actions for the explosives you can connect to the deadman switch.
private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
if ((_connectedInventoryExplosive != "") && {!(_connectedInventoryExplosive in (magazines _unit))}) then {
@ -113,6 +100,22 @@ if (_detonator != "ACE_DeadManSwitch") then {
};
_connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
//Add action to detonate all explosives (including the inventory explosive):
if (_connectedInventoryExplosive != "" || {count _explosivesList > 1}) then {
_children pushBack [
[
"Explosive_All_Deadman",
LLSTRING(DetonateAll),
getText (configFile >> "CfgWeapons" >> _detonator >> "picture"),
{[_player] call FUNC(onIncapacitated)},
{true}
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
if (_connectedInventoryExplosive != "") then {
//Add the disconnect action
private _magConfig = configFile >> "CfgMagazines" >> _connectedInventoryExplosive;