-
Notifications
You must be signed in to change notification settings - Fork 736
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
base: missile_guidance_rewrite
Are you sure you want to change the base?
Conversation
@@ -51,6 +51,7 @@ PREP(wire_onFired); | |||
|
|||
// Seeker OnFired | |||
PREP(SACLOS_onFired); | |||
PREP(doppler_onFired); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z\ace\addons\aim120 | |
z\ace\addons\aim120 | |
* [] call ace_missileguidance_fnc_mwr_onFired | ||
* | ||
* Public: No | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference.
*/ | |
*/ | |
}; | ||
// always allow tracking of projectiles | ||
if !(_target isKindOf "AllVehicles" || { (typeOf _target) isKindOf ["Default", configFile >> "CfgAmmo"] }) then { | ||
_target = nil; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
TRACE_2("dont filter helicopters",_target isKindOf "Helicopter",isEngineOn _target); | |
TRACE_1("dont filter helicopters",_target); |
private _shooterHasActiveRadar = { | ||
if ("ActiveRadarSensorComponent" in _x) exitWith { true }; | ||
false | ||
} forEach listVehicleSensors vehicle _shooter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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); | ||
}; |
There was a problem hiding this comment.
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).
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) |
There was a problem hiding this comment.
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.
(_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 |
private _projectileThrust = [_projectileConfig >> "thrust", "NUMBER", 0] call CBA_fnc_getConfigEntry; | ||
private _projectileThrustTime = [_projectileConfig >> "thrustTime", "NUMBER", 0] call CBA_fnc_getConfigEntry; |
There was a problem hiding this comment.
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.
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"); |
When merged this pull request will:
Merge Strategy
Follow #10019
IMPORTANT
Component - Add|Fix|Improve|Change|Make|Remove {changes}
.