mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
avoid having to compute distance when it's already passed as a parameter
This commit is contained in:
parent
2105bc18db
commit
a1e5931f4e
@ -19,7 +19,8 @@ _turret = _this select 1;
|
||||
|
||||
_distance = call FUNC(getRange);
|
||||
|
||||
if !(!GVAR(enabled) && [] call FUNC(canUseFCS)) exitWith {};
|
||||
if (GVAR(Enabled)) exitWith {};
|
||||
if !([] call FUNC(canUseFCS)) exitWith {};
|
||||
|
||||
GVAR(Enabled) = true;
|
||||
GVAR(Time) = time;
|
||||
|
@ -19,18 +19,22 @@ _turret = _this select 1;
|
||||
|
||||
_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||
|
||||
_distance = call FUNC(getRange);
|
||||
_distance = 0;
|
||||
if (count _this > 2) then {
|
||||
_distance = _this select 2;
|
||||
} else {
|
||||
_distance = call FUNC(getRange);
|
||||
if (_distance == 0) then {
|
||||
_distance = [
|
||||
getNumber (_turretConfig >> QGVAR(DistanceInterval)),
|
||||
getNumber (_turretConfig >> QGVAR(MaxDistance)),
|
||||
getNumber (_turretConfig >> QGVAR(MinDistance))
|
||||
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
||||
};
|
||||
};
|
||||
|
||||
_magazines = _vehicle magazinesTurret _turret;
|
||||
|
||||
if (_distance == 0) then {
|
||||
_distance = [
|
||||
getNumber (_turretConfig >> QGVAR(DistanceInterval)),
|
||||
getNumber (_turretConfig >> QGVAR(MaxDistance)),
|
||||
getNumber (_turretConfig >> QGVAR(MinDistance))
|
||||
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
||||
};
|
||||
|
||||
private ["_weaponDirection", "_angleTarget"];
|
||||
|
||||
_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets
|
||||
@ -45,10 +49,6 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr
|
||||
|
||||
_angleTarget = asin (_weaponDirection select 2);
|
||||
|
||||
if (count _this > 2) then {
|
||||
_distance = _this select 2;
|
||||
};
|
||||
|
||||
if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalculation))}) then {
|
||||
terminate GVAR(backgroundCalculation);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user