mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Change Dragon "onFired" to reflect missileGuidance changes
This commit is contained in:
parent
ebfbc56ee3
commit
0c548777d6
@ -4,6 +4,7 @@ class EGVAR(missileguidance,AttackProfiles) {
|
||||
visualName = "FGM-77 Dragon";
|
||||
description = "FGM-77 Dragon";
|
||||
|
||||
onFired = QFUNC(onFired);
|
||||
functionName = QFUNC(attackProfile_DRAGON);
|
||||
};
|
||||
};
|
||||
|
@ -81,9 +81,14 @@ class CfgAmmo {
|
||||
seekerMinRange = 65;
|
||||
seekerMaxRange = 1500;
|
||||
|
||||
correctionDistance = 15;
|
||||
correctionDistance = 30;
|
||||
missileLeadDistance = 0;
|
||||
offsetFromCrosshair[] = { 0, 0, 0 };
|
||||
|
||||
serviceInterval = 0.33; // how many seconds between pops
|
||||
serviceCharges = 66; // how many charges are in this missile
|
||||
serviceChargeAcceleration = 6.5;
|
||||
dragonSpeed = 100; // meters per second
|
||||
|
||||
defaultAttackProfile = "DRAGON";
|
||||
attackProfiles[] = {"DRAGON"};
|
||||
|
@ -10,8 +10,3 @@ class Extended_PreInit_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class ACE_M47_Dragon_Sight {
|
||||
ADDON = QUOTE(_this call FUNC(onFired));
|
||||
};
|
||||
};
|
||||
|
@ -17,17 +17,17 @@
|
||||
* Public: No
|
||||
*
|
||||
*/
|
||||
#define SERVICE_INTERVAL 0.33
|
||||
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
|
||||
_args params ["_firedEH", "", "", "", "_stateParams"];
|
||||
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
|
||||
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_crosshairOffset", "_seekerMaxRangeSqr", "_wireCutSource", ["_lastTime", 0]];
|
||||
_stateParams params ["_lastRunTime"];
|
||||
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_lastTime", "_serviceInterval", "_serviceChargeCount", "_serviceChargeAcceleration", "_dragonSpeed"];
|
||||
|
||||
systemChat str(_attackProfileStateParams);
|
||||
|
||||
private _projectilePos = getPosASL _projectile;
|
||||
private _distanceToProjectile = (getPosASL _shooter) vectorDistanceSqr _projectilePos;
|
||||
|
||||
if (_distanceToProjectile <= 65) exitWith { _projectilePos vectorAdd (AGLtoASL (_projectile vectorModelToWorld [0, 50, 0])) };
|
||||
if (_distanceToProjectile <= _seekerMinRangeSqr) exitWith { _projectilePos vectorAdd (AGLtoASL (_projectile vectorModelToWorld [0, 50, 0])) };
|
||||
|
||||
if ((_distanceToProjectile > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
|
||||
// wire snap, random direction
|
||||
@ -40,20 +40,19 @@ if ((_distanceToProjectile > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
|
||||
};
|
||||
_projectilePos vectorAdd _randomVector
|
||||
};
|
||||
_maxCorrectableDistance = 30;
|
||||
|
||||
// if the time between updates is less than the pop time we want to fire the rockets OR if the missile wants to make a major correction pop it rapidly
|
||||
if (((_lastTime - CBA_missionTime) <= 0) || {(_lastTime - CBA_missionTime) < (SERVICE_INTERVAL / 2) && (_projectilePos vectorDistance _seekerTargetPos > 1)}) then {
|
||||
_attackProfileStateParams set [6, CBA_missionTime + SERVICE_INTERVAL];
|
||||
if (((_lastTime - CBA_missionTime) <= 0) || {(_lastTime - CBA_missionTime) < (_serviceInterval / 2) && (_projectilePos vectorDistance _seekerTargetPos > 1)}) then {
|
||||
_attackProfileStateParams set [6, CBA_missionTime + _serviceInterval];
|
||||
|
||||
private _vectorToCrosshair = vectorNormalized (_projectile worldToModel (ASLToAGL _seekerTargetPos));
|
||||
private _vectorToPos = vectorNormalized (((_projectile vectorWorldToModelVisual (_shooter weaponDirection _weapon)) vectorMultiply (100 * SERVICE_INTERVAL)) vectorAdd (_vectorToCrosshair vectorMultiply _maxCorrectableDistance));
|
||||
private _vectorToPos = vectorNormalized (((_projectile vectorWorldToModelVisual (_shooter weaponDirection _weapon)) vectorMultiply (_dragonSpeed * _serviceInterval)) vectorAdd (_vectorToCrosshair vectorMultiply _maxCorrectableDistance));
|
||||
|
||||
if ((_vectorToPos select 2) < 0) then {
|
||||
_vectorToPos set [2, 0];
|
||||
};
|
||||
|
||||
_projectile setVelocityModelSpace ((velocityModelSpace _projectile) vectorAdd (_vectorToPos vectorMultiply 6.5));
|
||||
_projectile setVelocityModelSpace ((velocityModelSpace _projectile) vectorAdd (_vectorToPos vectorMultiply _serviceChargeAcceleration));
|
||||
|
||||
private _charge = createVehicle ["ace_m47_dragon_serviceCharge", [0, 0, 0], [], 0, "NONE"];
|
||||
_charge setPosASL (_projectilePos vectorAdd ((_vectorToCrosshair vectorMultiply -1) vectorMultiply 0.025));
|
||||
|
@ -16,7 +16,38 @@
|
||||
* Public: No
|
||||
*
|
||||
*/
|
||||
params["_unit"];
|
||||
_unit setVariable [QGVAR(fired), true, true];
|
||||
_unit animate ["missile_hide", 1];
|
||||
params ["_firedEH", "", "", "_seekerParams", "_stateParams"];
|
||||
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
|
||||
_stateParams params ["", "", "_attackProfileStateParams"];
|
||||
_seekerParams params ["", "", "_seekerMaxRange", "_seekerMinRange"];
|
||||
|
||||
_shooter setVariable [QGVAR(fired), true, true];
|
||||
_shooter animate ["missile_hide", 1];
|
||||
|
||||
private _config = ([_projectile] call CBA_fnc_getObjectConfig) >> "ace_missileguidance";
|
||||
|
||||
private _serviceInterval = [_config >> "serviceInterval", "NUMBER", 0.33] call CBA_fnc_getConfigEntry;
|
||||
private _serviceChargeCount = [_config >> "serviceCharges", "NUMBER", 60] call CBA_fnc_getConfigEntry;
|
||||
private _serviceChargeAcceleration = [_config >> "serviceChargeAcceleration", "NUMBER", 6.5] call CBA_fnc_getConfigEntry;
|
||||
private _dragonSpeed = [_config >> "dragonSpeed", "NUMBER", 100] call CBA_fnc_getConfigEntry;
|
||||
private _maxCorrectableDistance = [_config >> "correctionDistance", "NUMBER", DEFAULT_CORRECTION_DISTANCE] call CBA_fnc_getConfigEntry;
|
||||
private _maxDistanceSqr = _seekerMaxRange * _seekerMaxRange;
|
||||
private _minDistanceSqr = _seekerMinRange * _seekerMinRange;
|
||||
|
||||
private _turretPath = [_shooter, _weapon] call CBA_fnc_turretPathWeapon;
|
||||
private _turretConfig = [_shooter, _turretPath] call CBA_fnc_getTurret;
|
||||
|
||||
private _wireCutSource = _shooter selectionPosition getText(_turretConfig >> "missileEnd");
|
||||
|
||||
_attackProfileStateParams pushBack _maxCorrectableDistance;
|
||||
_attackProfileStateParams pushBack false;
|
||||
_attackProfileStateParams pushBack [0, 0, 0];
|
||||
_attackProfileStateParams pushBack _maxDistanceSqr;
|
||||
_attackProfileStateParams pushBack _minDistanceSqr;
|
||||
_attackProfileStateParams pushBack _wireCutSource;
|
||||
_attackProfileStateParams pushBack CBA_missionTime;
|
||||
_attackProfileStateParams pushBack _serviceInterval;
|
||||
_attackProfileStateParams pushBack _serviceChargeCount;
|
||||
_attackProfileStateParams pushBack _serviceChargeAcceleration;
|
||||
_attackProfileStateParams pushBack _dragonSpeed;
|
||||
|
||||
|
@ -115,14 +115,13 @@ private _args = [_this,
|
||||
[ diag_tickTime, [], [], _lastKnownPosState]
|
||||
];
|
||||
|
||||
|
||||
private _onFiredFunc = getText (configFile >> QGVAR(AttackProfiles) >> _attackProfile >> "onFired");
|
||||
private _onFiredFunc = getText (configFile >> QGVAR(SeekerTypes) >> _seekerType >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
|
||||
_onFiredFunc = getText (configFile >> QGVAR(SeekerTypes) >> _seekerType >> "onFired");
|
||||
|
||||
_onFiredFunc = getText (configFile >> QGVAR(AttackProfiles) >> _attackProfile >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user