mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Process all navigation onFired. Send the correct array to function
This commit is contained in:
parent
197c1a7cae
commit
de05c68f99
@ -57,10 +57,11 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
|
||||
};
|
||||
|
||||
_navigationType = (_navigationStateData select _currentState) select 1;
|
||||
_navigationFunction = getText (configFile >> QGVAR(NavigationTypes) >> _navigationType >> "functionName")
|
||||
};
|
||||
_navigationFunction = getText (configFile >> QGVAR(NavigationTypes) >> _navigationType >> "functionName");
|
||||
|
||||
|
||||
_navigationParameters = (_navigationStateData select _currentState) select 2;
|
||||
_stateParams set [4, _navigationParameters];
|
||||
};
|
||||
private _commandedAcceleration = [_args, _timestep, _seekerTargetPos, _profileAdjustedTargetPos, _targetData, _navigationParameters] call (missionNamespace getVariable _navigationFunction);
|
||||
|
||||
if (isNil "_commandedAcceleration") exitWith {
|
||||
|
@ -14,6 +14,11 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define STAGE_LAUNCH 1
|
||||
#define STAGE_CLIMB 2
|
||||
#define STAGE_COAST 3
|
||||
#define STAGE_TERMINAL 4
|
||||
|
||||
_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData", "_navigationStateData"];
|
||||
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||
_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
params ["_firedEH", "", "", "", "_stateParams"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "", "_navigationParams"];
|
||||
|
||||
private _ammoConfig = configOf _projectile;
|
||||
private _p = getNumber (_ammoConfig >> QUOTE(ADDON) >> "lineGainP");
|
||||
@ -27,11 +26,11 @@ if (_correctionDistance == 0) then {
|
||||
_correctionDistance = 1;
|
||||
};
|
||||
|
||||
_navigationParams set [0, _p];
|
||||
_navigationParams set [1, _i];
|
||||
_navigationParams set [2, _d];
|
||||
|
||||
_navigationParams set [3, 0];
|
||||
_navigationParams set [4, 0];
|
||||
_navigationParams set [5, _correctionDistance];
|
||||
private _navigationParams = [
|
||||
_p, _i, _d,
|
||||
0,
|
||||
0,
|
||||
_correctionDistance
|
||||
];
|
||||
_navigationParams
|
||||
|
||||
|
@ -38,5 +38,4 @@ private _commandedAcceleration = _zeroEffortMissNormal vectorMultiply (_navigati
|
||||
if (accTime > 0) then {
|
||||
_navigationParams set [0, [_lineOfSight]];
|
||||
};
|
||||
|
||||
_commandedAcceleration
|
||||
|
@ -131,7 +131,8 @@ if (_states isNotEqualTo []) then {
|
||||
private _stateClass = _navigationStateSubclass >> _x;
|
||||
_navigationStateData pushBack [
|
||||
getText (_stateClass >> "transitionCondition"),
|
||||
getText (_stateClass >> "navigationType")
|
||||
getText (_stateClass >> "navigationType"),
|
||||
[]
|
||||
];
|
||||
} forEach _states;
|
||||
};
|
||||
@ -184,10 +185,22 @@ if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
|
||||
_onFiredFunc = getText (configFile >> QGVAR(NavigationTypes) >> _navigationType >> "onFired");
|
||||
TRACE_1("navigation on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
if (_states isEqualTo []) then {
|
||||
_onFiredFunc = getText (configFile >> QGVAR(NavigationTypes) >> _navigationType >> "onFired");
|
||||
TRACE_1("navigation on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
private _navState = (_args call (missionNamespace getVariable _onFiredFunc));
|
||||
(_navigationStateData select 4) set [4, _navState];
|
||||
};
|
||||
} else {
|
||||
{
|
||||
_onFiredFunc = getText (configFile >> QGVAR(NavigationTypes) >> _x >> "onFired");
|
||||
TRACE_1("navigation on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
private _navState = (_args call (missionNamespace getVariable _onFiredFunc));
|
||||
(_navigationStateData select _forEachIndex) set [2, _navState];
|
||||
};
|
||||
} forEach getArray (_config >> "navigationTypes");
|
||||
};
|
||||
|
||||
// Run the "onFired" function passing the full guidance args array
|
||||
|
@ -18,7 +18,7 @@ params ["_firedEH", "", "", "", "_stateParams"];
|
||||
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||
_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
|
||||
_targetLaunchParams params ["_target", "_targetPos", "_launchPos"];
|
||||
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams"];
|
||||
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState"];
|
||||
_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
|
||||
|
||||
private _ammoConfig = configOf _projectile;
|
||||
@ -27,10 +27,10 @@ if (_navigationGain == 0) then {
|
||||
_navigationGain = 3;
|
||||
};
|
||||
|
||||
_navigationParams = [
|
||||
private _navigationParams = [
|
||||
[ // Last Missile Frame
|
||||
[0, 0, 0] // Last line of sight
|
||||
],
|
||||
_navigationGain // navigation gain of missile. Set in the navigation onFired function
|
||||
];
|
||||
_stateParams set [4, _navigationParams];
|
||||
_navigationParams
|
||||
|
Loading…
x
Reference in New Issue
Block a user