Rudimentary hold-tab lock on titan, sounds added, jink removed, state tracking.

This commit is contained in:
jaynus 2015-04-05 11:51:39 -07:00
parent 278ffe7d65
commit 34b834e700
6 changed files with 64 additions and 25 deletions

View File

@ -3,6 +3,7 @@ ace_aircraft
Changes to air weaponry, flightmodels and HUDs.
* Contributations by Kimi for HUD updates
## Maintainers

View File

@ -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;
};

View File

@ -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 ];

View File

@ -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
]
];

View File

@ -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;

View File

@ -1,3 +1,6 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
_object = _this select 0;
_origin = getPosASL _object;