ACE3/addons/missileguidance/functions/fnc_fired.sqf

50 lines
2.1 KiB
Plaintext
Raw Normal View History

2015-04-08 15:01:39 +00:00
#define DEBUG_MODE_FULL
#include "script_component.hpp"
2015-04-08 15:19:19 +00:00
// Bail if guidance is disabled
if(!GVAR(enabled)) exitWith { false };
2015-04-08 15:01:39 +00:00
// Bail on locality of the projectile, it should be local to us
if(!local _projectile) exitWith { false };
2015-01-20 04:16:33 +00:00
2015-04-08 15:01:39 +00:00
private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"];
2015-04-08 15:19:19 +00:00
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
2015-04-07 05:38:34 +00:00
2015-04-08 15:01:39 +00:00
_config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance";
_enabled = getNumber ( _config >> "enabled");
2015-01-20 04:16:33 +00:00
2015-04-08 15:01:39 +00:00
// Bail if guidance is not enabled
if(isNil "_enabled" || {_enabled != 1}) exitWith { false };
2015-04-07 05:38:34 +00:00
2015-04-08 15:01:39 +00:00
_target = _shooter getVariable[QGVAR(target), nil];
_seekerType = _shooter getVariable [QGVAR(seekerType), nil];
_attackProfile = _shooter getVariable [QGVAR(attackProfile), nil];
if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then {
_seekerType = getText (_config >> "defaultSeekerType");
};
if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "attackProfiles" ) ) ) } ) then {
_attackProfile = getText (_config >> "defaultAttackProfile");
};
TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile);
[FUNC(guidancePFH), 0.1, [_this,
[ACE_player,
[_target, _targetPos, _launchPos],
_seekerType,
_attackProfile
],
[
getNumber ( _config >> "minDeflection" ),
getNumber ( _config >> "maxDeflection" ),
getNumber ( _config >> "incDeflection" )
],
[
getNumber ( _config >> "seekerAngle" ),
getNumber ( _config >> "seekerAccuracy" ),
getNumber ( _config >> "seekerMaxRange" )
]
]
] call cba_fnc_addPerFrameHandler;