mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
MissileGuidance - Allow using vanilla fire mode key (#6732)
* MissileGuidance - Allow using vanilla fire mode key Fix #6595 * Javelin - Backwards compatiblity with CUP * Add support to RHS compat * comment
This commit is contained in:
parent
05d1c62c1f
commit
d379c3f1b7
@ -1,8 +1,16 @@
|
|||||||
|
class Mode_SemiAuto;
|
||||||
class CfgWeapons {
|
class CfgWeapons {
|
||||||
|
class MissileLauncher;
|
||||||
class missiles_titan_static;
|
class missiles_titan: MissileLauncher {
|
||||||
|
class Player: MissileLauncher {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_DIR";
|
||||||
|
};
|
||||||
|
class TopDown: Player {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_TOP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class missiles_titan_static: missiles_titan {};
|
||||||
class GVAR(Titan_Static): missiles_titan_static {
|
class GVAR(Titan_Static): missiles_titan_static {
|
||||||
modes[] = {"Player"};
|
|
||||||
GVAR(enabled) = 1;
|
GVAR(enabled) = 1;
|
||||||
weaponInfoType = "ACE_RscOptics_javelin";
|
weaponInfoType = "ACE_RscOptics_javelin";
|
||||||
modelOptics = QPATHTOF(data\reticle_titan.p3d);
|
modelOptics = QPATHTOF(data\reticle_titan.p3d);
|
||||||
@ -13,7 +21,16 @@ class CfgWeapons {
|
|||||||
lockedTargetSound[] = {"",0,1};
|
lockedTargetSound[] = {"",0,1};
|
||||||
};
|
};
|
||||||
|
|
||||||
class launch_Titan_short_base;
|
class Launcher_Base_F;
|
||||||
|
class launch_Titan_base: Launcher_Base_F {
|
||||||
|
class Single: Mode_SemiAuto {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_DIR";
|
||||||
|
};
|
||||||
|
class TopDown: Single {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_TOP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class launch_Titan_short_base: launch_Titan_base {};
|
||||||
class launch_B_Titan_short_F: launch_Titan_short_base {
|
class launch_B_Titan_short_F: launch_Titan_short_base {
|
||||||
GVAR(enabled) = 1;
|
GVAR(enabled) = 1;
|
||||||
weaponInfoType = "ACE_RscOptics_javelin";
|
weaponInfoType = "ACE_RscOptics_javelin";
|
||||||
|
@ -15,10 +15,22 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
|
(if (((vehicle ACE_player) == ACE_player) || {ACE_player call CBA_fnc_canUseWeapon}) then {
|
||||||
private _currentFireMode = _currentShooter getVariable ["ace_missileguidance_attackProfile", "JAV_TOP"];
|
weaponState ACE_player
|
||||||
|
} else {
|
||||||
|
_turretPath = if (ACE_player == (driver _currentShooter)) then {[-1]} else {ACE_player call CBA_fnc_turretPath};
|
||||||
|
weaponState [vehicle ACE_player, _turretPath]
|
||||||
|
}) params ["_weapon", "", "_mode"];
|
||||||
|
|
||||||
TRACE_1("showFireMode", _currentFireMode);
|
private _currentFireMode = getText (configFile >> "CfgWeapons" >> _weapon >> _mode >> QEGVAR(missileGuidance,attackProfile));
|
||||||
|
|
||||||
|
TRACE_3("showFireMode",_weapon,_mode,_currentFireMode);
|
||||||
|
|
||||||
|
if (_currentFireMode == "") then { // backwards compatiblity for addons using ace_javelin (CUP)
|
||||||
|
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
|
||||||
|
_currentFireMode = _currentShooter getVariable ["ace_missileguidance_attackProfile", "JAV_TOP"];
|
||||||
|
TRACE_1("using getVar",_currentFireMode);
|
||||||
|
};
|
||||||
|
|
||||||
if (_currentFireMode == "JAV_TOP") then {
|
if (_currentFireMode == "JAV_TOP") then {
|
||||||
__JavelinIGUITop ctrlSetTextColor __ColorGreen;
|
__JavelinIGUITop ctrlSetTextColor __ColorGreen;
|
||||||
|
@ -93,6 +93,7 @@ class CfgAmmo {
|
|||||||
// Attack profile type selection
|
// Attack profile type selection
|
||||||
defaultAttackProfile = "JAV_TOP";
|
defaultAttackProfile = "JAV_TOP";
|
||||||
attackProfiles[] = { "JAV_TOP", "JAV_DIR" };
|
attackProfiles[] = { "JAV_TOP", "JAV_DIR" };
|
||||||
|
useModeForAttackProfile = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 {
|
class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 {
|
||||||
|
@ -23,18 +23,19 @@ if (!([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith))
|
|||||||
|
|
||||||
private _currentShooter = objNull;
|
private _currentShooter = objNull;
|
||||||
private _currentMagazine = "";
|
private _currentMagazine = "";
|
||||||
|
private _turretPath = [];
|
||||||
if (isNull (ACE_controlledUAV param [0, objNull])) then {
|
if (isNull (ACE_controlledUAV param [0, objNull])) then {
|
||||||
if (((vehicle ACE_player) == ACE_player) || {ACE_player call CBA_fnc_canUseWeapon}) then {
|
if (((vehicle ACE_player) == ACE_player) || {ACE_player call CBA_fnc_canUseWeapon}) then {
|
||||||
_currentShooter = ACE_player;
|
_currentShooter = ACE_player;
|
||||||
_currentMagazine = currentMagazine ACE_player;
|
_currentMagazine = currentMagazine ACE_player;
|
||||||
} else {
|
} else {
|
||||||
_currentShooter = vehicle ACE_player;
|
_currentShooter = vehicle ACE_player;
|
||||||
private _turretPath = if (ACE_player == (driver _currentShooter)) then {[-1]} else {ACE_player call CBA_fnc_turretPath};
|
_turretPath = if (ACE_player == (driver _currentShooter)) then {[-1]} else {ACE_player call CBA_fnc_turretPath};
|
||||||
_currentMagazine = _currentShooter currentMagazineTurret _turretPath;
|
_currentMagazine = _currentShooter currentMagazineTurret _turretPath;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_currentShooter = ACE_controlledUAV select 0;
|
_currentShooter = ACE_controlledUAV select 0;
|
||||||
private _turretPath = ACE_controlledUAV select 2;
|
_turretPath = ACE_controlledUAV select 2;
|
||||||
_currentMagazine = _currentShooter currentMagazineTurret _turretPath;
|
_currentMagazine = _currentShooter currentMagazineTurret _turretPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -47,6 +48,11 @@ TRACE_3("",_currentShooter,_currentMagazine,_ammo);
|
|||||||
// Bail if guidance is disabled for this ammo
|
// Bail if guidance is disabled for this ammo
|
||||||
if ((getNumber (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "enabled")) != 1) exitWith {TRACE_1("not enabled",_ammo)};
|
if ((getNumber (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "enabled")) != 1) exitWith {TRACE_1("not enabled",_ammo)};
|
||||||
|
|
||||||
|
private _useModeForAttackProfile = (getNumber (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "useModeForAttackProfile")) == 1;
|
||||||
|
private _weaponStateToken = if (_currentShooter isEqualTo ACE_player) then { _currentShooter } else { [_currentShooter, _turretPath] };
|
||||||
|
(weaponState _weaponStateToken) params ["_weapon", "", "_mode"];
|
||||||
|
TRACE_4("",_useModeForAttackProfile,_weaponStateToken,_weapon,_mode);
|
||||||
|
|
||||||
// Verify ammo has explicity added guidance config (ignore inheritances)
|
// Verify ammo has explicity added guidance config (ignore inheritances)
|
||||||
private _configs = configProperties [(configFile >> "CfgAmmo" >> _ammo), QUOTE(configName _x == QUOTE(QUOTE(ADDON))), false];
|
private _configs = configProperties [(configFile >> "CfgAmmo" >> _ammo), QUOTE(configName _x == QUOTE(QUOTE(ADDON))), false];
|
||||||
if ((count _configs) < 1) exitWith {TRACE_2("not explicity enabled",_ammo,_configs)};
|
if ((count _configs) < 1) exitWith {TRACE_2("not explicity enabled",_ammo,_configs)};
|
||||||
@ -54,7 +60,11 @@ if ((count _configs) < 1) exitWith {TRACE_2("not explicity enabled",_ammo,_confi
|
|||||||
private _attackProfiles = getArray (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "attackProfiles");
|
private _attackProfiles = getArray (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "attackProfiles");
|
||||||
if ((count _attackProfiles) <= 1) exitWith {TRACE_1("no choices for attack profile",_attackProfiles)};
|
if ((count _attackProfiles) <= 1) exitWith {TRACE_1("no choices for attack profile",_attackProfiles)};
|
||||||
|
|
||||||
private _currentFireMode = _currentShooter getVariable [QGVAR(attackProfile), "#undefined"];
|
private _currentFireMode = if (_useModeForAttackProfile) then {
|
||||||
|
getText (configFile >> "CfgWeapons" >> _weapon >> _mode >> QGVAR(attackProfile))
|
||||||
|
} else {
|
||||||
|
_currentShooter getVariable [QGVAR(attackProfile), "#undefined"]
|
||||||
|
};
|
||||||
|
|
||||||
// Just like onFired, this is case sensitive!
|
// Just like onFired, this is case sensitive!
|
||||||
private _index = _attackProfiles find _currentFireMode;
|
private _index = _attackProfiles find _currentFireMode;
|
||||||
@ -65,7 +75,21 @@ _index = (_index + 1) % (count _attackProfiles);
|
|||||||
private _nextFireMode = _attackProfiles select _index;
|
private _nextFireMode = _attackProfiles select _index;
|
||||||
TRACE_4("",_currentFireMode,_nextFireMode,_index,_attackProfiles);
|
TRACE_4("",_currentFireMode,_nextFireMode,_index,_attackProfiles);
|
||||||
|
|
||||||
|
|
||||||
|
private _currentFireMode = if (_useModeForAttackProfile) then {
|
||||||
|
TRACE_2("setting fire mode",_weaponStateToken,_nextFireMode);
|
||||||
|
for "_weaponIndex" from 0 to 299 do {
|
||||||
|
ACE_player action ["SwitchWeapon", _currentShooter, ACE_player, _weaponIndex];
|
||||||
|
(weaponState _weaponStateToken) params ["_xWeapon", "", "_xMode"];
|
||||||
|
if ((_xWeapon == _weapon) && {(getText (configFile >> "CfgWeapons" >> _weapon >> _xMode >> QGVAR(attackProfile))) == _nextFireMode}) exitWith {
|
||||||
|
TRACE_2("Restoring",_weaponIndex,weaponState _currentShooter);
|
||||||
|
};
|
||||||
|
if ((weaponState _weaponStateToken) isEqualTo ["","","","",0]) exitWith {ERROR_2("weaponState not found",_weapon,_nextFireMode);};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
TRACE_2("setVariable attackProfile",_currentShooter,_nextFireMode);
|
||||||
_currentShooter setVariable [QGVAR(attackProfile), _nextFireMode, false];
|
_currentShooter setVariable [QGVAR(attackProfile), _nextFireMode, false];
|
||||||
|
};
|
||||||
|
|
||||||
playSound "ACE_Sound_Click";
|
playSound "ACE_Sound_Click";
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_shooter","","","","_ammo","","_projectile"];
|
params ["_shooter","_weapon","","_mode","_ammo","","_projectile"];
|
||||||
|
|
||||||
// Bail on not missile
|
// Bail on not missile
|
||||||
if (!(_ammo isKindOf "MissileBase")) exitWith {};
|
if (!(_ammo isKindOf "MissileBase")) exitWith {};
|
||||||
@ -44,6 +44,9 @@ private _target = _shooter getVariable [QGVAR(target), nil];
|
|||||||
private _targetPos = _shooter getVariable [QGVAR(targetPosition), nil];
|
private _targetPos = _shooter getVariable [QGVAR(targetPosition), nil];
|
||||||
private _seekerType = _shooter getVariable [QGVAR(seekerType), nil];
|
private _seekerType = _shooter getVariable [QGVAR(seekerType), nil];
|
||||||
private _attackProfile = _shooter getVariable [QGVAR(attackProfile), nil];
|
private _attackProfile = _shooter getVariable [QGVAR(attackProfile), nil];
|
||||||
|
if ((getNumber (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "useModeForAttackProfile")) == 1) then {
|
||||||
|
_attackProfile = getText (configFile >> "CfgWeapons" >> _weapon >> _mode >> QGVAR(attackProfile))
|
||||||
|
};
|
||||||
private _lockMode = _shooter getVariable [QGVAR(lockMode), nil];
|
private _lockMode = _shooter getVariable [QGVAR(lockMode), nil];
|
||||||
|
|
||||||
private _laserCode = _shooter getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
|
private _laserCode = _shooter getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
|
||||||
|
@ -29,6 +29,7 @@ class CfgAmmo {
|
|||||||
// Attack profile type selection
|
// Attack profile type selection
|
||||||
defaultAttackProfile = QGVAR(directAttack);
|
defaultAttackProfile = QGVAR(directAttack);
|
||||||
attackProfiles[] = {QGVAR(directAttack), QGVAR(overflyTopAttack)};
|
attackProfiles[] = {QGVAR(directAttack), QGVAR(overflyTopAttack)};
|
||||||
|
useModeForAttackProfile = 1;
|
||||||
showHintOnCycle = 1;
|
showHintOnCycle = 1;
|
||||||
|
|
||||||
// Run once at fired event
|
// Run once at fired event
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
class Mode_SemiAuto;
|
||||||
|
|
||||||
class CfgWeapons {
|
class CfgWeapons {
|
||||||
class Launcher_Base_F;
|
class Launcher_Base_F;
|
||||||
class launch_NLAW_F: Launcher_Base_F {
|
class launch_NLAW_F: Launcher_Base_F {
|
||||||
@ -9,5 +11,11 @@ class CfgWeapons {
|
|||||||
distanceZoomMax = 0;
|
distanceZoomMax = 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
class Single: Mode_SemiAuto {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = QGVAR(directAttack);
|
||||||
|
};
|
||||||
|
class Overfly: Single {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = QGVAR(overflyTopAttack);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -243,6 +243,7 @@ class CfgAmmo {
|
|||||||
// Attack profile type selection
|
// Attack profile type selection
|
||||||
defaultAttackProfile = "JAV_TOP";
|
defaultAttackProfile = "JAV_TOP";
|
||||||
attackProfiles[] = { "JAV_TOP", "JAV_DIR" };
|
attackProfiles[] = { "JAV_TOP", "JAV_DIR" };
|
||||||
|
useModeForAttackProfile = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -220,6 +220,13 @@ class CfgWeapons {
|
|||||||
canLock = 0;
|
canLock = 0;
|
||||||
lockingTargetSound[] = {"",0,1};
|
lockingTargetSound[] = {"",0,1};
|
||||||
lockedTargetSound[] = {"",0,1};
|
lockedTargetSound[] = {"",0,1};
|
||||||
|
class Single;
|
||||||
|
class Cruise: Single {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_DIR";
|
||||||
|
};
|
||||||
|
class TopDown: Single {
|
||||||
|
EGVAR(missileGuidance,attackProfile) = "JAV_TOP";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Launcher_Base_F;
|
class Launcher_Base_F;
|
||||||
|
Loading…
Reference in New Issue
Block a user