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

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft

Missile Guidance - Add Copperhead M712 #8210

wants to merge 41 commits into from

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!? 😂

addons/clgp/functions/fnc_copperhead_uiCreate.sqf Outdated Show resolved Hide resolved
// If we didn't get a target, try to fall back on tab locking
if (isNil "_target") then {
if (!isPlayer _shooter) then {
// This was an AI shot, lets still guide it on the AI target
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
// This was an AI shot, lets still guide it on the AI target
// This was an AI shot, let's still guide it on the AI target

// 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); };

// Changing path without active feedback causes problems on current missile guidance
// probably due to poor vector change in ace_missileguidance_fnc_guidancePFH, disable for now
private _trajectoryShaped = false;
// private _trajectoryShaped = _trajectorySetting >= 3; // 1-2 is ballisitic, 3-8 is shaped
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 _trajectoryShaped = _trajectorySetting >= 3; // 1-2 is ballisitic, 3-8 is shaped
// private _trajectoryShaped = _trajectorySetting >= 3; // 1-2 is ballistic, 3-8 is shaped

@@ -0,0 +1,12 @@
#define COMPONENT clgp
#define COMPONENT_BEAUTIFIED Cannon Launched Guided Projectiles
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
#define COMPONENT_BEAUTIFIED Cannon Launched Guided Projectiles
#define COMPONENT_BEAUTIFIED Cannon-Launched Guided Projectiles

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.

3 participants