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

Missile Guidance - Add Copperhead M712 #8210

Merged
merged 47 commits into from
Mar 2, 2025
Merged

Missile Guidance - Add Copperhead M712 #8210

merged 47 commits into from
Mar 2, 2025

Conversation

PabstMirror
Copy link
Contributor

@PabstMirror PabstMirror commented Apr 16, 2021

Laser guided artillery round

  • Can configure flight params via 3d object (wouldn't it be neat if certain radio mods allowed this)

Adds capability to missile guidance:

  • Conditionally trigger a sub-munition (in this case it's launched as a shell and only extends wings at a pre-determined time, which triggers the original ammo and then continues the guidance on the new ammo object)
  • Optionally use vanilla deflection via setMissileTargetPos

ToDo:

  • Testing
  • Localization
  • Warhead stuff (it's a small shaped charge, probably reduce size of explosion)
  • Tweak attack profile
  • Documentation

Hoping to use some of this as a basis for more clgp/gravity bombs

@BrettMayson BrettMayson changed the title WIP: Add Copperhead M712 Missile Guidance - Add Copperhead M712 Oct 16, 2023
@BrettMayson BrettMayson marked this pull request as draft October 16, 2023 06:51
@jonpas
Copy link
Member

jonpas commented Oct 26, 2023

(wouldn't it be neat if certain radio mods allowed this)

Absolutely, where is the PR!? 😂

// Array for seek last target position
private _seekLastTargetPos = (getNumber ( _config >> "seekLastTargetPos")) == 1;
private _lastKnownPosState = [_seekLastTargetPos];
if (_seekLastTargetPos && {!isNil "_target"}) then {
Copy link
Contributor

Choose a reason for hiding this comment

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

Surely the lazy eval doesn't save anything with such a cheap check (on another var, no less) ?

Suggested change
if (_seekLastTargetPos && {!isNil "_target"}) then {
if (_seekLastTargetPos && !isNil "_target") then {

Comment on lines 87 to 107
[ _shooter,
[_target, _targetPos, _launchPos],
_seekerType,
_attackProfile,
_lockMode,
_laserInfo
],
[
getNumber ( _config >> "minDeflection" ),
getNumber ( _config >> "maxDeflection" ),
getNumber ( _config >> "incDeflection" ), // not used?
1 == getNumber ( _config >> "useVanillaDeflection" )
],
[
getNumber ( _config >> "seekerAngle" ),
getNumber ( _config >> "seekerAccuracy" ),
getNumber ( _config >> "seekerMaxRange" ),
getNumber ( _config >> "seekerMinRange" )
],
[ diag_tickTime, [], [], _lastKnownPosState ]
];
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
[ _shooter,
[_target, _targetPos, _launchPos],
_seekerType,
_attackProfile,
_lockMode,
_laserInfo
],
[
getNumber ( _config >> "minDeflection" ),
getNumber ( _config >> "maxDeflection" ),
getNumber ( _config >> "incDeflection" ), // not used?
1 == getNumber ( _config >> "useVanillaDeflection" )
],
[
getNumber ( _config >> "seekerAngle" ),
getNumber ( _config >> "seekerAccuracy" ),
getNumber ( _config >> "seekerMaxRange" ),
getNumber ( _config >> "seekerMinRange" )
],
[ diag_tickTime, [], [], _lastKnownPosState ]
];
[ _shooter,
[_target, _targetPos, _launchPos],
_seekerType,
_attackProfile,
_lockMode,
_laserInfo
],
[
getNumber ( _config >> "minDeflection" ),
getNumber ( _config >> "maxDeflection" ),
getNumber ( _config >> "incDeflection" ), // not used?
1 == getNumber ( _config >> "useVanillaDeflection" )
],
[
getNumber ( _config >> "seekerAngle" ),
getNumber ( _config >> "seekerAccuracy" ),
getNumber ( _config >> "seekerMaxRange" ),
getNumber ( _config >> "seekerMinRange" )
],
[ diag_tickTime, [], [], _lastKnownPosState ]
];

private _vehicle = _display getVariable "vehicle";
private _settings = _display getVariable "settings";
TRACE_3("Unload",_exitCode,_vehicle,_settings);
if ((!alive _vehicle) || {_settings isEqualTo []}) exitWith { ERROR_2("unloaded with bad input %1-%2",_vehicle,_settings); };
Copy link
Contributor

Choose a reason for hiding this comment

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

Surely the lazy eval doesn't save anything with such a cheap check ?

Suggested change
if ((!alive _vehicle) || {_settings isEqualTo []}) exitWith { ERROR_2("unloaded with bad input %1-%2",_vehicle,_settings); };
if ((!alive _vehicle) || _settings isEqualTo []) exitWith { ERROR_2("unloaded with bad input %1-%2",_vehicle,_settings); };

Comment on lines 23 to 28
&& {alive _vehicle}
&& {
private _hasCopperheadAmmo = false;
{
_x params ["_xMag", "_xTurret", "_xAmmo"];
if ((_xTurret isEqualTo [0]) && {_xAmmo > 0} && {_xMag == "ace_1rnd_155mm_m712"}) exitWith {
Copy link
Contributor

Choose a reason for hiding this comment

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

Surely the lazy eval don't save anything with such cheap checks ?

Suggested change
&& {alive _vehicle}
&& {
private _hasCopperheadAmmo = false;
{
_x params ["_xMag", "_xTurret", "_xAmmo"];
if ((_xTurret isEqualTo [0]) && {_xAmmo > 0} && {_xMag == "ace_1rnd_155mm_m712"}) exitWith {
&& alive _vehicle
&& {
private _hasCopperheadAmmo = false;
{
_x params ["_xMag", "_xTurret", "_xAmmo"];
if ((_xTurret isEqualTo [0]) && _xAmmo > 0 && {_xMag == "ace_1rnd_155mm_m712"}) exitWith {

if (_seekerTargetPos isEqualTo [0,0,0]) then {
// no target
_aimASL = _projectilePos vectorAdd _projectileVelocity;
if (_isFalling && {!_trajectoryBallistic}) then {
Copy link
Contributor

Choose a reason for hiding this comment

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

Surely the lazy eval doesn't save anything with such a cheap check ?

Suggested change
if (_isFalling && {!_trajectoryBallistic}) then {
if (_isFalling && !_trajectoryBallistic) then {

["turret", {
params ["_player", "_turret"];
private _veh = vehicle _player;
if (currentWeapon _veh == "mortar_155mm_AMOS") then {
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
if (currentWeapon _veh == "mortar_155mm_AMOS") then {
if (currentWeapon _veh isEqualTo "mortar_155mm_AMOS") then {

If currentWeapon always returns the correct casing.

TRACE_3("turret",_player,_turret,typeOf vehicle _player);
if (_turret isNotEqualTo [0]) exitWith {};
private _vehicle = vehicle _player;
if ((!alive _player) || {!alive _vehicle} || {_vehicle getVariable [QGVAR(copperhead_actionHandled), false]}) exitWith { TRACE_1("exit",_vehicle); };
Copy link
Contributor

Choose a reason for hiding this comment

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

Surely the lazy eval doesn't save anything with such a cheap check ?

Suggested change
if ((!alive _player) || {!alive _vehicle} || {_vehicle getVariable [QGVAR(copperhead_actionHandled), false]}) exitWith { TRACE_1("exit",_vehicle); };
if ((!alive _player) || !alive _vehicle || {_vehicle getVariable [QGVAR(copperhead_actionHandled), false]}) exitWith { TRACE_1("exit",_vehicle); };

class ace_missileguidance {
enabled = 2;
minDeflection = 0.001; // Minium flap deflection for guidance
maxDeflection = 0.001; // Maximum flap deflection for guidance
Copy link
Contributor Author

Choose a reason for hiding this comment

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

update for MG changes, eg:

    pitchRate = 15; // replace minDeflection, maxDeflection, incDeflection
    yawRate = 15;
    defaultNavigationType = "Direct";
    navigationTypes[] = { "Direct" };

Copy link
Contributor

Choose a reason for hiding this comment

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

preferably put this guidance config into CfgMissileTypesNato.hpp, but yeah this is required

class ace_missileguidance {
enabled = 2;
minDeflection = 0.001; // Minium flap deflection for guidance
maxDeflection = 0.001; // Maximum flap deflection for guidance
Copy link
Contributor

Choose a reason for hiding this comment

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

preferably put this guidance config into CfgMissileTypesNato.hpp, but yeah this is required

Copy link
Contributor

@TheCandianVendingMachine TheCandianVendingMachine left a comment

Choose a reason for hiding this comment

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

g2g, tested a previous version and guidance worked well. probably affected by #10715 but that will require a MG change, not relevant to this PR

@PabstMirror PabstMirror merged commit 416930e into master Mar 2, 2025
3 checks passed
@PabstMirror PabstMirror deleted the copperhead branch March 2, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants