From 4ff8fc13ffff76725b77c0862abb2a87af751a77 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 13 Oct 2018 20:07:51 +0300 Subject: [PATCH] Fix turrets without weapon treated as gunner (#6636) --- addons/quickmount/functions/fnc_getInNearest.sqf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/quickmount/functions/fnc_getInNearest.sqf b/addons/quickmount/functions/fnc_getInNearest.sqf index f74e2838b1..8e8d77fe8d 100644 --- a/addons/quickmount/functions/fnc_getInNearest.sqf +++ b/addons/quickmount/functions/fnc_getInNearest.sqf @@ -70,13 +70,17 @@ if (!isNull _target && if ((!(_turretPath isEqualTo [])) && {_target lockedTurret _turretPath}) exitWith {TRACE_1("lockedTurret",_x);}; if (_effectiveRole == "turret") then { - if ((getNumber (([_target, _turretPath] call CBA_fnc_getTurret) >> "isCopilot")) == 1) exitWith { + private _turretConfig = [_target, _turretPath] call CBA_fnc_getTurret; + if (getNumber (_turretConfig >> "isCopilot") == 1) exitWith { _effectiveRole = "driver"; }; - if (_cargoIndex < 0) exitWith { - _effectiveRole = "gunner"; // door gunners / 2nd turret + if ( + _cargoIndex >= 0 // FFV + || {"" isEqualTo getText (_turretConfig >> "gun")} // turret without weapon + ) exitWith { + _effectiveRole = "cargo"; }; - _effectiveRole = "cargo"; // probably a FFV + _effectiveRole = "gunner"; // door gunners / 2nd turret }; TRACE_2("",_effectiveRole,_x); if (_effectiveRole != _desiredRole) exitWith {};