Javelin - Only run if weapon and ammo supported

This commit is contained in:
PabstMirror 2015-05-25 05:38:45 -05:00
parent 0452270380
commit c7d9074f3f

View File

@ -35,8 +35,17 @@ _soundTime = _args select 4;
_randomLockInterval = _args select 5; _randomLockInterval = _args select 5;
_fireDisabledEH = _args select 6; _fireDisabledEH = _args select 6;
_configs = configProperties [configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; private["_ammo", "_magazineConfig", "_weaponConfig"];
if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith { _weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
_magazineConfig = if ((currentMagazine _currentShooter) != "") then {
_ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo");
configProperties [(configFile >> "CfgAmmo" >> _ammo), "(configName _x) == 'ace_missileguidance'", false];
} else {
[]
};
//Only enable if both weapon and currentMagazine are enabled (bandaid to allow firing the "AP" missle)
if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1} || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith {
__JavelinIGUITargeting ctrlShow false; __JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;