Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add - AIM-120 and Doppler seeker #10021

Open
wants to merge 4 commits into
base: missile_guidance_rewrite
Choose a base branch
from

Conversation

TheCandianVendingMachine
Copy link
Contributor

@TheCandianVendingMachine TheCandianVendingMachine commented May 28, 2024

When merged this pull request will:

  • Add Doppler seeker type
  • Add AIM-120

Merge Strategy

Follow #10019

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@@ -51,6 +51,7 @@ PREP(wire_onFired);

// Seeker OnFired
PREP(SACLOS_onFired);
PREP(doppler_onFired);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why these aren't alphabetically sorted?

@@ -0,0 +1 @@
z\ace\addons\aim120
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
z\ace\addons\aim120
z\ace\addons\aim120

* [] call ace_missileguidance_fnc_mwr_onFired
*
* Public: No
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference.

Suggested change
*/
*/

};
// always allow tracking of projectiles
if !(_target isKindOf "AllVehicles" || { (typeOf _target) isKindOf ["Default", configFile >> "CfgAmmo"] }) then {
_target = nil;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use objNull instead?
If we miss a isNil check somewhere further down, it could break things.


// helicopter blades will always produce a doppler shift due to their nature. Don't filter
if (_target isKindOf "Helicopter" && isEngineOn _target) exitWith {
TRACE_2("dont filter helicopters",_target isKindOf "Helicopter",isEngineOn _target);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both statements are always going to be true.

Suggested change
TRACE_2("dont filter helicopters",_target isKindOf "Helicopter",isEngineOn _target);
TRACE_1("dont filter helicopters",_target);

Comment on lines +60 to +63
private _shooterHasActiveRadar = {
if ("ActiveRadarSensorComponent" in _x) exitWith { true };
false
} forEach listVehicleSensors vehicle _shooter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private _shooterHasActiveRadar = {
if ("ActiveRadarSensorComponent" in _x) exitWith { true };
false
} forEach listVehicleSensors vehicle _shooter;
private _shooterHasActiveRadar = (listVehicleSensors _vehicle) findIf {"ActiveRadarSensorComponent" in _x} != -1;

If we can't guarantee that "ActiveRadarSensorComponent" is always going to be written in that case, we'd need to use this instead:

private _shooterHasActiveRadar = (listVehicleSensors _vehicle) findIf {_x findIf {_x == "ActiveRadarSensorComponent"} != -1} != -1;

Might be able to do something with flatten, but it's usually expensive in terms of performance.

Comment on lines +80 to +88
private _blocking = configOf _x >> "weaponLockSystem";
private _isChaff = false;
if (isNumber _blocking) then {
_isChaff = (8 == getNumber _blocking);
};

if (isText _blocking) then {
_isChaff = ("8" in getText _blocking);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should account for a number instead of a string (e.g. 24 in config).

Suggested change
private _blocking = configOf _x >> "weaponLockSystem";
private _isChaff = false;
if (isNumber _blocking) then {
_isChaff = (8 == getNumber _blocking);
};
if (isText _blocking) then {
_isChaff = ("8" in getText _blocking);
};
private _isChaff = ([getNumber (configOf _x >> "weaponLockSystem"), 4] call EFUNC(common,binarizeNumber)) select 3;

private _withinView = [_projectile, getPosASLVisual _x, _seekerAngle] call FUNC(checkSeekerAngle);
private _canSee = [_projectile, _x, false] call FUNC(checkLos);

(_withinView && _canSee && _isChaff)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like using lazy-eval to my advantage and imo here it would be a good idea to use it.

Suggested change
(_withinView && _canSee && _isChaff)
(([getNumber (configOf _x >> "weaponLockSystem"), 4] call EFUNC(common,binarizeNumber)) select 3) && // Check if chaff can break radar lock
{[_projectile, getPosASLVisual _x, _seekerAngle] call FUNC(checkSeekerAngle)} && // Check if within view
{[_projectile, _x, false] call FUNC(checkLos)} // Check if can be seen

Comment on lines +38 to +39
private _projectileThrust = [_projectileConfig >> "thrust", "NUMBER", 0] call CBA_fnc_getConfigEntry;
private _projectileThrustTime = [_projectileConfig >> "thrustTime", "NUMBER", 0] call CBA_fnc_getConfigEntry;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the default is the default that is gotten with getX, then use getX directly. CBA_fnc_getConfigEntry is about 2-3x more expensive in terms of performance, so imo only use when needed.

Suggested change
private _projectileThrust = [_projectileConfig >> "thrust", "NUMBER", 0] call CBA_fnc_getConfigEntry;
private _projectileThrustTime = [_projectileConfig >> "thrustTime", "NUMBER", 0] call CBA_fnc_getConfigEntry;
private _projectileThrust = getNumber (_projectileConfig >> "thrust");
private _projectileThrustTime = getNumber (_projectileConfig >> "thrustTime");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants