Changed: Safety mode on Titan, it now doesnt show as unloaded Fixed: Some TOP shots would miss, Fixed: Lock constraints would show on fast weapon switch.

This commit is contained in:
jaynus 2015-04-15 09:10:00 -07:00
parent 0d28a890e1
commit c793df4848
8 changed files with 92 additions and 21 deletions

View File

@ -9,4 +9,10 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
};
};
class Extended_FiredBIS_EventHandlers {
class All {
ADDON = QUOTE(_this call FUNC(onFired));
};
};

View File

@ -14,7 +14,7 @@ class RscInGameUI {
idd = 300;
controls[] = { "ACE_javelin_elements_group", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"};
onLoad = QUOTE(_this call FUNC(onOpticLoad));
onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];uiNameSpace setVariable ['ACE_RscOptics_javelin_PFH',nil];";
onUnload = QUOTE(_this call FUNC(onOpticUnload));
class ACE_javelin_elements_group: RscControlsGroup
{

View File

@ -6,6 +6,7 @@ PREP(lockKeyUp);
PREP(cycleFireMode);
PREP(showFireMode);
PREP(onFired);
PREP(onOpticLoad);
PREP(onOpticDraw);

View File

@ -0,0 +1,18 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
// Bail on not missile
if(! (_weapon in ["launch_Titan_short_F"]) ) exitWith { false };
_pfh_handle = uiNamespace getVariable ["ACE_RscOptics_javelin_PFH", nil];
if(!isNil "_pfh_handle") then {
//[_pfh_handle] call cba_fnc_removePerFrameHandler;
//uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil];
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
};

View File

@ -11,18 +11,6 @@ TRACE_1("enter", _this);
private["_isJavelin", "_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"];
if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom))
|| { (vehicle ACE_player) != ACE_player }
) exitWith {
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
[(_this select 1)] call cba_fnc_removePerFrameHandler;
uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil];
};
// Reset arguments if we havnt rendered in over a second
_args = uiNamespace getVariable[QGVAR(arguments), [] ];
if( (count _args) > 0) then {
@ -40,6 +28,21 @@ _runTime = _args select 2;
_lockTime = _args select 3;
_soundTime = _args select 4;
_randomLockInterval = _args select 5;
_fireDisabledEH = _args select 6;
if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom))
|| { (vehicle ACE_player) != ACE_player }
) exitWith {
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil];
};
// Find a target within the optic range
_newTarget = objNull;
@ -106,6 +109,27 @@ if((call CBA_fnc_getFoV) select 1 > 9) then {
__JavelinIGUIWFOV ctrlSetTextColor __ColorGreen;
};
FUNC(disableFire) = {
_firedEH = _this select 0;
if(_firedEH < 0) then {
_firedEH = [ACE_player, "DefaultAction", {true}, {
_canFire = ACE_player getVariable["ace_missileguidance_target", nil];
if(!isNil "_canFire") exitWith { false };
true
}] call EFUNC(common,addActionEventHandler);
};
_firedEH
};
FUNC(enableFire) = {
_firedEH = _this select 0;
if(_firedEH > 0) then {
[ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler);
};
-1
};
if (isNull _newTarget) then {
// No targets found
_currentTarget = objNull;
@ -120,8 +144,7 @@ if (isNull _newTarget) then {
ACE_player setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire
if (ACE_player ammo (currentWeapon ACE_player) > 0) then { ACE_player setWeaponReloadingTime [player, (currentWeapon ACE_player), 0.2]; };
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
} else {
if (_newTarget distance ACE_player < 2500
&& {(call CBA_fnc_getFoV) select 1 > 9}
@ -176,7 +199,7 @@ if (isNull _newTarget) then {
ACE_player setVariable["ace_missileguidance_target", _currentTarget, false];
// Allow fire
ACE_player setWeaponReloadingTime [player, (currentWeapon ACE_player), 0];
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locked";
@ -217,7 +240,7 @@ if (isNull _newTarget) then {
_soundTime = diag_tickTime + 0.25;
};
// Disallow fire
if (ACE_player ammo (currentWeapon ACE_player) > 0) then { ACE_player setWeaponReloadingTime [player, (currentWeapon ACE_player), 0.2]; };
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
};
};
} else {
@ -234,7 +257,7 @@ if (isNull _newTarget) then {
ACE_player setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire
if (ACE_player ammo (currentWeapon ACE_player) > 0) then { ACE_player setWeaponReloadingTime [player, (currentWeapon ACE_player), 0.2]; };
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
};
};
@ -246,5 +269,6 @@ _args set[1, _currentTarget];
_args set[2, _runTime];
_args set[3, _lockTime];
_args set[4, _soundTime];
_args set[6, _fireDisabledEH];
uiNamespace setVariable[QGVAR(arguments), _args ];

View File

@ -25,7 +25,8 @@ uiNameSpace setVariable [QGVAR(arguments),
0, // Run Time
0, // Lock Time
0, // Sound timer
(random __LOCKONTIMERANDOM) // random lock time addition
(random __LOCKONTIMERANDOM), // random lock time addition
-1
]
];

View File

@ -0,0 +1,20 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];
_pfh = uiNamespace getVariable["ACE_RscOptics_javelin_PFH", nil ];
if(!isNil "_pfh") then {
[_pfh] call CBA_fnc_removePerFrameHandler;
uiNameSpace setVariable ['ACE_RscOptics_javelin_PFH',nil];
};
_args = uiNamespace getVariable[QGVAR(arguments), nil ];
if(!isNil "_args") then {
_disableFireEH = _args select 6;
if(_disableFireEH > 0) then {
[ACE_player, "DefaultAction", _disableFireEH] call EFUNC(common,removeActionEventHandler);
};
uiNameSpace setVariable [QGVAR(arguments),nil];
};

View File

@ -58,10 +58,11 @@ switch( (_state select 0) ) do {
case STAGE_COAST: {
TRACE_1("STAGE_COAST","");
TRACE_1("", ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) );
if(_distanceShooterToTarget < 1250 || _distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ) * 1.5) then {
if(_distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ) * 1.5) then {
_state set[0, STAGE_TERMINAL];
} else {
_returnTargetPos = _seekerTargetPos vectorAdd [0,0,(_projectilePos select 2)];
};
_returnTargetPos = _seekerTargetPos vectorAdd [0,0,(_projectilePos select 2)];
};
case STAGE_TERMINAL: {
TRACE_1("STAGE_TERMINAL","");