mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Javelin fixed and firing TDA terminal kill. Direct selection needs to be completed.
This commit is contained in:
@ -2,3 +2,6 @@
|
|||||||
|
|
||||||
PREP(fired);
|
PREP(fired);
|
||||||
PREP(onGetLockedTarget);
|
PREP(onGetLockedTarget);
|
||||||
|
|
||||||
|
PREP(translateToWeaponSpace);
|
||||||
|
PREP(translateToModelSpace);
|
@ -6,18 +6,43 @@ PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
|||||||
|
|
||||||
FUNC(guidance_Javelin_LOBL_HI_PFH) = {
|
FUNC(guidance_Javelin_LOBL_HI_PFH) = {
|
||||||
TRACE_1("enter", _this);
|
TRACE_1("enter", _this);
|
||||||
|
private["_pitch", "_yaw", "_wentTerminal", "_target", "_targetPos", "_curVelocity", "_missile" ];
|
||||||
_args = _this select 0;
|
_args = _this select 0;
|
||||||
//PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
//PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||||
_shooter = _args select 0;
|
_shooter = _args select 0;
|
||||||
_missile = _args select 6;
|
_missile = _args select 6;
|
||||||
|
|
||||||
|
if((count _this) > 2) then {
|
||||||
|
_wentTerminal = _this select 2;
|
||||||
|
} else {
|
||||||
|
_this set[2, false];
|
||||||
|
_wentTerminal = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if((count _this) > 3) then {
|
||||||
|
_targets = _this select 3;
|
||||||
|
_target = _targets select 0;
|
||||||
|
_targetPos = _targets select 1;
|
||||||
|
} else {
|
||||||
|
_this set[3, [GVAR(currentTarget),GVAR(currentTargetPos)] ];
|
||||||
|
_target = GVAR(currentTarget);
|
||||||
|
_targetPos = GVAR(currentTargetPos);
|
||||||
|
};
|
||||||
|
|
||||||
_curVelocity = velocity _missile;
|
_curVelocity = velocity _missile;
|
||||||
|
|
||||||
if(!alive _missile || isNull _missile || isNull _shooter) exitWith {
|
if(!alive _missile || isNull _missile) exitWith {
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_2("Setting launch parameters", GVAR(currentTarget), GVAR(currentTargetPos));
|
|
||||||
_target = GVAR(currentTarget);
|
_launchPos = _shooter getVariable [QGVAR(launchPos), nil];
|
||||||
|
if(isNil "_launchPos") then {
|
||||||
|
TRACE_1("Setting launch parameters", "");
|
||||||
|
_launchPos = getPosASL _shooter;
|
||||||
|
_shooter setVariable [QGVAR(launchPos), _launchPos, false];
|
||||||
|
_shooter setVariable [QGVAR(launchTime), diag_tickTime, false];
|
||||||
|
};
|
||||||
|
|
||||||
_addHeight = [0,0,0];
|
_addHeight = [0,0,0];
|
||||||
if(!isNil "_target") then {
|
if(!isNil "_target") then {
|
||||||
@ -28,37 +53,28 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
|
|||||||
|
|
||||||
_missilePos = getPosASL _missile;
|
_missilePos = getPosASL _missile;
|
||||||
// player sideChat "G!";
|
// player sideChat "G!";
|
||||||
_targetPos = GVAR(currentTargetPos);
|
|
||||||
|
|
||||||
TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos));
|
TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos));
|
||||||
if((count _targetPos) > 0) then {
|
if((count _targetPos) > 0) then {
|
||||||
_distanceToTarget = _missilePos vectorDistance _targetPos;
|
_distanceToTarget = [(_missilePos select 0), (_missilePos select 1), (_targetPos select 2)] vectorDistance _targetPos;
|
||||||
|
|
||||||
_defPitch = 0.05;
|
_defPitch = 0.25;
|
||||||
|
|
||||||
if((_launchPos distance _missilePos) < 400 && (_targetPos distance _missilePos) > 400) then {
|
if( (_missilePos select 2) < (_targetPos select 2) + 160 && !_wentTerminal) then {
|
||||||
_addHeight = [0,0,(_targetPos select 2) + ((_launchPos distance _targetPos)*2)];
|
_addHeight = [0,0,(_targetPos select 2) + ( (_distanceToTarget * 2) + 160)];
|
||||||
TRACE_1("Climb phase", _addHeight);
|
TRACE_1("Climb phase", _addHeight);
|
||||||
//_defPitch = 0.1;
|
|
||||||
} else {
|
} else {
|
||||||
// Covered half the distance, go terminal
|
_wentTerminal = true;
|
||||||
if((_missilePos distance _targetPos) < (_launchPos distance _targetPos) / 2) then {
|
_this set[2, _wentTerminal];
|
||||||
TRACE_1("TERMINAL", "");
|
TRACE_1("TERMINAL", "");
|
||||||
} else {
|
|
||||||
if((_missilePos select 2) > (_targetPos select 2)) then {
|
|
||||||
_heightDiff = (_missilePos select 2) - (_targetPos select 2);
|
|
||||||
TRACE_1("Coasting", _heightDiff);
|
|
||||||
_addHeight = [0,0, _heightDiff];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
_targetPos = _targetPos vectorAdd _addHeight;
|
_targetPos = _targetPos vectorAdd _addHeight;
|
||||||
|
|
||||||
_defYaw = 0.0035;
|
_defYaw = 0.0035;
|
||||||
|
|
||||||
|
|
||||||
_targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace);
|
_targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace);
|
||||||
_yaw = 0.0;
|
_yaw = 0.0;
|
||||||
|
TRACE_5("", _missile, _xVec, _yVec, _zVec, _targetPos);
|
||||||
if((_targetVectorSeeker select 0) < 0) then {
|
if((_targetVectorSeeker select 0) < 0) then {
|
||||||
_yaw = -_defYaw;
|
_yaw = -_defYaw;
|
||||||
} else {
|
} else {
|
||||||
@ -75,6 +91,9 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
|
|||||||
_pitch = _defPitch;
|
_pitch = _defPitch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TRACE_3("", _targetVectorSeeker, _pitch, _yaw);
|
||||||
|
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]];
|
drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]];
|
||||||
|
|
||||||
@ -95,9 +114,11 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(accTime > 0) then {
|
if(accTime > 0) then {
|
||||||
|
TRACE_5("", _xVec, _yVec, _zVec, _yaw, _pitch);
|
||||||
_outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
|
_outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
|
||||||
|
|
||||||
_vectorTo = _missilePos vectorFromTo _outVector;
|
_vectorTo = _missilePos vectorFromTo _outVector;
|
||||||
|
TRACE_3("", _missile, _outVector, _vectorTo);
|
||||||
_missile setVectorDirAndUp [_vectorTo, vectorUp _missile];
|
_missile setVectorDirAndUp [_vectorTo, vectorUp _missile];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -116,7 +137,7 @@ FUNC(guidance_Javelin_LOBL_HI) = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if(!local _shooter) exitWith { false };
|
if(!local _shooter) exitWith { false };
|
||||||
if(_weapon == "launch_B_Titan_short_F") then {
|
if(_ammo == "M_Titan_AT") then {
|
||||||
_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION];
|
_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION];
|
||||||
|
|
||||||
switch (_fireMode select 0) do {
|
switch (_fireMode select 0) do {
|
||||||
|
16
addons/wep_javelin/functions/fnc_translateToModelSpace.sqf
Normal file
16
addons/wep_javelin/functions/fnc_translateToModelSpace.sqf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
_object = _this select 0;
|
||||||
|
_origin = getPosASL _object;
|
||||||
|
_matrix = _this select 1;
|
||||||
|
_xVec = _matrix select 0;
|
||||||
|
_yVec = _matrix select 1;
|
||||||
|
_zVec = _matrix select 2;
|
||||||
|
|
||||||
|
_offset = _this select 2;
|
||||||
|
|
||||||
|
_x = _offset select 0;
|
||||||
|
_y = _offset select 1;
|
||||||
|
_z = _offset select 2;
|
||||||
|
|
||||||
|
_out = (((_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y)) vectorAdd (_zVec vectorMultiply _z)) vectorAdd _origin;
|
||||||
|
|
||||||
|
_out;
|
23
addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf
Normal file
23
addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
_object = _this select 0;
|
||||||
|
_origin = getPosASL _object;
|
||||||
|
_matrix = _this select 1;
|
||||||
|
_xVec = _matrix select 0;
|
||||||
|
_yVec = _matrix select 1;
|
||||||
|
_zVec = _matrix select 2;
|
||||||
|
|
||||||
|
_offset = _this select 2;
|
||||||
|
|
||||||
|
_offset = _offset vectorDiff _origin;
|
||||||
|
|
||||||
|
_x = _offset select 0;
|
||||||
|
_y = _offset select 1;
|
||||||
|
_z = _offset select 2;
|
||||||
|
|
||||||
|
_out = [
|
||||||
|
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
|
||||||
|
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
|
||||||
|
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
|
||||||
|
];
|
||||||
|
|
||||||
|
_out;
|
Reference in New Issue
Block a user