fix: getGunner returns null object if pilot uses manual fire if no gunner is present

This commit is contained in:
commy2 2015-04-10 06:36:09 +02:00
parent 26d282c224
commit 105184ce88

View File

@ -16,8 +16,10 @@ private ["_vehicle", "_weapon"];
_vehicle = _this select 0;
_weapon = _this select 1;
// on foot
if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle}) exitWith {gunner _vehicle};
// inside vehicle
private "_gunner";
_gunner = objNull;
@ -27,4 +29,9 @@ _gunner = objNull;
};
} forEach allTurrets [_vehicle, true];
// ensure that at least the pilot is returned if there is no gunner
if (isManualFire _vehicle && {isNull _gunner}) then {
_gunner = driver _vehicle;
};
_gunner