From 965e45a53c6010ecacb7676c8123c77377ac9046 Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 1 May 2015 10:25:33 +0200 Subject: [PATCH 1/2] Takes negative initSpeed values into account --- addons/fcs/functions/fnc_firedEH.sqf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 698a9bef22..1bdff913d4 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -44,9 +44,11 @@ _offset = 0; } forEach _FCSMagazines; // Correct velocity for weapons that have initVelocity -// @todo: Take into account negative initVelocities -_velocityCorrection = (vectorMagnitude velocity _projectile) - - getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); +_velocityCorrection = if (getNumber(configFile >> "CfgMagazines" >> _weapon >> "initSpeed") > 0) then { + (vectorMagnitude velocity _projectile) - getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed") +} else { + 0 +}; [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, -_velocityCorrection] call EFUNC(common,changeProjectileDirection); From 4c0bed609e2709a8b78f65c51b6e2ce4c9282761 Mon Sep 17 00:00:00 2001 From: ulteq Date: Fri, 1 May 2015 11:53:53 +0200 Subject: [PATCH 2/2] Fixed a typo --- addons/fcs/functions/fnc_firedEH.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 1bdff913d4..e8f58298d3 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -44,7 +44,7 @@ _offset = 0; } forEach _FCSMagazines; // Correct velocity for weapons that have initVelocity -_velocityCorrection = if (getNumber(configFile >> "CfgMagazines" >> _weapon >> "initSpeed") > 0) then { +_velocityCorrection = if (getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed") > 0) then { (vectorMagnitude velocity _projectile) - getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed") } else { 0