Skip to content

Commit

Permalink
Missileguidance - Add MCLOS seeker type (#10027)
Browse files Browse the repository at this point in the history
* implement course state machine

* Improve radar simulation

* enable chaff decoy

* add config entries

* Implement optical mavericks

* Allow for debug info to be displayed via variable

* Change AIM-9 agility

* update dragon to not use new guidance

* Tweak flight parameters. Add R-77

* Add AIM-120A

* add ASRAAM

* add R-73/4

* Add all GBU-12s that exist for all planes

* update todo

* update todo for ground based weapons

* Add GPS selector dialog for GPS munitions

* add TOO TGP

* Add SDB and JDAM

* update todo

* fix gimbal lock via rotating with quaternions

* tweak JDAM guidance

* Better attack angle calculation. Does not get exactly right, but works for all cases.

Need to implement a PID controller navigation type to get a correct attack angle

* Fix SACLOS missiles

* Fix NLAW and PLOS

The missile pitches up due to initial angle stuff. I don't know if this is behaviour we want to fix or not?

* update todo

* update todo

* Add Vikhr ATGM

* Add long range SAMs

* fix SAM animations

* Add all ground based missiles. Tweak AIM-9 flare angle

* remove debugh print

* Fix Wiesel ATGM animation. Tweak SACLOS values

* Add action to get into jdam settings

* fix all script components

* Add paremter to allow weathervaning

Weapons usually tend toward the velocity vector due to aerodynamics - calculate side slip and use calculation to do this

* Add new navigation profile. Tweak javelin mid-course guidance

* Process all navigation onFired. Send the correct array to function

* fix missing semicolons

* Add hellfire mid course guidance

* Tweak hellfire attack profile

* change how IR seeker performs

The angle check is better now. Relative velocites guarenteed

* tabs -> spaces

* localise aim120

* localise aim9

* localise gbu

* fix IR tracker losing lock immediately due to being blocked by launcher

* localise manpad

* actually localise manpad

* localise maverick

* localise missile guidance

* localise sam

* localise sdb

* localise vikhr

* tabs -> spaces again

* init commit 9m14

* update stringtables so they are in titlecase

* crash on load

* perplexed

* fix game crashing on load

* Add joystick model

* Add realistic 9m14 behaviour

the 9m14 control joystick can attach 4 9m14 launchers at a time. Replicate that here

* add MCLOS guidance

* add the ability to see a light trail

* tweak HOT guidance params

* tweak metis guidance params

* tweak Vikhr guidance

* add trail to vikhr

* Add Iron Dome interceptor API

* Optimise iron dome

* Only launch if we are above a threshold angle

* add local event for mission makers

* change events to allow for any number of arguments

* avoid making un-needed calls to the server

* Update doppler seeker to allow the tracking and killing of projectiles

* Avoid overshooting target

* Add settings for various things

* Add missile hiding for malyutka

* init commit of cruise missile

* Various - Add missing units/weapons to cfgPatches (#8175)

* Various - Add missing units/weapons to cfgPatches

* Update config.cpp

* Documentation - Add Mikero binarization note (#8172)

* Bump is-svg from 4.2.1 to 4.3.1 in /docs/src (#8177)

Bumps [is-svg](https://github.com/sindresorhus/is-svg) from 4.2.1 to 4.3.1.
- [Release notes](https://github.com/sindresorhus/is-svg/releases)
- [Commits](sindresorhus/is-svg@v4.2.1...v4.3.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Adjust "New issue" link to lead to template selection page (#8182)

We want people to choose a template when creating a new issue

* Update linguist settings (#8151)

* Typo in usage example (#8201)

* Mk6 Mortar - Fix README.md typo (#8205)

* Overhaul CSW docs (#8206)

* Medical - Add Alternative Survival Chance (#8192)

Co-authored-by: TyroneMF <[email protected]>
Co-authored-by: Filip Maciejewski <[email protected]>
Co-authored-by: Kyle Mckay <[email protected]>

* Fix make.py temp files cleanup (#8189)

* Fix Injured Sounds Not Playing At Altitudes Above 70 (#8212)

* Particles - Fix macro (#8214)

* initial push

* Update script_component.hpp

* Update script_component.hpp

* Update script_component.hpp

* Map - Fix stuck map compass size (add 0.1 zoom duration) (#8176)

Co-authored-by: jonpas <[email protected]>

* Medical - Allow unconscious unit in Taru pods (#8168)

Co-authored-by: Filip Maciejewski <[email protected]>

* Name Tags - Add ability to set custom rank icon (#8174)

* Tools - Add script to update HEMTT include folder (#8134)

* Tools - Add script to check sqf/config with sqfvm (#8137)

* Medical - Add Vehicle Crashes setting (#8149)

Co-authored-by: jonpas <[email protected]>

* Dragging - Add new dragging animations (#7950)

* New custom animation added

* Adjusted CfgMoves and the script components

* New drop animation and key handler

* CBA settings and new ManActions added

* Adjustments to the drop animation

* Added translations and fixed some stuff

* Update CfgMovesBasic.hpp

* Fix translations

Co-authored-by: Elgin675 <[email protected]>
Co-authored-by: Blutze <[email protected]>

* Use the same key to drop object

* Update addons/dragging/stringtable.xml

Co-authored-by: Jo David <[email protected]>

* Fix French translation

Co-authored-by: Elgin675 <[email protected]>

* Lower the weapon accuracy of the drag animations

* Removed auto-switch to handgun

* Update fnc_startDrag.sqf

 - Holding a launcher breaks the firing animation.
 - Now the unit has to hold either a primary weapon or handgun.

* Handle the unit's current weapon

Co-authored-by: BaerMitUmlaut <[email protected]>

* Update addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf

Co-authored-by: Filip Maciejewski <[email protected]>

* Update addons/dragging/initSettings.sqf

Co-authored-by: Elgin675 <[email protected]>
Co-authored-by: Blutze <[email protected]>
Co-authored-by: Jo David <[email protected]>
Co-authored-by: BaerMitUmlaut <[email protected]>
Co-authored-by: Filip Maciejewski <[email protected]>
Co-authored-by: jonpas <[email protected]>

* Dragging - Fix build issue (#8219)

* Documentation - Remove DeTex requirement (#8220)

DeTex is subscriber-only now, not required for building ACE3.

* User Interface - Add setting for Development Build watermark (#8140)

Co-authored-by: jonpas <[email protected]>

* RHS USAF Compat - Nightforce NXS scopes updated (#8222)

* Interact Menu - Make List default (#8217)

* Markers - Add scale slider (#8059)

Co-authored-by: commy2 <[email protected]>
Co-authored-by: PabstMirror <[email protected]>
Co-authored-by: jonpas <[email protected]>

* Initial push (#8225)

* MicroDAGR - Add mode switching keybinds (#8216)

* Initial push

* Mode cycling

* Use defines

* RHS ARF Compat - Fix RPK74M wrong ammo bug (#8223)

* Fixed RPK74M wrong ammo bug

* Fix wrong deleted lines of code

* Edit rjs_weap_rpk74_base to rhs_weap_rpk_base

Co-authored-by: Dabako <[email protected]>
Co-authored-by: PabstMirror <[email protected]>

* Extensions - Various Improvments (#8227)

* Translations - Spanish (#8229)

Complete to date spanish translation.

* Attach - Added attached/detaching events (#8193)

* Added ace_attach attached/detach events

* Apply suggestions from code review

Co-authored-by: Jo David <[email protected]>

* Apply suggestions from code review

Co-authored-by: jonpas <[email protected]>

Co-authored-by: Jo David <[email protected]>
Co-authored-by: jonpas <[email protected]>

* Markers - Fix marker scale (#8233)

* Cargo - paradrop fixes (#8203)

* Small fixes in ace_cargo

Makes paradropItem and unloadItem invoke event "ace_cargoUnloaded" with parameters _itemObject, _vehicle and "paradrop" or "unload" respectivelty.
paradropItem invoked said event but if item was classname it would send classname to event which is not particularly useful.

* Update XEH_postInit.sqf

Moved event invocation to unloadItem, this provides ability to always pass object to eventhandlers.

* code refactor

refactored according to #8203 (comment)

* Update fnc_paradropItem.sqf

apply new fix

* Revert "Update fnc_paradropItem.sqf"

This reverts commit 3db5cc1.

* Update fnc_paradropItem.sqf

fixed hint that was broken by previous fixes

* style check

Co-authored-by: commy2 <[email protected]>

* style check

Co-authored-by: commy2 <[email protected]>

* naming convention

replaced object references called _item with _object.

* Update fnc_paradropItem.sqf

Co-authored-by: commy2 <[email protected]>

* Parachute - Add failure chance (#8226)

* Initial push

* disable forgotten define

* Improve exitWith check

* Requested/suggested changes

* Requested changes

* Requested changes

* Bump lodash from 4.17.20 to 4.17.21 in /docs/src (#8244)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump grunt from 1.0.4 to 1.3.0 in /docs/src (#8246)

Bumps [grunt](https://github.com/gruntjs/grunt) from 1.0.4 to 1.3.0.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](gruntjs/grunt@v1.0.4...v1.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hosted-git-info from 2.5.0 to 2.8.9 in /docs/src (#8247)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.5.0 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](npm/hosted-git-info@v2.5.0...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Markers - Fix JIP scale (#8248)

* Night Vision - Add color variants to all generations (#8209)

* Fix wrong shot size in birdshot strings (#8253)

* Patachute - Add sound effect when cutting (#8239)

* Changes poisson disc to centered random. (#8257)

It looks nicer and distributes more realistically. I don't know what I was thinking when I first put in poisson disc.

* Fix tabs and manpad UBC

* fix tabs in aim9

* progress update: tercom now flies to acquisition basket

* add TERCOM state defines

* work on parsing heightmap

* Change GBU navigation

* remove testing constants

* remove TERCOM guidance

* better JDAM simulation

Attack heading and impact angle now are followed better

* Better flare decoy calculation

* Update 9m14_joystick.p3d

removed p:\ part from proxy path:
was: `\p:\a3\data_f\proxies\gunner_static_low01\gunner.p3d`

* Destroy projectile on all clients

The projectile needs to be destroyed on all clients to stop it from being simulated. If not destroyed where projectile is local, it will still explode when hitting the ground. If not destroyed on remote clients, the projectile will still be visible but deal no damage

* fix NLAW navigation profile

* fix uninitialised values

* make over-fly trajectory over-fly

* remove malyutka

* SACLOS tweaks

* small changes

* fix bug in laser

* make pronav use the correct units

* change back

* add dev function to get ammo which has MG class data

* improve lin navigation

* Minor style

* add spike ATGM

* Allow multiple cameras to exist at once. Fix script error

* fix bug with angles close to 0

* remove debug

* misc updates

* Handle pre-tracking

* Tweak target acquisition. Reset target after shooting

* Tweak how targets are acquired. Fix velocity calculation

* tweak navigation to allow for <200m shots

* enhance target designation

* Stringtable addition

* Config changes

* more SACLOS tweaks

* Some minor fixes

* fix undefined array

* Only play sound when Spike is launcher. Change onFired to missileguidance

* Tweak IR seeker. Fix MCLOS fired from vehicles

* Remove debug sets

* Update all Line guidance missiles

* remove debug sets

* tweak javelin to make minimum ranges more realistic

* cut spike

* add better error messaging

* better debug info

* Rewrite documentation

* Add ability to disable iron dome (disabled by default)

* Change name

* fix typo

* Remove null projectiles from iron dome nonTrackingProjectiles

* HEMTT v10 Compatibility

* Update addons/field_rations/CfgUIGrids.hpp

Co-authored-by: PabstMirror <[email protected]>

* fix PabstMirror review

* optionals

* Change configs to enclose strings for calculations

* Fix NLAW guidance that was causing massive overfly

* make tweaks for PLOS movement path

* fix NLAW overfly

* Fix hemmit merge

* fix header

* Update fnc_seekerType_SACLOS.sqf

* Update to new include paths

* Update fnc_midCourseTransition.sqf

* initSettings.inc.sqf

* Remove weapon additions

* revert old weapons, pt1

* revert pt2

* readd javelin

* split iron dome

* cleanup laser

* remove GPS files

* remove gps definitions

* remove IR

* remove MCLOS

* remove doppler

* final cleanup

* restore final final i promise

* cleanup arbitrary files

* Isolate MCLOS

* small cleanup

* fix hemtt warnings

* cleanup unused var

* fix preping some missing files (jdam/doppler)

* move cam func

* apply small fixes first

* mclos updates

* future proof MCLOS

* Update fnc_mclosButtonPressed.sqf

* change filename for consistency

* Add warnings for bad configs

* Apply suggestions from code review

* re-add strings

* MCLOS - Add support for AI (#10701)

* MCLOS - Add support for AI

* Move `hasMCLOSControl` config to weapon

---------

Co-authored-by: PabstMirror <[email protected]>
Co-authored-by: jonpas <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jo David <[email protected]>
Co-authored-by: Filip Maciejewski <[email protected]>
Co-authored-by: Pascal Dunaj <[email protected]>
Co-authored-by: BaerMitUmlaut <[email protected]>
Co-authored-by: Brett <[email protected]>
Co-authored-by: TyroneMF <[email protected]>
Co-authored-by: Kyle Mckay <[email protected]>
Co-authored-by: Dystopian <[email protected]>
Co-authored-by: commy2 <[email protected]>
Co-authored-by: R3voA3 <[email protected]>
Co-authored-by: Steve Zhao <[email protected]>
Co-authored-by: Kyle J. McKeown <[email protected]>
Co-authored-by: Salluci <[email protected]>
Co-authored-by: Dániel Boros <[email protected]>
Co-authored-by: Elgin675 <[email protected]>
Co-authored-by: Blutze <[email protected]>
Co-authored-by: Laid3acK <[email protected]>
Co-authored-by: frankplow <[email protected]>
Co-authored-by: JoramD <[email protected]>
Co-authored-by: Dabako <[email protected]>
Co-authored-by: Dabako <[email protected]>
Co-authored-by: Abogado <[email protected]>
Co-authored-by: Dedmen Miller <[email protected]>
Co-authored-by: Lupus the Canine <[email protected]>
Co-authored-by: Drofseh <[email protected]>
Co-authored-by: LorenLuke <[email protected]>
Co-authored-by: SzwedzikPL <[email protected]>
Co-authored-by: BrettMayson <[email protected]>
Co-authored-by: johnb432 <[email protected]>
  • Loading branch information
1 parent 829a0c0 commit 4f86527
Show file tree
Hide file tree
Showing 19 changed files with 271 additions and 5 deletions.
16 changes: 16 additions & 0 deletions addons/common/CfgSounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@ class CfgSounds {
sound[] = {QPATHTOF(sounds\ACE_click.wav), 1, 1, 200};
titles[] = {};
};
class ACE_Sound_Click_10db {
sound[] = {QPATHTOF(sounds\ACE_click.wav), "db-10", 1, 200};
titles[] = {};
};
class ACE_Sound_Click_20db {
sound[] = {QPATHTOF(sounds\ACE_click.wav), "db-20", 1, 200};
titles[] = {};
};
class ACE_Sound_Click_30db {
sound[] = {QPATHTOF(sounds\ACE_click.wav), "db-30", 1, 200};
titles[] = {};
};
class ACE_Sound_Click_40db {
sound[] = {QPATHTOF(sounds\ACE_click.wav), "db-40", 1, 200};
titles[] = {};
};
};
8 changes: 8 additions & 0 deletions addons/missileguidance/ACE_GuidanceConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ class GVAR(SeekerTypes) {
functionName = QFUNC(seekerType_SACLOS);
onFired = QFUNC(SACLOS_onFired);
};
class MCLOS {
name = "";
visualName = "";
description = "";

functionName = QFUNC(seekerType_MCLOS);
onFired = QFUNC(MCLOS_onFired);
};
class MillimeterWaveRadar {
name = "";
visualName = "";
Expand Down
4 changes: 4 additions & 0 deletions addons/missileguidance/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ class CfgAmmo {
enabled = 1;
};
};

#ifdef CREATE_MOCK_PLATFORMS
#include "dev\mock_ammo.hpp"
#endif
};
4 changes: 4 additions & 0 deletions addons/missileguidance/CfgMagazines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ class CfgMagazines {
count = 24;
pylonWeapon = QGVAR(dagr);
};

#ifdef CREATE_MOCK_PLATFORMS
#include "dev\mock_magazines.hpp"
#endif
};
4 changes: 4 additions & 0 deletions addons/missileguidance/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ class CfgWeapons {
lockingTargetSound[] = {"",0,1};
lockedTargetSound[] = {"",0,1};
};

#ifdef CREATE_MOCK_PLATFORMS
#include "dev\mock_weapons.hpp"
#endif
};
4 changes: 4 additions & 0 deletions addons/missileguidance/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ PREP(handleHandoff);

PREP(shouldFilterRadarHit);

PREP(MCLOS_buttonPressed);

// Attack Profiles
PREP(attackProfile_AIR);
PREP(attackProfile_DIR);
Expand All @@ -47,6 +49,7 @@ PREP(navigationType_direct);
PREP(seekerType_SALH);
PREP(seekerType_Optic);
PREP(seekerType_SACLOS);
PREP(seekerType_MCLOS);
PREP(seekerType_Doppler);
PREP(seekerType_MWR);
PREP(seekerType_IR);
Expand All @@ -57,6 +60,7 @@ PREP(wire_onFired);
// Seeker OnFired
PREP(doppler_onFired);
PREP(SACLOS_onFired);
PREP(MCLOS_onFired);
PREP(mwr_onFired);
PREP(IR_onFired);

Expand Down
39 changes: 34 additions & 5 deletions addons/missileguidance/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
#include "script_component.hpp"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"

[QGVAR(handoff), LINKFUNC(handleHandoff)] call CBA_fnc_addEventHandler;

["ACE3 Weapons", QGVAR(cycleFireMode), localize LSTRING(CycleFireMode), {
[] call FUNC(cycleAttackProfileKeyDown);
false
["ACE3 Weapons", QGVAR(cycleFireMode), LLSTRING(CycleFireMode), {
[] call FUNC(cycleAttackProfileKeyDown)
}, {
false
},
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
[DIK_TAB, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key


// Each MCLOS argument is the vector which acceleration will be applied
["ACE3 Weapons", QGVAR(mclosUp), LLSTRING(mclosUp), {
[[0, 0, 1], ACE_player] call FUNC(MCLOS_buttonPressed)
}, {
[[0, 0, -1], ACE_player] call FUNC(MCLOS_buttonPressed)
},
[DIK_NUMPAD8, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 8

["ACE3 Weapons", QGVAR(mclosDown), LLSTRING(mclosDown), {
[[0, 0, -1], ACE_player] call FUNC(MCLOS_buttonPressed)
}, {
[[0, 0, 1], ACE_player] call FUNC(MCLOS_buttonPressed)
},
[DIK_NUMPAD2, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 2

["ACE3 Weapons", QGVAR(mclosLeft), LLSTRING(mclosLeft), {
[[1, 0, 0], ACE_player] call FUNC(MCLOS_buttonPressed)
}, {
[[-1, 0, 0], ACE_player] call FUNC(MCLOS_buttonPressed)
},
[DIK_NUMPAD6, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 6

["ACE3 Weapons", QGVAR(mclosRight), LLSTRING(mclosRight), {
[[-1, 0, 0], ACE_player] call FUNC(MCLOS_buttonPressed)
}, {
[[1, 0, 0], ACE_player] call FUNC(MCLOS_buttonPressed)
},
[DIK_NUMPAD4, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 4
4 changes: 4 additions & 0 deletions addons/missileguidance/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ class CfgPatches {
#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
#include "CfgWeapons.hpp"
#ifdef CREATE_MOCK_PLATFORMS
#include "dev\mock_vehicles.hpp"
#endif

15 changes: 15 additions & 0 deletions addons/missileguidance/dev/mock_ammo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class M_Titan_AA_static;
class GVAR(mock_a_Malyutka): M_Titan_AA_static {
aiAmmoUsageFlags="64 + 128 + 256 + 512";
weaponLockSystem = 0;
airLock = 0;
lockType = 0;
manualControl = 0;
thrust = 80;
maxSpeed = 100;
airFriction = 0.5;
sideairfriction = 0.14;
class ADDON: GVAR(type_Malyutka) {
enabled = 1;
};
};
4 changes: 4 additions & 0 deletions addons/missileguidance/dev/mock_magazines.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class 1Rnd_GAA_missiles;
class GVAR(mock_m_Malyutka): 1Rnd_GAA_missiles {
ammo = QGVAR(mock_a_Malyutka);
};
22 changes: 22 additions & 0 deletions addons/missileguidance/dev/mock_vehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class CfgVehicles {
class Car_F;
class LSV_02_base_F: Car_F {
class Turrets;
};
class LSV_02_AT_base_F: LSV_02_base_F {
class Turrets: Turrets {
class MainTurret;
};
};
class O_LSV_02_AT_F: LSV_02_AT_base_F {};
class GVAR(mock_lsv_Malyutka): O_LSV_02_AT_F {
scope = 1;
displayName = "[ACE] Test Malyutka LSV";
class Turrets: Turrets {
class MainTurret: MainTurret {
weapons[] = { QGVAR(mock_w_Malyutka) };
magazines[] = { QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka) };
};
};
};
};
7 changes: 7 additions & 0 deletions addons/missileguidance/dev/mock_weapons.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class MissileLauncher;
class GVAR(mock_w_Malyutka): MissileLauncher {
displayName = "Test Malyutka";
GVAR(hasMCLOSControl) = 1;
magazineReloadTime=1;
magazines[] = { QGVAR(mock_m_Malyutka) };
};
44 changes: 44 additions & 0 deletions addons/missileguidance/functions/fnc_MCLOS_buttonPressed.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Handles MCLOS guidance via keyboard keys
*
* Arguments:
* 0: Acceleration vector <ARRAY>
* 1: Unit <OBJECT>
*
* Return Value:
* If the button is pressed with an MCLOS context
*
* Example:
* [[0, 0, 1], player] call ace_missileguidance_fnc_MCLOS_buttonPressed
*
* Public: No
*/

params ["_accelerationDirection", "_player"];

private _shooter = vehicle _player;
if (_player == _shooter) exitWith {};
private _turret = _shooter unitTurret _player;

if (((_shooter weaponsTurret _turret) findIf {
(getNumber (configFile >> "CfgWeapons" >> _x >> QGVAR(hasMCLOSControl))) == 1
}) == -1) exitWith { false };


playSound "ACE_Sound_Click_20db";

private _currentDirection = _shooter getVariable [QGVAR(MCLOS_direction), [0, 0, 0]];
// Send data across network for handling non-local projectiles
// This is the case in a wanted development for a proper Malyutka implementation where projectiles will
// have their locality change via script
_shooter setVariable [QGVAR(MCLOS_direction), _currentDirection vectorAdd _accelerationDirection, true];

// Shouldn't have too many projectiles sent across the network. Planned max is 4 at a time
private _controlled = _shooter getVariable [QGVAR(mclos_projectiles), []];
_controlled = _controlled select { !isNull _x };
_shooter setVariable [QGVAR(mclos_projectiles), _controlled, true];

// if we are controlling missiles, we want the input to be captured
_controlled isNotEqualTo []
31 changes: 31 additions & 0 deletions addons/missileguidance/functions/fnc_MCLOS_onFired.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Sets up MCLOS state arrays (called from missileGuidance's onFired).
*
* Arguments:
* Guidance Arg Array <ARRAY>
*
* Return Value:
* None
*
* Example:
* [] call ace_missileguidance_fnc_MCLOS_onFired
*
* Public: No
*/
params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile", "_gunner"];

if !(_gunner call EFUNC(common,isPlayer)) then {
// AI shot - save shot info (ToDo: Handle offset for optics/launch dir?)
// _stateParams params ["", "_seekerStateParams"];
_stateParams set [1, [getPosASLVisual _projectile, vectorNormalized velocity _projectile]];
};
private _source = vehicle _shooter;

private _controlled = _source getVariable [QGVAR(mclos_projectiles), []];
_controlled pushBack _projectile;
_source setVariable [QGVAR(mclos_projectiles), _controlled];

_projectile setVariable [QGVAR(source), _source];
1 change: 1 addition & 0 deletions addons/missileguidance/functions/fnc_line_onFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ _firedEH params ["","","","","","","_projectile"];
private _ammoConfig = configOf _projectile;
private _p = getNumber (_ammoConfig >> QUOTE(ADDON) >> "lineGainP");
private _d = getNumber (_ammoConfig >> QUOTE(ADDON) >> "lineGainD");
if ((_p == 0) && {_d == 0}) then { WARNING_1("Ammo %1 has zero P/D",typeOf _projectile) };
private _correctionDistance = getNumber (_ammoConfig >> QUOTE(ADDON) >> "correctionDistance");

if (_correctionDistance == 0) then {
Expand Down
55 changes: 55 additions & 0 deletions addons/missileguidance/functions/fnc_seekerType_MCLOS.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* MCLOS seeker
*
* Arguments:
* 1: Guidance Arg Array <ARRAY>
* 2: Seeker State <ARRAY>
*
* Return Value:
* Position of wanted missile pos relative to the camera direction <ARRAY>
*
* Example:
* [] call ace_missileguidance_fnc_seekerType_MCLOS
*
* Public: No
*/
params ["", "_args"];
_args params ["_firedEH", "", "_flightParams", "", "_stateParams"];
_firedEH params ["_shooter","","","","","","_projectile","_gunner"];
_flightParams params ["_pitchRate", "_yawRate"];
_stateParams params ["", "_seekerStateParams"];

private _projectilePos = getPosASLVisual _projectile;
private _source = _projectile getVariable [QGVAR(source), _projectile];
private _mclosInput = (_source getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]);

if (_seekerStateParams isNotEqualTo []) then { // Handle AI
_seekerStateParams params ["_launchPos", "_launchVec"];
if (!(alive _shooter && {alive _gunner} && {(vehicle _gunner) == _shooter} && {_gunner call EFUNC(common,isAwake)})) exitWith {};

private _distance = _launchPos vectorDistance _projectilePos;
private _projectedPath = _launchPos vectorAdd (_launchVec vectorMultiply _distance);

private _hOffset = (_projectilePos # 2) - (_projectedPath # 2);
private _vv = (velocity _projectile) # 2;
_mclosInput = switch (true) do {
case (_hOffset < 0): { [0, 0, 1] }; // gross h adjust
case (_hOffset > 50): { [0, 0, -1] };
case ((_hOffset + 2 * _vv) < 0): { [0, 0, 1] }; // gross v adjust
case ((_hOffset + 2 * _vv) > 10): { [0, 0, -1] };
case ((_hOffset + _vv) > 5): { [0, 0, -1] }; // fine v adjust
default { [0, 0, 0] };
};
};

private _accelerationDirection = _projectile vectorModelToWorldVisual _mclosInput;
private _returnPos = _projectilePos vectorAdd (_accelerationDirection vectorMultiply (_pitchRate max _yawRate));

//IGNORE_PRIVATE_WARNING["_targetData"]
_targetData set [0, _projectilePos vectorFromTo _returnPos];
_targetData set [2, _returnPos distance _projectilePos];

_returnPos

1 change: 1 addition & 0 deletions addons/missileguidance/functions/fnc_wire_onFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ params ["_firedEH", "", "", "_seekerParams", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile", "_gunner"];
_stateParams params ["", "", "_attackProfileStateParams"];
_seekerParams params ["", "", "_seekerMaxRange", "_seekerMinRange"];
if (_seekerMaxRange < 1) then { WARNING_2("Ammo %1 has very short max range %2",typeOf _projectile,_seekerMaxRange) };

private _config = configOf _projectile >> "ace_missileguidance";
private _maxCorrectableDistance = [_config >> "correctionDistance", "NUMBER", DEFAULT_CORRECTION_DISTANCE] call CBA_fnc_getConfigEntry;
Expand Down
1 change: 1 addition & 0 deletions addons/missileguidance/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
// #define CREATE_MOCK_PLATFORMS

#ifdef DEBUG_ENABLED_MISSILEGUIDANCE
#define DEBUG_MODE_FULL
Expand Down
12 changes: 12 additions & 0 deletions addons/missileguidance/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,17 @@
<Turkish>Gelişmiş Füze Güdüm Sistemi</Turkish>
<Hungarian>Fejlett rakétairányító</Hungarian>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosDown">
<English>MCLOS Down</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosLeft">
<English>MCLOS Left</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosRight">
<English>MCLOS Right</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosUp">
<English>MCLOS Up</English>
</Key>
</Package>
</Project>

0 comments on commit 4f86527

Please sign in to comment.