diff --git a/addons/aircraft/README.md b/addons/aircraft/README.md index 5c3de5c6d4..76c721bd0c 100644 --- a/addons/aircraft/README.md +++ b/addons/aircraft/README.md @@ -3,6 +3,7 @@ ace_aircraft Changes to air weaponry, flightmodels and HUDs. +* Contributations by Kimi for HUD updates ## Maintainers diff --git a/addons/wep_javelin/functions/fnc_fired.sqf b/addons/wep_javelin/functions/fnc_fired.sqf index 014bc972bb..6a4b1930e3 100644 --- a/addons/wep_javelin/functions/fnc_fired.sqf +++ b/addons/wep_javelin/functions/fnc_fired.sqf @@ -78,7 +78,7 @@ FUNC(guidance_Javelin_LOBL_TOP_PFH) = { _pitch = 0.0; // Stop jinking on terminal final decent - if((_missilePos distance _targetPos) > 50) then { + if((_missilePos distance _targetPos) < 50) then { _defPitch = 0.0015; _defYaw = 0.0015; }; diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf index 83d9927a91..3dfafb3410 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -1,6 +1,6 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -TRACE_1("enter", _this); +//TRACE_1("enter", _this); #define __TRACKINTERVAL 0.1 // how frequent the check should be. #define __LOCKONTIME 1.85 // Lock on won't occur sooner @@ -16,7 +16,7 @@ TRACE_1("enter", _this); #define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 -private["_args", "_lastTick"]; +private["_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"]; // Reset arguments if we havnt rendered in over a second _args = uiNamespace getVariable[QGVAR(arguments), [] ]; @@ -29,11 +29,21 @@ if( (count _args) > 0) then { // Pull the arguments _currentTarget = _args select 1; - +_runTime = _args select 2; +_lockTime = _args select 3; +_soundTime = _args select 4; // Find a target within the optic range _newTarget = objNull; +// Bail on fast movement +if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. + ACE_player switchCamera "INTERNAL"; +}; + +// Only start locking on holding tab +if(!GVAR(isLockKeyDown)) exitWith { false }; + _range = parseNumber (ctrlText __JavelinIGUIRangefinder); if (_range > 50 && {_range < 2500}) then { _pos = positionCameraToWorld [0,0,_range]; @@ -47,14 +57,11 @@ if (isNull _newTarget) then { _newTarget = cursorTarget; }; -if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) then { // keep it steady. - ACE_player switchCamera "INTERNAL"; -}; - if (isNull _newTarget) then { // No targets found _currentTarget = objNull; - + _lockTime = 0; + __JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGreen; __JavelinIGUITargetingConstrains ctrlShow false; @@ -66,20 +73,38 @@ if (isNull _newTarget) then { // Disallow fire //if (ACE_player ammo "Javelin" > 0 || {ACE_player ammo "ACE_Javelin_Direct" > 0}) then {ACE_player setWeaponReloadingTime //[player, "Javelin", 0.2];}; } else { - if (_newTarget distance ACE_player < 2500 && - {(call CBA_fnc_getFoV) select 1 > 7} && - { (currentVisionMode ACE_player == 2)} + if (_newTarget distance ACE_player < 2500 + // && {(call CBA_fnc_getFoV) select 1 > 7} + // && { (currentVisionMode ACE_player == 2)} ) then { - - // THIS IS A PROPER LOCK - _currentTarget = _newTarget; - __JavelinIGUISeek ctrlSetTextColor __ColorGreen; - __JavelinIGUINFOV ctrlSetTextColor __ColorNull; - __JavelinIGUITargetingConstrains ctrlShow true; - - ACE_player setVariable[QGVAR(currentTarget), _currentTarget, false]; - ACE_player setVariable[QGVAR(currentTargetPos), getPosASL _currentTarget, false]; - + // Lock on after 3 seconds + if(_currentTarget != _newTarget) then { + TRACE_1("New Target, reseting locking", _newTarget); + _lockTime = diag_tickTime; + _currentTarget = _newTarget; + + playSound "ACE_Javelin_Locking"; + } else { + if(diag_tickTime - _lockTime > 3) then { + TRACE_2("LOCKED!", _currentTarget, _lockTime); + __JavelinIGUISeek ctrlSetTextColor __ColorGreen; + __JavelinIGUINFOV ctrlSetTextColor __ColorNull; + __JavelinIGUITargetingConstrains ctrlShow true; + + ACE_player setVariable[QGVAR(currentTarget), _currentTarget, false]; + ACE_player setVariable[QGVAR(currentTargetPos), getPosASL _currentTarget, false]; + + if(diag_tickTime > _soundTime) then { + playSound "ACE_Javelin_Locked"; + _soundTime = diag_tickTime + 0.25; + }; + } else { + if(diag_tickTime > _soundTime) then { + playSound "ACE_Javelin_Locking"; + _soundTime = diag_tickTime + 0.25; + }; + }; + }; } else { // Something is wrong with our seek _currentTarget = objNull; @@ -95,10 +120,13 @@ if (isNull _newTarget) then { }; -TRACE_2("", _newTarget, _currentTarget); +//TRACE_2("", _newTarget, _currentTarget); // Save arguments for next run _args set[0, diag_tickTime]; _args set[1, _currentTarget]; +_args set[2, _runTime]; +_args set[3, _lockTime]; +_args set[4, _soundTime]; uiNamespace setVariable[QGVAR(arguments), _args ]; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf index 10433b12e9..c4a7069630 100644 --- a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); @@ -9,6 +9,9 @@ if((count _this) > 0) then { uiNameSpace setVariable [QGVAR(arguments), [ 0, // Last runtime - objNull // currentTargetObject + objNull, // currentTargetObject + 0, // Run Time + 0, // Lock Time + 0 // Sound timer ] ]; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf b/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf index 1e2e930ac7..12f828769a 100644 --- a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf +++ b/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf @@ -1,3 +1,7 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + _object = _this select 0; _origin = getPosASL _object; _matrix = _this select 1; diff --git a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf b/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf index d74fa17fa1..afe2436e5d 100644 --- a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf @@ -1,3 +1,6 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); _object = _this select 0; _origin = getPosASL _object;