2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2016-10-12 22:35:24 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus / nou, PabstMirror
|
|
|
|
* Do seeker search
|
|
|
|
* Handles a nil/bad return and will attempt to use last known position if enabled on ammo
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 1: Guidance Arg Array <ARRAY>
|
|
|
|
* 3: Last known pos state array <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Missile Aim PosASL <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
2020-04-25 06:41:45 +00:00
|
|
|
* [[], [], []] call ace_missileguidance_fnc_doSeekerSearch;
|
2016-10-12 22:35:24 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
params ["", "_args", "", "_lastKnownPosState"];
|
|
|
|
_args params ["", "_launchParams"];
|
|
|
|
_launchParams params ["", "", "_seekerTypeName"];
|
|
|
|
_lastKnownPosState params ["_seekLastTargetPos", "_lastKnownPos"];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
private _seekerFunction = getText (configFile >> QGVAR(SeekerTypes) >> _seekerTypeName >> "functionName");
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
private _seekerTargetPos = _this call (missionNamespace getVariable _seekerFunction);
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-11-12 22:15:42 +00:00
|
|
|
if ((isNil "_seekerTargetPos") || {_seekerTargetPos isEqualTo [0,0,0]}) then { // A return of nil or [0,0,0] indicates the seeker has no target
|
2021-02-27 17:05:05 +00:00
|
|
|
if (_seekLastTargetPos && {_lastKnownPos isNotEqualTo [0,0,0]}) then { // if enabled for the ammo, use last known position if we have one stored
|
2016-10-12 22:35:24 +00:00
|
|
|
TRACE_2("seeker returned bad pos - using last known",_seekLastTargetPos,_lastKnownPos);
|
|
|
|
_seekerTargetPos = _lastKnownPos;
|
2016-11-12 22:15:42 +00:00
|
|
|
#ifdef DRAW_GUIDANCE_INFO
|
|
|
|
drawIcon3D ["\A3\ui_f\data\map\markers\military\unknown_CA.paa", [1,1,0,1], ASLtoAGL _lastKnownPos, 0.25, 0.25, 0, "LastKnownPos", 1, 0.02, "TahomaB"];
|
|
|
|
#endif
|
2016-10-12 22:35:24 +00:00
|
|
|
} else {
|
|
|
|
TRACE_1("seeker returned no pos",_seekerTargetPos);
|
|
|
|
_seekerTargetPos = [0,0,0];
|
|
|
|
};
|
|
|
|
} else {
|
2016-11-12 22:15:42 +00:00
|
|
|
if (_seekLastTargetPos) then { // if enabled for the ammo, store last known position
|
2016-10-12 22:35:24 +00:00
|
|
|
TRACE_1("saving current pos",_seekLastTargetPos);
|
|
|
|
_lastKnownPosState set [1, _seekerTargetPos];
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
#ifdef DRAW_GUIDANCE_INFO
|
|
|
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,1,0,1], ASLtoAGL _seekerTargetPos, 0.5, 0.5, 0, _seekerTypeName, 1, 0.025, "TahomaB"];
|
|
|
|
#endif
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
TRACE_2("return",_seekerTargetPos,_seekerTypeName);
|
|
|
|
_seekerTargetPos;
|