From 34485e0de2c86a46a1147cbc4cf2034914739a94 Mon Sep 17 00:00:00 2001 From: tuntematonjr Date: Sun, 19 Mar 2023 11:07:41 +0200 Subject: [PATCH] Fix cancelation --- addons/firesupport/functions/fnc_firemission_end.sqf | 1 - addons/firesupport/functions/fnc_removeQueue.sqf | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/firesupport/functions/fnc_firemission_end.sqf b/addons/firesupport/functions/fnc_firemission_end.sqf index fc3df45..8963eb6 100644 --- a/addons/firesupport/functions/fnc_firemission_end.sqf +++ b/addons/firesupport/functions/fnc_firemission_end.sqf @@ -21,7 +21,6 @@ if (_nameList isEqualTo _name) then { _firemissions deleteAt 0; }; - _gunModule setVariable [QGVAR(firemissions), _firemissions, true]; _gunModule setVariable [QGVAR(is_firing), false, true]; _gunModule setVariable [QGVAR(status), "STR_tun_firesupport_status_free" call BIS_fnc_localize, true]; diff --git a/addons/firesupport/functions/fnc_removeQueue.sqf b/addons/firesupport/functions/fnc_removeQueue.sqf index a9c39fc..a508c98 100644 --- a/addons/firesupport/functions/fnc_removeQueue.sqf +++ b/addons/firesupport/functions/fnc_removeQueue.sqf @@ -45,14 +45,19 @@ if (_textQueue isEqualTo _firemissionText) then { if (_status isEqualTo ("STR_tun_firesupport_status_firing" call BIS_fnc_localize)) then { hintSilent ("STR_tun_firesupport_cancelMissions" call BIS_fnc_localize); [{ - _this params ["_gunModule", "_firemission"]; + _this params ["_gunModule", "_firemission", "_ammoModule"]; private _firemissions = _gunModule getVariable [QGVAR(firemissions), []]; private _value = _firemissions find _firemission; if (_value isNotEqualTo -1) then { _firemissions deleteAt _value; _gunModule setVariable [QGVAR(firemissions), _firemissions, true]; + if (count _firemissions isEqualTo 0) then { + _ammoModule setVariable ["reservedCount", 0, true]; + _gunModule setVariable [QGVAR(is_firing), false, true]; + _gunModule setVariable [QGVAR(status), "STR_tun_firesupport_status_free" call BIS_fnc_localize, true]; + }; }; - }, [_gunModule, _firemission], 20] call CBA_fnc_waitAndExecute; + }, [_gunModule, _firemission, _ammoModule], 20] call CBA_fnc_waitAndExecute; }; } else { _firemissions deleteAt _curSelected;