From 809b605a03a1bba993981143dd576cf39868018a Mon Sep 17 00:00:00 2001 From: bux Date: Sat, 23 Dec 2017 14:31:43 +0100 Subject: [PATCH 1/2] move code var to outer scope --- addons/explosives/functions/fnc_addCellphoneIED.sqf | 7 ++++++- addons/explosives/functions/fnc_onIncapacitated.sqf | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/explosives/functions/fnc_addCellphoneIED.sqf b/addons/explosives/functions/fnc_addCellphoneIED.sqf index beca3d3246c..88da983be9c 100644 --- a/addons/explosives/functions/fnc_addCellphoneIED.sqf +++ b/addons/explosives/functions/fnc_addCellphoneIED.sqf @@ -27,15 +27,18 @@ private _config = (_this select 3) select (count (_this select 3) - 1); private _requiredItems = getArray(_config >> "requires"); private _hasRequired = true; private _detonators = [_unit] call FUNC(getDetonators); + { if !(_x in _detonators) exitWith{ _hasRequired = false; }; } count _requiredItems; +private _code = ""; private _codeSet = false; + while {!_codeSet} do { - private _code = str(round (random 9999)); + _code = str(round (random 9999)); _count = 4 - count (toArray _code); while {_count > 0} do { _code = "0" + _code; @@ -43,9 +46,11 @@ while {!_codeSet} do { }; _codeSet = (count ([_code] call FUNC(getSpeedDialExplosive))) == 0; }; + if (isNil QGVAR(CellphoneIEDs)) then { GVAR(CellphoneIEDs) = []; }; + private _count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; _count = _count + 1; publicVariable QGVAR(CellphoneIEDs); diff --git a/addons/explosives/functions/fnc_onIncapacitated.sqf b/addons/explosives/functions/fnc_onIncapacitated.sqf index 6f9a9f498a7..cb819f56d92 100644 --- a/addons/explosives/functions/fnc_onIncapacitated.sqf +++ b/addons/explosives/functions/fnc_onIncapacitated.sqf @@ -19,6 +19,9 @@ params ["_unit"]; TRACE_1("params",_unit); +// close cellphone if open +closeDialog 0; + // Exit if no item: if (({_x == "ACE_DeadManSwitch"} count (items _unit)) == 0) exitWith {}; From fa1fdad7498319d6b307eeec924e9ab18ddc603e Mon Sep 17 00:00:00 2001 From: bux Date: Sat, 23 Dec 2017 17:42:39 +0100 Subject: [PATCH 2/2] run closeDialog only for the player --- addons/explosives/functions/fnc_onIncapacitated.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/explosives/functions/fnc_onIncapacitated.sqf b/addons/explosives/functions/fnc_onIncapacitated.sqf index cb819f56d92..7e2cb249cc0 100644 --- a/addons/explosives/functions/fnc_onIncapacitated.sqf +++ b/addons/explosives/functions/fnc_onIncapacitated.sqf @@ -19,8 +19,10 @@ params ["_unit"]; TRACE_1("params",_unit); -// close cellphone if open -closeDialog 0; +if (_unit == ace_player) then { + // close cellphone if open + closeDialog 0; +}; // Exit if no item: if (({_x == "ACE_DeadManSwitch"} count (items _unit)) == 0) exitWith {};