From 175652456b67e8dc874be025dcbf25b7a5e7e0ec Mon Sep 17 00:00:00 2001 From: Brandon Danyluk Date: Sat, 8 May 2021 02:49:16 -0600 Subject: [PATCH] add the ability to see a light trail --- addons/hot/CfgAmmo.hpp | 2 ++ addons/metis/CfgAmmo.hpp | 2 ++ .../functions/fnc_guidancePFH.sqf | 30 +++++++++++++++++-- .../missileguidance/functions/fnc_onFired.sqf | 8 +++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/addons/hot/CfgAmmo.hpp b/addons/hot/CfgAmmo.hpp index 4a957cc551..f9debedbde 100644 --- a/addons/hot/CfgAmmo.hpp +++ b/addons/hot/CfgAmmo.hpp @@ -62,6 +62,8 @@ class CfgAmmo { canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode + showTrail = 1; + // Guidance type for munitions defaultSeekerType = "SACLOS"; seekerTypes[] = { "SACLOS" }; diff --git a/addons/metis/CfgAmmo.hpp b/addons/metis/CfgAmmo.hpp index bb22e72190..1d544edc85 100644 --- a/addons/metis/CfgAmmo.hpp +++ b/addons/metis/CfgAmmo.hpp @@ -15,6 +15,8 @@ class CfgAmmo { canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode + showTrail = 1; + // Guidance type for munitions defaultSeekerType = "SACLOS"; seekerTypes[] = { "SACLOS" }; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index d2a31072e5..b4a67b53d6 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -15,6 +15,7 @@ * * Public: No */ +#define TRAIL_COLOUR(multiplier) [1 * multiplier, 1 * multiplier, 0.3 * multiplier, 0.7 * multiplier] BEGIN_COUNTER(guidancePFH); @@ -24,15 +25,40 @@ _firedEH params ["_shooter","","","","_ammo","","_projectile"]; _launchParams params ["","_targetLaunchParams","","","","","_navigationType"]; _stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters", "_guidanceParameters"]; _navigationStateParams params ["_currentState", "_navigationStateData"]; +_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance", "_stabilityCoefficient", "_showTrail"]; if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith { [_pfID] call CBA_fnc_removePerFrameHandler; END_COUNTER(guidancePFH); }; -private _timestep = diag_deltaTime * accTime; +if (_showTrail) then { + drop [ + "\a3\data_f\kouleSvetlo", "", "Billboard", + 100, + 0.03, + _projectile modelToWorld [0, 0, 0], + [0, 0, 0], + 0, + 1.25, + 1, + 0.05, + [0.5], + [TRAIL_COLOUR(1)], + [0], + 0, + 0, + "", + "", + "", + 0, + false, + -1, + [TRAIL_COLOUR(10000)] + ]; +}; -_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance", "_stabilityCoefficient"]; +private _timestep = diag_deltaTime * accTime; // Run seeker function: private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState, _timestep] call FUNC(doSeekerSearch); diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index 8018cae9eb..c594f29a7e 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -113,12 +113,15 @@ private _bangBang = false; if (isNumber (_config >> "pitchRate")) then { _pitchRate = getNumber ( _config >> "pitchRate" ); _yawRate = getNumber ( _config >> "yawRate" ); - _bangBang = 1 == getNumber (_config >> "bangBangGuidance"); + _bangBang = (1 == getNumber (_config >> "bangBangGuidance")); }; // How much this projectile likes to stay toward current velocity private _stabilityCoefficient = getNumber (_config >> "stabilityCoefficient"); +// show a light trail in flight +private _showTrail = (1 == getNumber (_config >> "showTrail")); + private _navigationStateSubclass = _config >> "navigationStates"; private _states = getArray (_navigationStateSubclass >> "states"); @@ -153,7 +156,8 @@ private _args = [_this, _pitchRate, _yawRate, _bangBang, - _stabilityCoefficient + _stabilityCoefficient, + _showTrail ], [ getNumber ( _config >> "seekerAngle" ),