mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Reused already calculated initSpeed
This commit is contained in:
parent
4854b963db
commit
9641d306e6
@ -17,6 +17,7 @@
|
|||||||
params ["_vehicle","_turret","_distance","_angleTarget"];
|
params ["_vehicle","_turret","_distance","_angleTarget"];
|
||||||
TRACE_4("params",_vehicle,_turret,_distance,_angleTarget);
|
TRACE_4("params",_vehicle,_turret,_distance,_angleTarget);
|
||||||
|
|
||||||
|
private _FCSInitSpeed = [];
|
||||||
private _FCSMagazines = [];
|
private _FCSMagazines = [];
|
||||||
private _FCSElevation = [];
|
private _FCSElevation = [];
|
||||||
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||||
@ -64,6 +65,7 @@ private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret
|
|||||||
private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance];
|
private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance];
|
||||||
_offset = parseNumber _offset;
|
_offset = parseNumber _offset;
|
||||||
|
|
||||||
|
_FCSInitSpeed pushBack _initSpeed;
|
||||||
_FCSMagazines pushBack _magazine;
|
_FCSMagazines pushBack _magazine;
|
||||||
_FCSElevation pushBack _offset;
|
_FCSElevation pushBack _offset;
|
||||||
};
|
};
|
||||||
@ -71,5 +73,6 @@ private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret
|
|||||||
} count (_vehicle magazinesTurret _turret);
|
} count (_vehicle magazinesTurret _turret);
|
||||||
|
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic);
|
||||||
|
[_vehicle, format ["%1_%2", QGVAR(InitSpeed), _turret], _FCSInitSpeed] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
|
||||||
|
@ -19,14 +19,16 @@ private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines),
|
|||||||
|
|
||||||
if !(_magazine in _FCSMagazines) exitWith {};
|
if !(_magazine in _FCSMagazines) exitWith {};
|
||||||
|
|
||||||
|
private _FCSInitSpeed = _vehicle getVariable format ["%1_%2", QGVAR(InitSpeed), _turret];
|
||||||
private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret];
|
private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret];
|
||||||
|
|
||||||
// GET ELEVATION OFFSET OF CURRENT MAGAZINE
|
// GET ELEVATION OFFSET AND INITSPEED OF CURRENT MAGAZINE
|
||||||
private _offset = 0;
|
private _offset = 0;
|
||||||
|
private _initSpeed = 0;
|
||||||
{
|
{
|
||||||
if (_x == _magazine) exitWith {
|
if (_x == _magazine) exitWith {
|
||||||
_offset = _FCSElevation select _forEachIndex;
|
_offset = _FCSElevation select _forEachIndex;
|
||||||
|
_initSpeed = _FCSInitSpeed select _forEachIndex;
|
||||||
};
|
};
|
||||||
} forEach _FCSMagazines;
|
} forEach _FCSMagazines;
|
||||||
|
|
||||||
@ -35,9 +37,6 @@ private _zeroDistance = currentZeroing _gunner;
|
|||||||
if (_zeroDistance > 0) then {
|
if (_zeroDistance > 0) then {
|
||||||
private _weaponCombo = [_weapon, _magazine, _ammo, _zeroDistance];
|
private _weaponCombo = [_weapon, _magazine, _ammo, _zeroDistance];
|
||||||
if !(_weaponCombo isEqualTo (_gunner getVariable [QGVAR(lastWeaponCombo), []])) then {
|
if !(_weaponCombo isEqualTo (_gunner getVariable [QGVAR(lastWeaponCombo), []])) then {
|
||||||
// Hackish way of getting initSpeed. @todo: replace it by correct calculation and caching
|
|
||||||
private _initSpeed = vectorMagnitude velocity _projectile;
|
|
||||||
|
|
||||||
private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
||||||
private _antiOffset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, 0, _zeroDistance];
|
private _antiOffset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, 0, _zeroDistance];
|
||||||
_antiOffset = parseNumber _antiOffset;
|
_antiOffset = parseNumber _antiOffset;
|
||||||
|
Loading…
Reference in New Issue
Block a user