Allowed positive weapon initSpeed values

This commit is contained in:
ulteq 2015-05-01 18:55:44 +02:00
parent a42dec6760
commit aa21962f8b
2 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,7 @@
#include "script_component.hpp"
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile", "_velocityCorrection", "_sumVelocity"];
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile", "_sumVelocity"];
_vehicle = _this select 0;
_weapon = _this select 1;
@ -43,14 +43,8 @@ _offset = 0;
};
} forEach _FCSMagazines;
// Correct velocity for weapons that have initVelocity
_velocityCorrection = if (getNumber(configFile >> "CfgWeapons" >> _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);
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
// Remove the platform velocity
if( (vectorMagnitude velocity _vehicle) > 2) then {

View File

@ -87,6 +87,9 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
if (_initSpeedCoef < 0) then {
_initSpeed = _initSpeed * -_initSpeedCoef;
};
if (_initSpeedCoef > 0) then {
_initSpeed = _initSpeedCoef;
};
if (_simulationStep != 0) then {
private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"];
@ -171,6 +174,9 @@ _FCSElevation = [];
if (_initSpeedCoef < 0) then {
_initSpeed = _initSpeed * -_initSpeedCoef;
};
if (_initSpeedCoef > 0) then {
_initSpeed = _initSpeedCoef;
};
};
} forEach _weapons;