-
Notifications
You must be signed in to change notification settings - Fork 740
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 - Iron dome for defending against projectiles #10038
Open
TheCandianVendingMachine
wants to merge
287
commits into
master
Choose a base branch
from
iron_dome
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
287 commits
Select commit
Hold shift + click to select a range
e9d474c
remove placeholder
TheCandianVendingMachine e1436d6
Change out missile types to reflect navigation scheme they use IRL
TheCandianVendingMachine d34201e
remove uneeded sets
TheCandianVendingMachine a2d2dd0
chane navigation profiles to go for attack direction instead of target
TheCandianVendingMachine af2b9a2
multiple changes
TheCandianVendingMachine 555f0c8
SALH: only update seeker pos if it within small error
TheCandianVendingMachine e2c8ddf
IR seeker and AIM-9M
TheCandianVendingMachine c714fb5
small tweaks
TheCandianVendingMachine fe2fedd
more tweaks
TheCandianVendingMachine 8d52a2e
todo: fix nlaw
TheCandianVendingMachine a485399
update todo
TheCandianVendingMachine d077528
implement course state machine
TheCandianVendingMachine 8318b60
Improve radar simulation
TheCandianVendingMachine 26dee9f
enable chaff decoy
TheCandianVendingMachine 0848d74
add config entries
TheCandianVendingMachine abc5bab
Implement optical mavericks
TheCandianVendingMachine 1b000d6
Allow for debug info to be displayed via variable
TheCandianVendingMachine 8f03b5b
Change AIM-9 agility
TheCandianVendingMachine fe1e6d4
update dragon to not use new guidance
TheCandianVendingMachine 265670c
Tweak flight parameters. Add R-77
TheCandianVendingMachine 8b88142
Add AIM-120A
TheCandianVendingMachine d622e4d
add ASRAAM
TheCandianVendingMachine f942231
add R-73/4
TheCandianVendingMachine e7919da
Add all GBU-12s that exist for all planes
TheCandianVendingMachine 23cd1ef
update todo
TheCandianVendingMachine b18508b
update todo for ground based weapons
TheCandianVendingMachine e1cdbb7
Add GPS selector dialog for GPS munitions
TheCandianVendingMachine 3878c67
add TOO TGP
TheCandianVendingMachine 44b7b87
Add SDB and JDAM
TheCandianVendingMachine 1cb8408
update todo
TheCandianVendingMachine 12bcb95
fix gimbal lock via rotating with quaternions
TheCandianVendingMachine 438cb8b
tweak JDAM guidance
TheCandianVendingMachine aea24c6
Better attack angle calculation. Does not get exactly right, but work…
TheCandianVendingMachine 9d26335
Fix SACLOS missiles
TheCandianVendingMachine 19dcf00
Fix NLAW and PLOS
TheCandianVendingMachine afbb1f6
update todo
TheCandianVendingMachine ba2eb48
update todo
TheCandianVendingMachine 6b3be24
Add Vikhr ATGM
TheCandianVendingMachine a91b3aa
Add long range SAMs
TheCandianVendingMachine cba9dcd
fix SAM animations
TheCandianVendingMachine 675b07d
Add all ground based missiles. Tweak AIM-9 flare angle
TheCandianVendingMachine a057768
remove debugh print
TheCandianVendingMachine 7398033
Fix Wiesel ATGM animation. Tweak SACLOS values
TheCandianVendingMachine 6cfc075
Add action to get into jdam settings
TheCandianVendingMachine 73b0598
fix all script components
TheCandianVendingMachine f5b3161
Add paremter to allow weathervaning
TheCandianVendingMachine 197c1a7
Add new navigation profile. Tweak javelin mid-course guidance
TheCandianVendingMachine de05c68
Process all navigation onFired. Send the correct array to function
TheCandianVendingMachine edc8250
fix missing semicolons
TheCandianVendingMachine b4e5a29
Add hellfire mid course guidance
TheCandianVendingMachine 356ff4c
Tweak hellfire attack profile
TheCandianVendingMachine f3bea7b
change how IR seeker performs
TheCandianVendingMachine 89e64df
tabs -> spaces
TheCandianVendingMachine 79bd76a
localise aim120
TheCandianVendingMachine f12e934
localise aim9
TheCandianVendingMachine 988768a
localise gbu
TheCandianVendingMachine c0e623a
fix IR tracker losing lock immediately due to being blocked by launcher
TheCandianVendingMachine c67bc4d
localise manpad
TheCandianVendingMachine 5edabba
actually localise manpad
TheCandianVendingMachine 0d38505
localise maverick
TheCandianVendingMachine f45ee87
localise missile guidance
TheCandianVendingMachine 0a28e3e
localise sam
TheCandianVendingMachine 72297be
localise sdb
TheCandianVendingMachine 7988469
localise vikhr
TheCandianVendingMachine 80b2595
tabs -> spaces again
TheCandianVendingMachine 20a3277
init commit 9m14
TheCandianVendingMachine d8fb608
update stringtables so they are in titlecase
TheCandianVendingMachine a0e193a
crash on load
TheCandianVendingMachine e76fde4
perplexed
TheCandianVendingMachine f4f3224
fix game crashing on load
TheCandianVendingMachine 8b3e909
Add joystick model
TheCandianVendingMachine fc7b310
Add realistic 9m14 behaviour
TheCandianVendingMachine 5315b11
add MCLOS guidance
TheCandianVendingMachine 1756524
add the ability to see a light trail
TheCandianVendingMachine ef529d2
tweak HOT guidance params
TheCandianVendingMachine c71be65
tweak metis guidance params
TheCandianVendingMachine 6165be0
tweak Vikhr guidance
TheCandianVendingMachine b82484b
add trail to vikhr
TheCandianVendingMachine 980c3d0
Add Iron Dome interceptor API
TheCandianVendingMachine a25cf70
Optimise iron dome
TheCandianVendingMachine f825d6f
Only launch if we are above a threshold angle
TheCandianVendingMachine 72ca725
add local event for mission makers
TheCandianVendingMachine e67aefc
change events to allow for any number of arguments
TheCandianVendingMachine 36d7576
avoid making un-needed calls to the server
TheCandianVendingMachine f7bd523
Update doppler seeker to allow the tracking and killing of projectiles
TheCandianVendingMachine 395b2b2
Avoid overshooting target
TheCandianVendingMachine 790faf1
Add settings for various things
TheCandianVendingMachine 22e5596
Add missile hiding for malyutka
TheCandianVendingMachine 2694453
init commit of cruise missile
TheCandianVendingMachine c5972e6
Various - Add missing units/weapons to cfgPatches (#8175)
PabstMirror dd5bd46
Documentation - Add Mikero binarization note (#8172)
jonpas fac35d5
Bump is-svg from 4.2.1 to 4.3.1 in /docs/src (#8177)
dependabot[bot] d9261c4
Adjust "New issue" link to lead to template selection page (#8182)
bux a5d7a00
Update linguist settings (#8151)
veteran29 44ecfc8
Typo in usage example (#8201)
t-zilla 4e3d3ce
Mk6 Mortar - Fix README.md typo (#8205)
jonpas 560a1da
Overhaul CSW docs (#8206)
BaerMitUmlaut b181f1b
Medical - Add Alternative Survival Chance (#8192)
fdc3ab0
Fix make.py temp files cleanup (#8189)
Dystopian 9d6843f
Fix Injured Sounds Not Playing At Altitudes Above 70 (#8212)
commy2 090aa5d
Particles - Fix macro (#8214)
Mike-MF 517b576
Map - Fix stuck map compass size (add 0.1 zoom duration) (#8176)
R3voA3 fa870a3
Medical - Allow unconscious unit in Taru pods (#8168)
ampersand38 7c87997
Name Tags - Add ability to set custom rank icon (#8174)
Drift91 3b9f374
Tools - Add script to update HEMTT include folder (#8134)
PabstMirror e3a3e29
Tools - Add script to check sqf/config with sqfvm (#8137)
PabstMirror c7d4981
Medical - Add Vehicle Crashes setting (#8149)
LinkIsGrim 026b949
Dragging - Add new dragging animations (#7950)
Malbryn d41c5bd
Dragging - Fix build issue (#8219)
Mike-MF 011389c
Documentation - Remove DeTex requirement (#8220)
jonpas 89fb57f
User Interface - Add setting for Development Build watermark (#8140)
Dystopian 4678518
RHS USAF Compat - Nightforce NXS scopes updated (#8222)
Laid3acK a80a0b8
Interact Menu - Make List default (#8217)
jonpas f1338e6
Markers - Add scale slider (#8059)
frankplow d8bdde0
Initial push (#8225)
JoramD0 e2e747e
MicroDAGR - Add mode switching keybinds (#8216)
JoramD0 996bbd2
RHS ARF Compat - Fix RPK74M wrong ammo bug (#8223)
Dabako e6d337a
Extensions - Various Improvments (#8227)
PabstMirror cc0d8a5
Translations - Spanish (#8229)
regiregi22 825596b
Attach - Added attached/detaching events (#8193)
dedmen c425b35
Markers - Fix marker scale (#8233)
PabstMirror 4726108
Cargo - paradrop fixes (#8203)
LupusTheCanine 00eead4
Parachute - Add failure chance (#8226)
JoramD0 078a0b6
Bump lodash from 4.17.20 to 4.17.21 in /docs/src (#8244)
dependabot[bot] e6de643
Bump grunt from 1.0.4 to 1.3.0 in /docs/src (#8246)
dependabot[bot] 173f86f
Bump hosted-git-info from 2.5.0 to 2.8.9 in /docs/src (#8247)
dependabot[bot] a715a5f
Markers - Fix JIP scale (#8248)
jonpas ede5c1d
Night Vision - Add color variants to all generations (#8209)
JoramD0 e082d75
Fix wrong shot size in birdshot strings (#8253)
Drofseh d3de5a9
Patachute - Add sound effect when cutting (#8239)
PabstMirror 52116c7
Changes poisson disc to centered random. (#8257)
LorenLuke 9122535
Fix tabs and manpad UBC
PabstMirror e5f791d
Merge branch 'master' into pr/8215
PabstMirror e3e3605
fix tabs in aim9
PabstMirror f89bf62
progress update: tercom now flies to acquisition basket
TheCandianVendingMachine 597e188
Merge branch 'missileDynamics' of https://github.com/TheCandianVendin…
TheCandianVendingMachine e6fcd11
add TERCOM state defines
TheCandianVendingMachine 7cf29ba
work on parsing heightmap
TheCandianVendingMachine 79c6bf9
Change GBU navigation
TheCandianVendingMachine 4308d33
remove testing constants
TheCandianVendingMachine 8142bb0
remove TERCOM guidance
TheCandianVendingMachine 038c82a
better JDAM simulation
TheCandianVendingMachine d8eb425
Better flare decoy calculation
TheCandianVendingMachine 5acc277
Update 9m14_joystick.p3d
PabstMirror d50491f
Destroy projectile on all clients
TheCandianVendingMachine 25b1b47
Merge branch 'missileDynamics' of https://github.com/TheCandianVendin…
TheCandianVendingMachine aff19ec
fix NLAW navigation profile
TheCandianVendingMachine 7b7d79f
fix uninitialised values
TheCandianVendingMachine 76c5c6e
make over-fly trajectory over-fly
TheCandianVendingMachine 98e66d2
remove malyutka
TheCandianVendingMachine 82c14a0
SACLOS tweaks
TheCandianVendingMachine 9595640
Merge remote-tracking branch 'ACERemote/master' into missileDynamics
TheCandianVendingMachine 120d16c
small changes
TheCandianVendingMachine 0123216
fix bug in laser
TheCandianVendingMachine 17e211e
Merge branch 'laserRevert' into missileDynamics
TheCandianVendingMachine 9a2d631
make pronav use the correct units
TheCandianVendingMachine 10c2019
change back
TheCandianVendingMachine 34c7b57
add dev function to get ammo which has MG class data
TheCandianVendingMachine d8ebc35
improve lin navigation
TheCandianVendingMachine 7f398a8
Merge branch 'master' into pr/8215
PabstMirror b40903b
Merge branch 'master' into pr/8215
PabstMirror a26e269
Minor style
PabstMirror f9ea835
add spike ATGM
TheCandianVendingMachine 36f148d
Allow multiple cameras to exist at once. Fix script error
TheCandianVendingMachine c6c313a
fix bug with angles close to 0
TheCandianVendingMachine 7d009d2
remove debug
TheCandianVendingMachine 7460bb3
misc updates
TheCandianVendingMachine 8da028b
Handle pre-tracking
TheCandianVendingMachine e91b8bc
Tweak target acquisition. Reset target after shooting
TheCandianVendingMachine becc9d2
Tweak how targets are acquired. Fix velocity calculation
TheCandianVendingMachine fd5b8a2
tweak navigation to allow for <200m shots
TheCandianVendingMachine 7bb7b6f
enhance target designation
TheCandianVendingMachine d8554eb
Stringtable addition
TheCandianVendingMachine 745a47f
Config changes
TheCandianVendingMachine 5b4e29a
Merge branch 'missileDynamics' of github.com:TheCandianVendingMachine…
TheCandianVendingMachine 9452de5
Merge branch 'master' of https://github.com/acemod/ACE3 into missileD…
TheCandianVendingMachine 20ad628
more SACLOS tweaks
TheCandianVendingMachine e318e85
Some minor fixes
PabstMirror ad2842b
fix undefined array
TheCandianVendingMachine c2ef6b8
Merge branch 'missileDynamics' of github.com:TheCandianVendingMachine…
TheCandianVendingMachine 97f3bb3
Only play sound when Spike is launcher. Change onFired to missileguid…
TheCandianVendingMachine 56c85fc
Tweak IR seeker. Fix MCLOS fired from vehicles
TheCandianVendingMachine f9241fe
Remove debug sets
TheCandianVendingMachine 71e01a2
Update all Line guidance missiles
TheCandianVendingMachine f79dde5
remove debug sets
TheCandianVendingMachine 76bb679
Merge branch 'master' into pr/8215
PabstMirror 67fe609
tweak javelin to make minimum ranges more realistic
TheCandianVendingMachine d944f09
Merge branch 'missileDynamics' of github.com:TheCandianVendingMachine…
TheCandianVendingMachine 2041c88
Merge branch 'master' into pr/8215
PabstMirror f4152ec
cut spike
TheCandianVendingMachine e46cd2c
add better error messaging
TheCandianVendingMachine 0b7c89a
better debug info
TheCandianVendingMachine 0531abb
Rewrite documentation
TheCandianVendingMachine 5a55d2d
Add ability to disable iron dome (disabled by default)
TheCandianVendingMachine bcd753f
Change name
TheCandianVendingMachine a79f987
fix typo
TheCandianVendingMachine 743add1
Remove null projectiles from iron dome nonTrackingProjectiles
SzwedzikPL 6aba4b0
Merge pull request #4 from SzwedzikPL/irondome-cleanupprojectiles
TheCandianVendingMachine 3573aef
HEMTT v10 Compatibility
BrettMayson 2fb1f00
Update addons/field_rations/CfgUIGrids.hpp
BrettMayson f4ea561
fix PabstMirror review
BrettMayson 2f05c99
optionals
BrettMayson 832b0c9
Merge remote-tracking branch 'brett/hemtt_v10'
TheCandianVendingMachine 16dee0a
Merge branch 'master' into pr/8215
PabstMirror abef4fd
Merge branch 'master' into missileDynamics
TheCandianVendingMachine 0957a33
Change configs to enclose strings for calculations
TheCandianVendingMachine 01ac87d
Fix NLAW guidance that was causing massive overfly
TheCandianVendingMachine d1f5791
make tweaks for PLOS movement path
TheCandianVendingMachine 3af5717
fix NLAW overfly
TheCandianVendingMachine 28c166d
Merge branch 'master' into pr/8215
PabstMirror 7727fee
Fix hemmit merge
PabstMirror 2c0a720
Merge branch 'master' into pr/8215
PabstMirror 6e6d24a
fix header
PabstMirror 10065f7
Update fnc_seekerType_SACLOS.sqf
PabstMirror 477bdd0
Merge branch 'master' into pr/8215
PabstMirror b5bae13
Update to new include paths
PabstMirror f45c56a
Update fnc_midCourseTransition.sqf
PabstMirror 4197a6e
Merge branch 'master' into pr/8215
PabstMirror 825f40b
initSettings.inc.sqf
PabstMirror b5d0ae6
Merge branch 'master' into pr/8215
PabstMirror 6485898
Merge branch 'master' into pr/8215
PabstMirror 8aab5c4
Merge branch 'master' into pr/8215
PabstMirror f75f3d3
Remove weapon additions
TheCandianVendingMachine cbcc642
revert old weapons, pt1
TheCandianVendingMachine 074fc36
revert pt2
TheCandianVendingMachine 909a028
readd javelin
TheCandianVendingMachine bb4ff28
split iron dome
TheCandianVendingMachine af5f7d3
cleanup laser
TheCandianVendingMachine 1270d17
remove GPS files
TheCandianVendingMachine 744cd45
remove gps definitions
TheCandianVendingMachine 972ad68
remove IR
TheCandianVendingMachine 46aa1ae
remove MCLOS
TheCandianVendingMachine 87c819f
remove doppler
TheCandianVendingMachine 9ebd8fd
final cleanup
TheCandianVendingMachine 607cc8c
restore final final i promise
TheCandianVendingMachine bcb6ed7
cleanup arbitrary files
TheCandianVendingMachine ec608b2
Separate iron dome
TheCandianVendingMachine 02c1d79
small cleanup
PabstMirror 54f7494
fix hemtt warnings
PabstMirror 2e23f61
Merge branch 'master' into missile_guidance_rewrite
PabstMirror ed260fc
cleanup unused var
PabstMirror 1819cad
fix preping some missing files (jdam/doppler)
PabstMirror c70cb4f
Merge branch 'master' into missile_guidance_rewrite
PabstMirror 98f957e
move cam func
PabstMirror fcf817a
Merge branch 'master' into missile_guidance_rewrite
PabstMirror 7376a88
Merge branch 'master' into missile_guidance_rewrite
PabstMirror cfaa658
Merge branch 'missile_guidance_rewrite' into iron_dome
PabstMirror 28e8578
Merge branch 'master' into iron_dome
PabstMirror 6caca8c
Merge branch 'master' into iron_dome
PabstMirror 8129abf
sort st
PabstMirror File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z\ace\addons\iron_dome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Extended_PreStart_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_preStart)); | ||
}; | ||
}; | ||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_preInit)); | ||
}; | ||
}; | ||
|
||
class Extended_PostInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ace_iron_dome | ||
=================== | ||
|
||
Adds an Iron Dome projectile interceptor system | ||
|
||
|
||
## Maintainers | ||
|
||
The people responsible for merging changes to this component or answering potential questions. | ||
|
||
- [Dani (TCVM)](https://github.com/TheCandianVendingMachine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PREP(projectileTrackerPFH); | ||
PREP(proximityFusePFH); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "script_component.hpp" | ||
|
||
if (isServer && { GVAR(enable) }) then { | ||
[LINKFUNC(projectileTrackerPFH)] call CBA_fnc_addPerFrameHandler; | ||
[LINKFUNC(proximityFusePFH)] call CBA_fnc_addPerFrameHandler; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
PREP_RECOMPILE_START; | ||
#include "XEH_PREP.hpp" | ||
PREP_RECOMPILE_END; | ||
|
||
#include "initSettings.inc.sqf" | ||
|
||
// Server handles the tracking of all projectiles. It dispatches events to launchers to fire at specific targets | ||
// The tracker and launcher array are global to allow for early-out if it is impossible to kill any projectiles to avoid wasting bandwidth | ||
GVAR(trackers) = []; | ||
GVAR(launchers) = []; | ||
|
||
if (isServer) then { | ||
GVAR(nonTrackingProjectiles) = []; | ||
GVAR(trackingProjectiles) = []; | ||
|
||
GVAR(interceptors) = []; | ||
// Put these into hash table to avoid massive amounts of loops | ||
GVAR(toBeShot) = call CBA_fnc_hashCreate; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HashMaps are in vanilla already, though. |
||
|
||
[QGVAR(track), { | ||
params ["_projectile"]; | ||
GVAR(nonTrackingProjectiles) pushBack _projectile; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
[QGVAR(registerInterceptor), { | ||
params ["_interceptor", "_target"]; | ||
GVAR(interceptors) pushBack [_interceptor, _target, getPosASLVisual _interceptor, _interceptor distance _target]; | ||
[GVAR(toBeShot), _target] call CBA_fnc_hashRem; | ||
}] call CBA_fnc_addEventHandler; | ||
}; | ||
|
||
[QGVAR(registerLaunchers), { | ||
{ | ||
GVAR(launchers) pushBackUnique _x; | ||
_x setVariable [QGVAR(targetList), []]; | ||
_x setVariable [QGVAR(launchState), LAUNCH_STATE_IDLE]; | ||
_x setVariable [QGVAR(lastLaunchTime), 0]; | ||
_x setVariable [QGVAR(engagedTargets), [[], objNull] call CBA_fnc_hashCreate]; | ||
_x setVariable [QEGVAR(missileguidance,target), objNull]; | ||
|
||
if (local _x) then { | ||
_x addEventHandler ["Fired", { | ||
params ["_launcher", "", "", "", "", "", "_projectile"]; | ||
private _target = _launcher getVariable [QEGVAR(missileguidance,target), objNull]; | ||
if !(isNull _target) then { | ||
[QGVAR(registerInterceptor), [_projectile, _target]] call CBA_fnc_serverEvent; | ||
}; | ||
}]; | ||
}; | ||
} forEach _this; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
[QGVAR(registerTrackers), { | ||
{ | ||
_x params ["_tracker", "_range"]; | ||
GVAR(trackers) pushBack [_tracker, _range]; | ||
} forEach _this; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
// When something is fired, determine if we want to track it. If so, send it to the server for processing | ||
GVAR(projectilesToIntercept) = []; | ||
|
||
[QGVAR(addProjectilesToIntercept), { | ||
{ | ||
GVAR(projectilesToIntercept) pushBackUnique _x; | ||
} forEach _this; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
["All", "fired", { | ||
params ["", "", "", "", "", "", "_projectile"]; | ||
if (local _projectile && { (typeOf _projectile) in GVAR(projectilesToIntercept) }) then { | ||
// avoid extra bandwidth: don't make a call to the server if we don't have any systems up | ||
GVAR(launchers) = GVAR(launchers) select { | ||
alive _x | ||
}; | ||
GVAR(trackers) = GVAR(trackers) select { | ||
_x params ["_tracker"]; | ||
alive _tracker | ||
}; | ||
if !(GVAR(launchers) isEqualTo [] || { GVAR(trackers) isEqualTo [] }) then { | ||
[QGVAR(track), [_projectile]] call CBA_fnc_serverEvent; | ||
}; | ||
}; | ||
}] call CBA_fnc_addClassEventHandler; | ||
|
||
// Needed on all clients to properly destroy it. Despite the fact that deleteVehicle is AG EG, unless if you delete it on all clients there will still be missiles seen | ||
[QGVAR(destroyProjectile), { | ||
params ["_projectile"]; | ||
deleteVehicle _projectile; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
ADDON = true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
// no point having this system without missile guidance: nothing would happen | ||
requiredAddons[] = {"ace_common","ace_missileguidance"}; | ||
author = ECSTRING(common,ACETeam); | ||
authors[] = {"Dani (TCVM)"}; | ||
url = ECSTRING(main,URL); | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
|
204 changes: 204 additions & 0 deletions
204
addons/iron_dome/functions/fnc_projectileTrackerPFH.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* Handles tracking of incoming projectiles per frame | ||
* | ||
* Arguments: | ||
* 0: Args <ARRAY> | ||
* 1: Handle <NUMBER> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [ace_iron_dome_projectileTrackerPFH] call CBA_fnc_addPerFrameHandler | ||
* | ||
* Public: No | ||
*/ | ||
|
||
GVAR(trackers) = GVAR(trackers) select { | ||
_x params ["_tracker", "_range"]; | ||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,0,1], getPos _tracker, 0.75, 0.75, 0, format ["TRACKER [%1m]", _range], 1, 0.025, "TahomaB"]; | ||
#endif | ||
alive _tracker | ||
}; | ||
|
||
GVAR(launchers) = GVAR(launchers) select { | ||
alive _x | ||
}; | ||
|
||
[GVAR(toBeShot), { | ||
(CBA_missionTime - _value) < GVAR(targetRecycleTime) | ||
}] call CBA_fnc_hashFilter; | ||
|
||
private _idleLaunchers = GVAR(launchers) select { | ||
(_x getVariable QGVAR(launchState)) isEqualTo LAUNCH_STATE_IDLE && { someAmmo _x } | ||
}; | ||
|
||
// no point filtering if we don't have a launcher. Don't waste cycles | ||
if (_idleLaunchers isNotEqualTo []) then { | ||
|
||
GVAR(nonTrackingProjectiles) = GVAR(nonTrackingProjectiles) select { | ||
private _projectile = _x; | ||
if (isNull _projectile) then {continueWith false}; | ||
|
||
private _keep = true; | ||
private _bestRange = 1e10; | ||
|
||
{ | ||
_x params ["_tracker", "_range"]; | ||
_bestRange = _bestRange min (_projectile distanceSqr _tracker); | ||
if (_projectile distanceSqr _tracker <= _range * _range) exitWith { | ||
GVAR(trackingProjectiles) pushBack [_projectile, 0]; | ||
_keep = false; | ||
[QGVAR(projectileInRange), [_projectile, _tracker]] call CBA_fnc_localEvent; | ||
}; | ||
} forEach GVAR(trackers); | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], getPos _projectile, 0.75, 0.75, 0, format ["%1 %2m", typeOf _projectile, sqrt _bestRange], 1, 0.025, "TahomaB"]; | ||
#endif | ||
|
||
_keep | ||
}; | ||
|
||
GVAR(trackingProjectiles) = GVAR(trackingProjectiles) select { | ||
_x params ["_projectile", "_lastFired"]; | ||
|
||
private _keep = false; | ||
if (alive _projectile) then { | ||
{ | ||
_x params ["_tracker", "_range"]; | ||
private _withinRange = _projectile distanceSqr _tracker <= _range * _range; | ||
|
||
if (_withinRange) exitWith { | ||
_keep = true; | ||
}; | ||
|
||
} forEach GVAR(trackers); | ||
|
||
if !(_keep) then { | ||
GVAR(nonTrackingProjectiles) pushBack _projectile; | ||
} else { | ||
private _bestLauncher = objNull; | ||
private _bestAmmo = 0; | ||
|
||
private _engagedFuture = [GVAR(toBeShot), _projectile] call CBA_fnc_hashHasKey; | ||
|
||
private _engagedPast = GVAR(interceptors) findIf { | ||
_x params ["", "_target"]; | ||
_projectile isEqualTo _target; | ||
}; | ||
|
||
private _engaged = _engagedFuture || (_engagedPast != -1); | ||
if !(_engaged) then { | ||
// launch a missile | ||
// pick first idle launcher. Could use a heuristic, but that would require O(k*l) operations, and that could be a lot | ||
// 20 launchers * 100 projectiles = 2000 loops. Way too slow | ||
private _bestLauncher = _idleLaunchers select 0; | ||
_idleLaunchers deleteAt 0; | ||
|
||
private _targetList = _bestLauncher getVariable QGVAR(targetList); | ||
_targetList pushBackUnique _projectile; | ||
_bestLauncher setVariable [QGVAR(targetList), _targetList]; | ||
|
||
// avoid re-engaging same target | ||
[GVAR(toBeShot), _projectile, CBA_missionTime] call CBA_fnc_hashSet; | ||
}; | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,1,0,1], getPos _projectile, 0.75, 0.75, 0, format ["%1 %2m %3s", typeOf _projectile, _bestLauncher distance _projectile], 1, 0.025, "TahomaB"]; | ||
#endif | ||
}; | ||
}; | ||
|
||
_keep | ||
}; | ||
}; | ||
|
||
{ | ||
private _launcher = _x; | ||
private _state = _launcher getVariable QGVAR(launchState); | ||
|
||
switch (_state) do { | ||
case LAUNCH_STATE_IDLE: { | ||
private _targetList = _x getVariable QGVAR(targetList); | ||
private _engagedTargets = _x getVariable QGVAR(engagedTargets); | ||
|
||
_targetList = _targetList select { | ||
private _timeFiredAt = [_engagedTargets, _x, 0] call CBA_fnc_hashGet; | ||
alive _x && (_timeFiredAt == 0 || { (CBA_missionTime - _timeFiredAt) >= GVAR(targetRecycleTime) }) | ||
}; | ||
|
||
private _bestTarget = objNull; | ||
private _bestDistance = 1e10; | ||
{ | ||
if (_x distanceSqr _launcher < _bestDistance) then { | ||
_bestTarget = _x; | ||
_bestDistance = _x distanceSqr _launcher; | ||
}; | ||
} forEach _targetList; | ||
|
||
if !(isNull _bestTarget) then { | ||
_launcher setVariable [QEGVAR(missileguidance,target), _bestTarget]; | ||
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_TRACKING]; | ||
}; | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1, 1, 1, 1], getPos _launcher, 0.75, 0.75, 0, format ["IDLE [AMMO: %1]", someAmmo _launcher], 1, 0.025, "TahomaB"]; | ||
#endif | ||
}; | ||
case LAUNCH_STATE_TRACKING: { | ||
private _target = _launcher getVariable QEGVAR(missileguidance,target); | ||
_launcher lookAt getPosVisual _target; | ||
|
||
if (isNull _target) then { | ||
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_IDLE]; | ||
} else { | ||
private _directionToTarget = (getPosASLVisual _launcher) vectorFromTo (getPosASLVisual _target); | ||
private _turretDirection = _launcher weaponDirection currentWeapon _launcher; | ||
private _localDirection = _launcher vectorWorldToModelVisual _turretDirection; | ||
|
||
private _elevation = 90 - ((_localDirection#1) atan2 (_localDirection#2)); | ||
private _angle = acos (_turretDirection vectorCos _directionToTarget); | ||
|
||
if (_angle <= GVAR(launchAcceptableAngle) && _elevation >= GVAR(launchAcceptableElevation)) then { | ||
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_FIRING]; | ||
}; | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0, 0, 1, 1], getPos _launcher, 0.75, 0.75, 0, format ["TRACKING: %1 %2", _angle, _elevation], 1, 0.025, "TahomaB"]; | ||
drawLine3D [getPos _launcher, getPos _target, [0, 0, 1, 1]]; | ||
#endif | ||
}; | ||
}; | ||
case LAUNCH_STATE_FIRING: { | ||
private _turret = [_launcher, (crew _launcher) select 0] call CBA_fnc_turretPath; | ||
[_launcher, _launcher currentWeaponTurret _turret] call BIS_fnc_fire; | ||
|
||
_launcher setVariable [QGVAR(lastLaunchTime), CBA_missionTime]; | ||
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_COOLDOWN]; | ||
|
||
private _target = _launcher getVariable QEGVAR(missileguidance,target); | ||
private _engagedTargets = _x getVariable QGVAR(engagedTargets); | ||
[_engagedTargets, _target, CBA_missionTime] call CBA_fnc_hashSet; | ||
_x setVariable [QGVAR(engagedTargets), _engagedTargets]; | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1, 0, 0, 1], getPos _launcher, 0.75, 0.75, 0, format ["FIRING"], 1, 0.025, "TahomaB"]; | ||
#endif | ||
}; | ||
case LAUNCH_STATE_COOLDOWN: { | ||
private _lastLaunchTime = _launcher getVariable QGVAR(lastLaunchTime); | ||
if (CBA_missionTime - _lastLaunchTime >= GVAR(timeBetweenLaunches)) then { | ||
_launcher setVariable [QGVAR(launchState), LAUNCH_STATE_IDLE]; | ||
}; | ||
|
||
#ifdef DRAW_TRACKING_INFO | ||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0, 0, 1, 1], getPos _launcher, 0.75, 0.75, 0, format ["COOLDOWN %1", CBA_missionTime - _lastLaunchTime], 1, 0.025, "TahomaB"]; | ||
#endif | ||
}; | ||
}; | ||
} forEach GVAR(launchers); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
A boolean check is too cheap for lazy eval.
I just tested that without lazy eval (
isServer && true
) it takes 0.0011ms - 0.0027ms, whereas with lazy eval (isServer && {true}
) it always takes at least 0.0015ms (most of the time), sometimes up to 0.0045ms.