From ef93a61e137e84960df3becd28c1b8c73efc0e80 Mon Sep 17 00:00:00 2001 From: Salluci Date: Fri, 14 Jul 2023 00:37:27 +0300 Subject: [PATCH] fix derp --- addons/csw/functions/fnc_ai_handleGetIn.sqf | 11 +---------- addons/csw/functions/fnc_ai_reload.sqf | 6 +++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/addons/csw/functions/fnc_ai_handleGetIn.sqf b/addons/csw/functions/fnc_ai_handleGetIn.sqf index f8d89c9796..af74d14a64 100644 --- a/addons/csw/functions/fnc_ai_handleGetIn.sqf +++ b/addons/csw/functions/fnc_ai_handleGetIn.sqf @@ -17,13 +17,4 @@ TRACE_3("getInEH:",_vehicle,_role,_gunner); if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {}; if (someAmmo _vehicle) exitWith {}; -// turret can be empty when AI is forcefully moved to the vehicle -if (_turret isEqualTo []) then { - _turret = (assignedVehicleRole _gunner) select 1; -}; - -// this doesn't handle multi-weapon turrets, need a "turretWeapon" event or a PFH to do that -private _weapon = (_vehicle weaponsTurret _turret) select 0; -TRACE_4("need ammo",someAmmo _vehicle,magazinesAllTurrets _vehicle,_turret,_weapon); - -[_vehicle, _gunner, _weapon] call FUNC(ai_reload); +[_vehicle, _gunner] call FUNC(ai_reload); diff --git a/addons/csw/functions/fnc_ai_reload.sqf b/addons/csw/functions/fnc_ai_reload.sqf index 4f4c066381..06bdb181a1 100644 --- a/addons/csw/functions/fnc_ai_reload.sqf +++ b/addons/csw/functions/fnc_ai_reload.sqf @@ -21,9 +21,13 @@ if (_loadableMagazines isEqualTo []) exitWith {TRACE_1("could not find reloadabl // API, to be used by artillerytables private _forcedMag = _vehicle getVariable [QGVAR(forcedMag), ""]; +private _turretIndex = [_gunner] call EFUNC(common,getTurretIndex); +if (_turretIndex isEqualTo []) then { + _turretIndex = [0]; +}; // If this is called while CSW has ammo, unload mags in gunner's turret -if (someAmmo _vehicle) then {[_vehicle, [_gunner] call EFUNC(common,getTurretIndex)] call FUNC(unloadMagazines)}; +if (someAmmo _vehicle) then {[_vehicle, _turretIndex] call FUNC(unloadMagazines)}; private _bestAmmo = 0; private _magazineInfo = [];