Skip to content

Commit 2f1b149

Browse files
SpicyBagpipesrautamiekkaPabstMirror
authored
Missileguidance - Improve JDAM coordinate finding (#11231)
* Refactor GPS attack data retrieval logic * Fix turret pathing _player was ace_player, whereas you will need to be able to get UAVs too. * Return to old handling for pilot * Update addons/missileguidance/functions/fnc_gps_getAttackData.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Update addons/missileguidance/functions/fnc_gps_getAttackData.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Update addons/missileguidance/functions/fnc_gps_setupVehicle.sqf Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Update fnc_gps_getAttackData.sqf * Update addons/missileguidance/functions/fnc_gps_setupVehicle.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update addons/missileguidance/functions/fnc_gps_setupVehicle.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update fnc_gps_getAttackData.sqf * Update fnc_attackProfile_JDAM.sqf --------- Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
1 parent 49a7d45 commit 2f1b149

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

addons/missileguidance/functions/fnc_attackProfile_JDAM.sqf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ _gpsData params ["", "_impactAngle", "_attackDirection"];
2525
_targetData params ["_directionToTarget", "", "_distanceToTarget"];
2626
_flightParams params ["_pitchRate", "_yawRate"];
2727

28+
if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos}; // Handle dropping JDAM as dumb ordnance
29+
2830
if (_impactAngle <= 0) then {
2931
_impactAngle = 45; // immediate pitch over to attack
3032
};

addons/missileguidance/functions/fnc_gps_getAttackData.sqf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@
1616
*/
1717

1818
if (GVAR(gps_mode) isEqualTo "too") then {
19-
private _target = getPilotCameraTarget (vehicle ACE_PLAYER);
19+
private _focusOn = focusOn;
20+
private _vehFocusOn = vehicle _focusOn;
21+
private _target = getPilotCameraTarget _vehFocusOn;
2022
_target params ["_tracking", "_position", "_object"];
23+
if (driver _vehFocusOn isNotEqualTo _focusOn) then {
24+
_position = _vehFocusOn lockedCameraTo [focusOn call CBA_fnc_turretPath];
25+
if (_position isEqualType objNull) then { // lockedCameraTo has different return types, can be object as well as position.
26+
_position = getPosASL _position;
27+
} else {
28+
if isNil "_position" then { // lockedCameraTo can return nil if the camera is not locked
29+
_position = [0,0,0];
30+
};
31+
};
32+
};
2133
GVAR(gps_currentSettings) set [0, _position]
2234
};
2335

addons/missileguidance/functions/fnc_gps_setupVehicle.sqf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ _vehicle setVariable [QGVAR(gps_actionsAdded), true];
2222
TRACE_2("adding gps action",_player,typeOf _vehicle);
2323

2424
private _condition = {
25-
params ["_target", "_player"]; // _player may be the UAV AI
26-
27-
private _turretPath = _target unitTurret _player;;
25+
params ["_target"];
26+
27+
private _operator = if (isNull (ACE_controlledUAV select 0)) then {ACE_player} else {ACE_controlledUAV select 1};
28+
private _turretPath = _target unitTurret _operator;
2829
private _hasJDAM = (_target weaponsTurret _turretPath) findIf {
2930
private _weapon = _x;
3031
GVAR(gps_weapons) getOrDefaultCall [_weapon, {

0 commit comments

Comments
 (0)