Missile Guidance - Use weaponsInfo to optimize fire-mode selection (#8879)

This commit is contained in:
PabstMirror 2022-08-29 03:33:58 -05:00 committed by GitHub
parent 78f0262e10
commit 4eef2da0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,14 +78,13 @@ TRACE_4("",_currentFireMode,_nextFireMode,_index,_attackProfiles);
private _currentFireMode = if (_useModeForAttackProfile) then {
TRACE_2("setting fire mode",_weaponStateToken,_nextFireMode);
for "_weaponIndex" from 0 to 299 do {
ACE_player action ["SwitchWeapon", _currentShooter, ACE_player, _weaponIndex];
(weaponState _weaponStateToken) params ["_xWeapon", "", "_xMode"];
{
_x params ["_xIndex", "", "_xWeapon", "", "_xMode"];
if ((_xWeapon == _weapon) && {(getText (configFile >> "CfgWeapons" >> _weapon >> _xMode >> QGVAR(attackProfile))) == _nextFireMode}) exitWith {
TRACE_2("Restoring",_weaponIndex,weaponState _currentShooter);
ACE_player action ["SwitchWeapon", _currentShooter, ACE_player, _xIndex];
TRACE_2("Restoring",weaponState _currentShooter,_x);
};
if ((weaponState _weaponStateToken) isEqualTo ["","","","",0]) exitWith {ERROR_2("weaponState not found",_weapon,_nextFireMode);};
};
} forEach (ACE_player weaponsInfo [_weapon, false]);
} else {
TRACE_2("setVariable attackProfile",_currentShooter,_nextFireMode);
_currentShooter setVariable [QGVAR(attackProfile), _nextFireMode, false];