fcs work around for weaponDirection with commander turrets

This commit is contained in:
commy2 2015-02-11 20:59:41 +01:00
parent 4695376f55
commit 0d3e103de1
2 changed files with 20 additions and 3 deletions

View File

@ -28,7 +28,15 @@ if (_distance == 0) then {
_distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
};
_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret);
_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets
if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then {
_weaponDirection = eyeDirection _vehicle;
};
if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets
_weaponDirection = [1,0,0];
};
GVAR(Position) = [
(getPos _vehicle select 0) + _distance * (_weaponDirection select 0),

View File

@ -21,7 +21,7 @@ _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call E
_distance = call FUNC(getRange);
_magazines = magazines _vehicle;
_magazines = _vehicle magazinesTurret _turret;
if (_distance == 0) then {
_distance = [
@ -33,7 +33,16 @@ if (_distance == 0) then {
private ["_weaponDirection", "_angleTarget"];
_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle;
_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets
if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then {
_weaponDirection = eyeDirection _vehicle;
};
if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets
_weaponDirection = [1,0,0];
};
_angleTarget = asin (_weaponDirection select 2);
if (count _this > 2) then {