2018-12-07 02:27:30 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
|
|
|
* Author: Brandon (TCVM)
|
|
|
|
* Attack profile: Wire guided
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Seeker Target PosASL <ARRAY>
|
|
|
|
* 1: Guidance Arg Array <ARRAY>
|
|
|
|
* 2: Attack Profile State <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Missile Aim PosASL <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
2019-12-17 02:01:30 +00:00
|
|
|
* [[1,2,3], [], []] call ace_missileguidance_fnc_attackProfile_WIRE;
|
2018-12-07 02:27:30 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
|
|
|
|
_args params ["_firedEH"];
|
|
|
|
_firedEH params ["_shooter","","","","","","_projectile"];
|
2019-12-17 02:01:30 +00:00
|
|
|
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_crosshairOffset", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_distanceAheadOfMissile"];
|
2018-12-07 02:27:30 +00:00
|
|
|
|
|
|
|
private _projectilePos = getPosASL _projectile;
|
2019-12-17 02:01:30 +00:00
|
|
|
private _shooterPos = getPosASL _shooter;
|
2018-12-07 02:27:30 +00:00
|
|
|
|
2019-12-17 02:01:30 +00:00
|
|
|
private _distanceToProjectile = _shooterPos vectorDistanceSqr _projectilePos;
|
|
|
|
|
|
|
|
if ((_distanceToProjectile > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
|
2018-12-07 02:27:30 +00:00
|
|
|
// wire snap, random direction
|
|
|
|
if (_randomVector isEqualTo [0, 0, 0]) then {
|
|
|
|
_randomVector = RANDOM_VECTOR_3D vectorMultiply 300;
|
|
|
|
_attackProfileStateParams set [1, true];
|
|
|
|
_attackProfileStateParams set [2, _randomVector];
|
|
|
|
|
2019-11-05 18:14:33 +00:00
|
|
|
playSound3D ["a3\sounds_f\air\sfx\SL_rope_break.wss", objNull, false, AGLtoASL (_shooter modelToWorld _wireCutSource), 5, 1, 150];
|
2018-12-07 02:27:30 +00:00
|
|
|
};
|
2021-05-08 08:49:07 +00:00
|
|
|
private _randomDir = _projectilePos vectorAdd _randomVector;
|
|
|
|
_targetData set [0, _projectilePos vectorFromTo _randomDir];
|
|
|
|
_targetData set [2, _randomDir distance _projectilePos];
|
|
|
|
_randomDir
|
2018-12-07 02:27:30 +00:00
|
|
|
};
|
|
|
|
|
2019-12-17 02:01:30 +00:00
|
|
|
if (_seekerTargetPos isEqualTo [0, 0, 0] || { _distanceToProjectile < _seekerMinRangeSqr }) exitWith {
|
2021-08-02 23:32:35 +00:00
|
|
|
_projectilePos vectorAdd (_projectile vectorModelToWorld [0, 5, 5])
|
2018-12-07 02:27:30 +00:00
|
|
|
};
|
2021-05-08 09:00:51 +00:00
|
|
|
|
2021-04-21 00:11:44 +00:00
|
|
|
_seekerTargetPos vectorAdd _crosshairOffset
|
2018-12-07 02:27:30 +00:00
|
|
|
|