From 4f21432a776e6a6a07d588758c2dac93fcdb1ee2 Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Wed, 2 Sep 2020 22:50:26 +0100 Subject: [PATCH 1/3] Fixes to missile guidance, hellfire, and laser. Allow ARH to fire on remote targets - Use correct object for attack profile and laser code (set on vehicle, retrieved from player) - Don't use E variant macros inside laser for own variables and functions - Check list of remote targets for hellfire ARH onFired, to enable firing on datalink tracks without needing LOS or radar on (cherry picked from commit edb216f6bfb4983b42f55e9c4f8bfda182d8d569) --- addons/laser/functions/fnc_addLaserTarget.sqf | 6 +++--- addons/laser/functions/fnc_laserTargetPFH.sqf | 2 +- addons/laser/functions/fnc_showVehicleHud.sqf | 4 ++-- addons/missileguidance/functions/fnc_ahr_onFired.sqf | 6 +++++- addons/missileguidance/functions/fnc_onFired.sqf | 6 +++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/addons/laser/functions/fnc_addLaserTarget.sqf b/addons/laser/functions/fnc_addLaserTarget.sqf index 2cf99a53110..6a27ee5355b 100644 --- a/addons/laser/functions/fnc_addLaserTarget.sqf +++ b/addons/laser/functions/fnc_addLaserTarget.sqf @@ -20,9 +20,9 @@ params ["_targetObject", "_vehicle"]; TRACE_2("params",_targetObject,_vehicle); // Get the designator variables, or use defaults -private _waveLength = _vehicle getVariable [QEGVAR(laser,waveLength), ACE_DEFAULT_LASER_WAVELENGTH]; -private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; -private _beamSpread = _vehicle getVariable [QEGVAR(laser,beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD]; +private _waveLength = _vehicle getVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH]; +private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; +private _beamSpread = _vehicle getVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD]; TRACE_3("codes",_waveLength,_laserCode,_beamSpread); // Laser method is the method ACE_Laser will use to determine from where to where it should project the designator cone diff --git a/addons/laser/functions/fnc_laserTargetPFH.sqf b/addons/laser/functions/fnc_laserTargetPFH.sqf index c833aa52546..d509d3ba91b 100644 --- a/addons/laser/functions/fnc_laserTargetPFH.sqf +++ b/addons/laser/functions/fnc_laserTargetPFH.sqf @@ -29,7 +29,7 @@ GVAR(trackedLaserTargets) = GVAR(trackedLaserTargets) select { TRACE_1("Laser off:", _laserUuid); false } else { - private _newCode = _owner getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; + private _newCode = _owner getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; if (_laserCode != _newCode) then { TRACE_2("code change",_newCode,_laserCode); [QGVAR(updateCode), [_laserUuid, _newCode]] call CBA_fnc_globalEvent; diff --git a/addons/laser/functions/fnc_showVehicleHud.sqf b/addons/laser/functions/fnc_showVehicleHud.sqf index 3b9f0adc2ff..8d1eb687538 100644 --- a/addons/laser/functions/fnc_showVehicleHud.sqf +++ b/addons/laser/functions/fnc_showVehicleHud.sqf @@ -91,10 +91,10 @@ GVAR(pfID) = [{ // Do Laser Scan: private _ammo = getText (configFile >> "CfgMagazines" >> _vehicle currentMagazineTurret _turretPath >> "ammo"); private _laserSource = AGLtoASL (_vehicle modelToWorld (_vehicle selectionPosition _seekerSource)); - private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; + private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; private _seekerAngle = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerAngle"); private _seekerMaxRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerMaxRange"); - private _laserResult = [_laserSource, vectorDir _vehicle, _seekerAngle, _seekerMaxRange, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle] call EFUNC(laser,seekerFindLaserSpot); + private _laserResult = [_laserSource, vectorDir _vehicle, _seekerAngle, _seekerMaxRange, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle] call FUNC(seekerFindLaserSpot); private _foundTargetPos = _laserResult select 0; private _haveLock = !isNil "_foundTargetPos"; diff --git a/addons/missileguidance/functions/fnc_ahr_onFired.sqf b/addons/missileguidance/functions/fnc_ahr_onFired.sqf index 331484f4a29..29dcd799e85 100644 --- a/addons/missileguidance/functions/fnc_ahr_onFired.sqf +++ b/addons/missileguidance/functions/fnc_ahr_onFired.sqf @@ -24,6 +24,10 @@ _target = missileTarget _projectile; if (isNull _target && isVehicleRadarOn vehicle _shooter) then { _target = cursorTarget; }; +private _isRemoteTarget = ((listRemoteTargets side _shooter) findIf {_x#0 == cursorTarget}) != -1; +if (isNull _target && _isRemoteTarget) then { + _target = cursorTarget; +}; if !(_target isKindOf "AllVehicles") then { _target = nil; }; @@ -56,7 +60,7 @@ private _shooterHasActiveRadar = { false } forEach listVehicleSensors vehicle _shooter; -if !(isVehicleRadarOn vehicle _shooter) then { +if (!(isVehicleRadarOn vehicle _shooter) && !_isRemoteTarget) then { _isActive = true; }; diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index 422639c452a..ce61534c8ba 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -43,13 +43,13 @@ private _config = configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON); private _target = _shooter getVariable [QGVAR(target), nil]; private _targetPos = _shooter getVariable [QGVAR(targetPosition), nil]; private _seekerType = _shooter getVariable [QGVAR(seekerType), nil]; -private _attackProfile = _shooter getVariable [QGVAR(attackProfile), nil]; +private _attackProfile = (vehicle _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 _laserCode = _shooter getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; +private _lockMode = _shooter getVariable [QGVAR(lockMode), nil]; +private _laserCode = (vehicle _shooter) getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; private _laserInfo = [_laserCode, ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH]; TRACE_6("getVars",_target,_targetPos,_seekerType,_attackProfile,_lockMode,_laserCode); From 688405c7b6c976aba340c545c5a74591f6747bf7 Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Thu, 3 Sep 2020 17:11:32 +0100 Subject: [PATCH 2/3] Handle source for laser and attack profile correctly - Uses same logic to select the laser and attackprofile source as the laser and attack profile functions --- addons/missileguidance/functions/fnc_onFired.sqf | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index ce61534c8ba..cc9f165a6c7 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -40,16 +40,27 @@ TRACE_4("enabled",_shooter,_ammo,_projectile,typeOf _shooter); private _config = configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON); +private _configurationSource = _shooter; +if (isNull (ACE_controlledUAV param [0, objNull])) then { + if (((vehicle _shooter) == _shooter) || {_shooter call CBA_fnc_canUseWeapon}) then { + _configurationSource = _shooter; + } else { + _configurationSource = vehicle _shooter; + }; +} else { + _configurationSource = ACE_controlledUAV select 0; +}; + private _target = _shooter getVariable [QGVAR(target), nil]; private _targetPos = _shooter getVariable [QGVAR(targetPosition), nil]; private _seekerType = _shooter getVariable [QGVAR(seekerType), nil]; -private _attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil]; +private _attackProfile = _configurationSource 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 _laserCode = (vehicle _shooter) getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; +private _laserCode = _configurationSource getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; private _laserInfo = [_laserCode, ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH]; TRACE_6("getVars",_target,_targetPos,_seekerType,_attackProfile,_lockMode,_laserCode); From a0cc74d2650e9e20d092274ad4869787ee4eb7d5 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 24 Jul 2024 16:34:12 +0200 Subject: [PATCH 3/3] Update fnc_onFired.sqf --- addons/missileguidance/functions/fnc_onFired.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index d198d16fc1e..8eede171848 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -58,7 +58,6 @@ private _attackProfile = _configurationSource getVariable [QGVAR(attackProfile), 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 _laserCode = _configurationSource getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; private _laserInfo = [_laserCode, ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH];