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,7 +92,17 @@ if (_detonator != "ACE_DeadManSwitch") then {
];
};
} else {
//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 {
TRACE_1("set, but missing in inventory",_connectedInventoryExplosive);
_unit setVariable [QGVAR(deadmanInvExplosive), "", true];
};
_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",
@ -104,15 +114,8 @@ if (_detonator != "ACE_DeadManSwitch") then {
[],
_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 {
TRACE_1("set, but missing in inventory",_connectedInventoryExplosive);
_unit setVariable [QGVAR(deadmanInvExplosive), "", true];
};
_connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
if (_connectedInventoryExplosive != "") then {
//Add the disconnect action
private _magConfig = configFile >> "CfgMagazines" >> _connectedInventoryExplosive;