This commit is contained in:
Salluci 2023-07-14 00:37:27 +03:00
parent 87586459bc
commit ef93a61e13
2 changed files with 6 additions and 11 deletions

View File

@ -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);

View File

@ -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 = [];