Splash Damage with Clusters and Ship Radar effects (#206)

* Splash Damage with Clusters and Ship Radar effects
Based on the Splash Damage 2.0 by wheelyjoe, FrozenDroid and spencershepard/GRIMM (21 December 2021 version)

New features:
 -damage boost for parked aircraft since they are hard to kill (DCS: Retribution OCA/Aircraft mission improvement)
 -cluster weapons support
 -helicopter gunship autocannon fragmentation effect support
 -napalm will now spawn fire on impact
 -ship radars might turn off when hit with anti-radiation missiles
 -BDA messages for splash damage

New features can be tweaked, turned on or off in the Retribution settings and/or in the script options.

* Updated changelog.md

* Added missing changelog entry from 29 May 2022 to Weapons_Damage_Updated.lua

* Integrate splashdamageclusters into original

* Fix 'nil' exceptions

* Remove Ghosti's original implementation

---------

Co-authored-by: Raffson <Raffson@users.noreply.github.com>
This commit is contained in:
MetalStormGhost 2023-11-12 13:36:17 +02:00 committed by GitHub
parent 4cbadb1d81
commit 26f83cf269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 526 additions and 130 deletions

View File

@ -23,6 +23,7 @@
* **[Options]** New options in Settings: Helicopter waypoint altitude (feet AGL) for combat & cruise waypoints
* **[Options]** New options in Settings: Spawn ground power trucks at ground starts in airbases/roadbases
* **[Options]** Option for hiding TGOs (with IADS roles) on MFD
* **[Plugins]** Splash Damage 2.1 with Clusters and Ship Radar effects.
## Fixes
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 wheelyjoe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -34,18 +34,41 @@ spencershepard (GRIMM):
spencershepard (GRIMM):
added new/missing weapons to explTable
added new option rocket_multiplier
29 May 2022
Ghosti (MetalStormGhost):
- Implemented generating extra explosions near BLU-97/B hits to simulate the missing submunitions which are omitted by ED
due to performance reasons. This is an attempt at making the A-model JSOW more useful against groups of soft targets.
3 August 2022
Ghosti (MetalStormGhost):
SPLASH DAMAGE WITH CLUSTERS AND SHIP RADAR EFFECTS:
-damage boost for parked aircraft since they are hard to kill (DCS: Retribution OCA/Aircraft mission improvement)
-additional cluster weapons support
-helicopter gunship autocannon fragmentation effect support
-napalm will now spawn fire on impact
-ship radars might turn off when hit with anti-radiation missiles
-BDA messages for splash damage
12 November 2023
Raffson:
- integrate Ghosti's implementation into original script
--]]
----[[ ##### SCRIPT CONFIGURATION ##### ]]----
splash_damage_options = {
["static_damage_boost"] = 2000, --apply extra damage to Unit.Category.STRUCTUREs with wave explosions
["oca_aircraft_damage_boost"] = 3000, --apply extra damage to parked Unit.Category.AIRPLANEs and Unit.Category.HELICOPTERs with wave explosions
["wave_explosions"] = true, --secondary explosions on top of game objects, radiating outward from the impact point and scaled based on size of object and distance from weapon impact point
["larger_explosions"] = true, --secondary explosions on top of weapon impact points, dictated by the values in the explTable
["damage_model"] = false, --allow blast wave to affect ground unit movement and weapons
["blast_search_radius"] = 100, --this is the max size of any blast wave radius, since we will only find objects within this zone
["cascade_damage_threshold"] = 0.1, --if the calculated blast damage doesn't exeed this value, there will be no secondary explosion damage on the unit. If this value is too small, the appearance of explosions far outside of an expected radius looks incorrect.
["firebomb_splash_factor"] = 8, --apply a multiplier to thermobaric and napalm bombs so it matches the visual effect
["game_messages"] = true, --enable some messages on screen
["message_time"] = 20, --BDA messages remain this time on the screen, in seconds, if the option is enabled
["blast_stun"] = false, --not implemented
["unit_disabled_health"] = 30, --if health is below this value after our explosions, disable its movement
["unit_cant_fire_health"] = 50, --if health is below this value after our explosions, set ROE to HOLD to simulate damage weapon systems
@ -54,6 +77,10 @@ splash_damage_options = {
["weapon_missing_message"] = false, --false disables messages alerting you to weapons missing from the explTable
["rocket_multiplier"] = 1.3, --multiplied by the explTable value for rockets
["explTable_multiplier"] = 1.0, --overall multiplier for explTable
["cluster_multiplier"] = 1.0, --overall multiplier for clusterDamage
["clusterEffectsEnable"] = false,
["shipRadarDamageEnable"] = false,
["cluster_munition_distribution_radius"] = 75, --distribution radius of submunition explosions, in meters, TODO: make this depend on the weapon type
}
local script_enable = 1
@ -67,93 +94,120 @@ explTable = {
["FAB_250M54TU"]= 100,
["FAB_500"] = 213,
["FAB_1500"] = 675,
["BAP_100"] = 100,
["BetAB_500"] = 98,
["BetAB_500ShP"]= 107,
["KH-66_Grom"] = 108,
["M_117"] = 201,
["Mk_81"] = 60,
["Mk_81"] = 60, --
["Mk_82"] = 118,
["AN_M64"] = 121,
["AN_M64"] = 121, --
["Mk_83"] = 274,
["Mk_84"] = 582,
["Mk_84"] = 582, --
["MK_82AIR"] = 118,
["MK_82SNAKEYE"]= 118,
["MK_82SNAKEYE"]= 118, --
["GBU_10"] = 582,
["GBU_12"] = 118,
["GBU_12"] = 118, --
["GBU_16"] = 274,
["KAB_1500Kr"] = 675,
["KAB_1500Kr"] = 675, --
["KAB_500Kr"] = 213,
["KAB_500"] = 213,
["KAB_500"] = 213, --
["GBU_31"] = 582,
["GBU_31_V_3B"] = 582,
["GBU_31_V_3B"] = 582, --
["GBU_31_V_2B"] = 582,
["GBU_31_V_4B"] = 582,
["GBU_31_V_4B"] = 582, --
["GBU_32_V_2B"] = 202,
["GBU_38"] = 118,
["GBU_24"] = 582,
["X_23"] = 111,
["X_23L"] = 111,
["X_28"] = 160,
["X_25ML"] = 89,
["X_25MP"] = 89,
["X_25MR"] = 140,
["X_58"] = 140,
["X_29L"] = 320,
["X_29T"] = 320,
["X_29TE"] = 320,
["AGM_45"] = 89,
["AGM_45A"] = 89,
["AGM_62"] = 374,
["AGM_65A"] = 57,
["AGM_65B"] = 57,
["GBU_38"] = 118, --
["AGM_62"] = 400,
["GBU_24"] = 582, --
["X_23"] = 111, -- Kh-23 Grom anti-radar (AS-7 'Kerry')
["X_23L"] = 111, -- Kh-23L Grom laser (AS-7 'Kerry')
["X_28"] = 160, -- Kh-28 anti-radar (AS-9 'Kyle')
["X_25ML"] = 89, -- Kh-25ML laser (AS-10 'Karen')
["X_25MP"] = 89, -- Kh-25MP anti-radar (AS-12 'Kegler')
["X_25MR"] = 140, -- Kh-25MR TV (AS-12 'Kegler')
["X_58"] = 140, -- Kh-58 anti-radar (AS-11 'Kilter')
["X_29L"] = 320, -- Kh-29L laser (AS-14 'Kedge')
["X_29T"] = 320, -- Kh-29T TV (AS-14 'Kedge')
["X_29TE"] = 320, -- Kh_29TE export (AS-14 'Kedge')
["X_31P"] = 87, -- Kh-31P (AS-17 Krypton)
["X_65"] = 410, -- Kh-65 (AS-15B Kent)
["Rb 04E"] = 300,
["Rb 15F"] = 200,
["Rb 15F (for A.I.)"] = 200,
["RB75"] = 57,
["RB75B"] = 57,
["RB75T"] = 136,
["AGM_45A"] = 68,
["AGM_65D"] = 57,
["AGM_65E"] = 136,
["AGM_65F"] = 136,
["AGM_65G"] = 136,
["AGM_65H"] = 57,
["AGM_65K"] = 136,
["AGM_65L"] = 136,
["AGM_84A"] = 221,
["AGM_84D"] = 221,
["AGM_84S"] = 221,
["AGM_84E"] = 221,
["AGM_84H"] = 360,
["AGM_86"] = 908,
["AGM_86C"] = 908,
["AGM_88"] = 89,
["AGM_114K"] = 10,
["AGM_119"] = 130,
["AGM_122"] = 11,
["AGM_123"] = 450,
["AGM_88C"] = 89,
["AGM_114K"] = 8,
["AGM_114L"] = 8,
["AGM_122"] = 15,
["AGM_123"] = 274,
["AGM_130"] = 582,
["AGM_154"] = 225,
["AGR_20A"] = 8,
["S-24A"] = 24,
--["S-24B"] = 123,
["S-25OF"] = 194,
["S-25OFM"] = 150,
["S-25O"] = 150,
["S_25L"] = 190,
["S-5M"] = 1,
["C_8"] = 4,
["C_8OFP2"] = 3,
["C_13"] = 21,
["C_24"] = 123,
["C_25"] = 151,
["HYDRA_70M15"] = 3,
["Zuni_127"] = 5,
["ARAKM70BHE"] = 4,
["AGM_119"] = 176,
["AGM_154"] = 305, -- AGM-154C - JSOW Unitary BROACH
["AGM_154C"] = 305, -- AGM-154C - JSOW Unitary BROACH
["S-24A"] = 24, --
["S-24B"] = 123, --
["S-25OF"] = 194, --
["S-25OFM"] = 150, --
["S-25O"] = 150, --
["S_25L"] = 190, --
["S-5M"] = 5, --
["C_5"] = 5, -- S-5
["C_8"] = 8, -- S-8
["C_8CM"] = 8, -- S-8CM (с цветным дымом / with colored smoke )
["C_8OFP2"] = 8, -- S-8OFP2
["C_13"] = 21, -- S-13
["C_24"] = 123, -- S-24
["C_25"] = 151, -- S-25
["HVAR"] = 13,
["Zuni_127"] = 13,
["Zuni_127CM"] = 13,
["ARAKM70BHE"] = 14,
["BR_500"] = 118,
["Rb 05A"] = 217,
["HEBOMB"] = 40,
["HEBOMBD"] = 40,
["HEBOMB"] = 120,
["HEBOMBD"] = 120,
["MK-81SE"] = 60,
["AN-M57"] = 56,
["AN-M64"] = 180,
["AN-M65"] = 295,
["AN-M66A2"] = 536,
["HYDRA_70_M151"] = 4,
["HYDRA_70_MK5"] = 4,
["Vikhr_M"] = 11,
["HYDRA_70"] = 7, -- Hydra 70 2.75-inch/70mm rocket
["HYDRA_70_M151"] = 7, -- Hydra 70 2.75-inch/70mm rocket, M151 HEDP warhead
["HYDRA_70_M229"] = 7, -- Hydra 70 2.75-inch/70mm rocket, M229 HEDP warhead
["HYDRA_70_M282"] = 7, -- Hydra 70 2.75-inch/70mm rocket, M282 MPP (penetrator) warhead
["HYDRA_70_MK5"] = 7, -- Hydra 70 2.75-inch/70mm rocket, Mk5 HEAT warhead
["FFAR Mk1 HE"] = 8,
["FFAR Mk5 HEAT"] = 8,
["SNEB68_EAP"] = 7,
["SNEB_TYPE253_H1"] = 7,
["SNEB_TYPE251_F1B"] = 7,
["MALUTKA"] = 4, -- AT-3 Sagger / 9M14 Malyutka
["KONKURS"] = 3, -- AT-5 Spandrel / 9M113 Konkurs
["AT_6"] = 6, -- AT-6 Spiral / 9K114 Shturm
["Ataka_9M120"] = 8, -- AT-9 Spiral-2 / 9M120 Ataka
["Ataka_9M120F"] = 8 * splash_damage_options.firebomb_splash_factor, -- AT-9 Spiral-2 / 9M120F Ataka (thermobaric)
["P_9M117"] = 3, -- AT-10 Stabber / 9M117 Bastion
["SVIR"] = 5, -- AT-11 Sniper / 9M119 Svir
["REFLEX"] = 5, -- AT-11 Sniper / 9M119M Refleks
["Vikhr_M"] = 12, -- AT-16 Scallion / 9K121 Vikhr
["HOT2"] = 15,
["HOT3"] = 15,
["TOW2"] = 15,
["TOW"] = 15,
["URAGAN_9M27F"] = 100, -- BM-27 Uragan / 9M27F (220mm HE)
["SMERCH_9M55F"] = 243, -- BM-30 Smerch / 9M55F (300mm HE)
["ALARM"] = 66, -- ALARM (Air-Launched Anti-Radiation Missile) - 146lbs (66kg) direct fragmentation with proximity/contact fuse
["Sea_Eagle"] = 230,
["YJ-83K"] = 165, -- Air-launched YJ-83 anti-ship missile
["250-3"] = 100, --("250 lb GP")
["British_GP_250LB_Bomb_Mk1"] = 100, --("250 lb GP Mk.I")
["British_GP_250LB_Bomb_Mk4"] = 100, --("250 lb GP Mk.IV")
["British_GP_250LB_Bomb_Mk5"] = 100, --("250 lb GP Mk.V")
@ -170,30 +224,155 @@ explTable = {
["British_AP_25LBNo1_3INCHNo1"] = 4, --("RP-3 25lb AP Mk.I")
["British_HE_60LBSAPNo2_3INCHNo1"] = 4, --("RP-3 60lb SAP No2 Mk.I")
["British_HE_60LBFNo1_3INCHNo1"] = 4, --("RP-3 60lb F No1 Mk.I")
["WGr21"] = 4, --("Werfer-Granate 21 - 21 cm UnGd air-to-air rocket")
["3xM8_ROCKETS_IN_TUBES"] = 4, --("4.5 inch M8 UnGd Rocket")
["WGr21"] = 21, --("Werfer-Granate 21 - 21 cm UnGd air-to-air rocket")
["3xM8_ROCKETS_IN_TUBES"] = 12, --("4.5 inch M8 UnGd Rocket")
["AN_M30A1"] = 45, --("AN-M30A1 - 100lb GP Bomb LD")
["AN-M57"] = 100, --("AN-M57 - 250lb GP Bomb LD")
["AN-M64"] = 213, --("AN-M64 - 500lb GP Bomb LD")
["AN-M65"] = 400, --("AN-M65 - 1000lb GP Bomb LD")
["AN-M66A2"] = 536, --("AN-M66A2 - 2000lb GP Bomb LD")
["AN_M57"] = 100, --("AN-M57 - 250lb GP Bomb LD")
["AN_M65"] = 400, --("AN-M65 - 1000lb GP Bomb LD")
["AN_M66"] = 800, --("AN-M66 - 2000lb GP Bomb LD")
["AN_M66"] = 536, --("AN-M66 - 2000lb GP Bomb LD")
["AN_M66A2"] = 536, --("AN-M66 - 2000lb GP Bomb LD")
["AN_M81"] = 110, --("AN-M81 - 260lb GP Bomb LD")
["AN_M88"] = 97, --("AN-M88 - 216lb GP Bomb LD")
["SC_50"] = 20, --("SC 50 - 50kg GP Bomb LD")
["ER_4_SC50"] = 20, --("4 x SC 50 - 50kg GP Bomb LD")
["SC_250_T1_L2"] = 100, --("SC 250 Type 1 L2 - 250kg GP Bomb LD")
["SC_501_SC250"] = 100, --("SC 250 Type 3 J - 250kg GP Bomb LD")
["Schloss500XIIC1_SC_250_T3_J"] = 100, --("SC 250 Type 3 J - 250kg GP Bomb LD")
["SC_501_SC500"] = 213, --("SC 500 J - 500kg GP Bomb LD")
["SC_500_J"] = 213, --("SC 500 J - 500kg GP Bomb LD")
["SC_500_L2"] = 213, --("SC 500 L2 - 500kg GP Bomb LD")
["SD_250_Stg"] = 100, --("SD 250 Stg - 250kg GP Bomb LD")
["SD_500_A"] = 213, --("SD 500 A - 500kg GP Bomb LD")
["AB_250_2_SD_2"] = 100, --("AB 250-2 - 144 x SD-2, 250kg CBU with HE submunitions")
["AB_250_2_SD_10A"] = 100, --("AB 250-2 - 17 x SD-10A, 250kg CBU with 10kg Frag/HE submunitions")
["AB_500_1_SD_10A"] = 213, --("AB 500-1 - 34 x SD-10A, 500kg CBU with 10kg Frag/HE submunitions")
["HYDRA_70_M229"] = 8,
["HOT3"] = 15,
["GBU_54_V_1B"] = 118,
["LTF_5B"] = 100, --("LTF 5b Aerial Torpedo")
["BL_755"] = 132, --("BL755 - 147 x parachute-retarded HEAT submunitions, 264kg")
["MK77mod0-WPN"] = 110 * splash_damage_options.firebomb_splash_factor, --("Mk 77 Mod 0 - 750 lb (340 kg) with 110 U.S. gallons (416 L; 92 imp gal) of petroleum oil.")
["MK77mod1-WPN"] = 75 * splash_damage_options.firebomb_splash_factor, --("Mk 77 Mod 1 - 500 lb (230 kg) with 75 U.S. gallons (284 L; 62 imp gal) of petroleum oil.")
["BIN_200"] = 75 * splash_damage_options.firebomb_splash_factor, --("BIN-200 - 200 kg Spanish liquid incendiary Napalm filled bomb.")
["M_230_new"] = 3, --30mm M230 autocannon (AH-64)
["2A42"] = 3, --30mm Shipunov 2A42 autocannon (Ka-50)
["GSh_23_UPK"] = 2.3, --23mm GSh-23 autocannon (Ka-50)
["GSh_30_2K"] = 3, --30mm GSh-30 autocannon (Mi-24P)
--["BLU-97/B"] = 10,
--["BLU-97B"] = 10,
--["MK118"] = 8,
}
clusterDamage = {
["BK90_MJ1"] = 3, -- BK-90 MJ1 (72 x MJ1 HE-FRAG Bomblets)
["BK90_MJ2"] = 10, -- BK-90 MJ2 (24 x MJ2 HEAT Bomblets)
["BK90_MJ1_MJ2"] = 8, -- BK-90 MJ1+2 (12x MJ2 HEAT / 36x MJ1 HE-FRAG Bomblets)
["BLG-66"] = 0.51, -- BLG-66 Belouga AC - 305kg CBU, 151 x HEAT Bomblets
["GR_66_AC"] = 0.51, -- BLG-66 Belouga AC - 305kg CBU, 151 x HEAT Bomblets
--["ROCKEYE"] = 0.18, -- ("Mk-20 - 247 x Mk 118 Mod 1 bomblets, 222kg")
--["CBU_87"] = 0.287, -- CBU-87 - 202 x CEM Cluster Bomb
--["CBU_99"] = 0.18, -- CBU-99 - 247 x CEM Cluster Bomb
["Mk 118"] = 0.18, -- CBU-99 - 247 x CEM Cluster Bomb
["MK118"] = 0.18, -- CBU-99 - 247 x CEM Cluster Bomb
["BLU-97B"] = 0.287, -- CBU-87/103 - 202 x CEM, CBU with WCMD
["BLU-97/B"] = 0.287, -- AGM-154A - JSOW CEB (CBU-type) - 145 BLU-97/B Combined Effects Bomb (CEB) submunitions
--["AGM_154A"] = 0.287, -- AGM-154A - JSOW CEB (CBU-type) - 145 BLU-97/B Combined Effects Bomb (CEB) submunitions
["BLU-108"] = 30,
["PTAB-2.5KO"]= 10, -- BKF - 12 x PTAB-2.5KO
["AO-2.5RT"]= 10, -- BKF - 12 x AO-2.5RT
["AO-1SCh"] = 1.67, -- RBK-250-275 - 150 x AO-1SCh, 250kg CBU HE/Frag
["PTAB-2-5"] = 5.95, -- RBK-250 - 42 x PTAB-2.5M, 250kg CBU Medium HEAT/AP
["PTAB-10-5"] = 16.67, -- RBK-500-255 - 30 x PTAB-10-5 CBU Heavy HEAT/AP
["PTAB-1M"] = 1.75, -- RBK-500U - 268 x PTAB-1M CBU Light HEAT/AP
["OAB_2_5RT"] = 3.97, -- RBK-500U - 126 x OAB-2.5RT, 500kg CBU HE/Frag
["SD-2"] = 1.73, --("AB 250-2 - 144 x SD-2, 250kg CBU with HE submunitions")
["SD-10A"] = 10, --("AB 250-2/1 - 17/34 x SD-10A, 250/500kg CBU with 10kg Frag/HE submunitions")
}
clusterWeaps = {
["BK90_MJ1"] = 72, -- BK-90 MJ1 (72 x MJ1 HE-FRAG Bomblets)
["BK90_MJ2"] = 24, -- BK-90 MJ2 (24 x MJ2 HEAT Bomblets)
["BK90_MJ1_MJ2"] = 48, -- BK-90 MJ1+2 (12x MJ2 HEAT / 36x MJ1 HE-FRAG Bomblets)
["BLG-66"] = 151, -- BLG-66 Belouga AC - 305kg CBU, 151 x HEAT Bomblets
["GR_66_AC"] = 151, -- BLG-66 Belouga AC - 305kg CBU, 151 x HEAT Bomblets
--["ROCKEYE"] = 247, -- ("Mk-20 - 247 x Mk 118 Mod 1 bomblets, 222kg")
--["CBU_87"] = 202, -- CBU-87 - 202 x CEM Cluster Bomb
--["CBU_99"] = 247, -- CBU-99 - 247 x CEM Cluster Bomb
["Mk 118"] = 247, -- CBU-99 - 247 x CEM Cluster Bomb
["MK118"] = 247, -- CBU-99 - 247 x CEM Cluster Bomb
["BLU-97B"] = 202, -- CBU-87/103 - 202 x CEM, CBU with WCMD
["BLU-97/B"] = 145, -- AGM-154A - JSOW CEB (CBU-type) - 145 BLU-97/B Combined Effects Bomb (CEB) submunitions
--["AGM_154A"] = 145, -- AGM-154A - JSOW CEB (CBU-type) - 145 BLU-97/B Combined Effects Bomb (CEB) submunitions
["BKF_PTAB2_5KO"]= 12, -- BKF - 12 x PTAB-2.5KO
["BKF_AO2_5RT"]= 12, -- BKF - 12 x AO-2.5RT
["RBK_250_275_AO_1SCH"] = 150, -- RBK-250-275 - 150 x AO-1SCh, 250kg CBU HE/Frag
["RBK_250"] = 42, -- RBK-250 - 42 x PTAB-2.5M, 250kg CBU Medium HEAT/AP
["RBK_500AO"] = 30, -- RBK-500-255 - 30 x PTAB-10-5 CBU Heavy HEAT/AP
["RBK_500U"] = 268, -- RBK-500U - 268 x PTAB-1M CBU Light HEAT/AP
["RBK_500U_OAB_2_5RT"] = 126, -- RBK-500U - 126 x OAB-2.5RT, 500kg CBU HE/Frag
["AB_250_2_SD_2"] = 144, --("AB 250-2 - 144 x SD-2, 250kg CBU with HE submunitions")
["AB_250_2_SD_10A"] = 17, --("AB 250-2 - 17 x SD-10A, 250kg CBU with 10kg Frag/HE submunitions")
["AB_500_1_SD_10A"] = 34, --("AB 500-1 - 34 x SD-10A, 500kg CBU with 10kg Frag/HE submunitions")
}
antiRadiationMissile = {
["AGM_45A"] = 1,
["AGM_88"] = 1,
["AGM_88C"] = 1,
["AGM-88C"] = 1,
["AGM_122"] = 1,
["ALARM"] = 1,
["X_25MP"] = 1,
["X_28"] = 1,
["X_58"] = 1,
}
ignoredWeaps = {
["AK_74"] = 1, --5.45mm
["M4"] = 1, --5.56mm
["M249"] = 1, --5.56mm
["7_62_MG"] = 1, --7.62mm
["7_62_PKT"] = 1, --7.62mm
["7_62_L94A1"] = 1, --7.62mm
["M_134"] = 1, --7.62mm
["M240"] = 1, --7.62mm
["PK-3"] = 1, --7.62mm, PK-3 GPMG
["SHKAS_GUN"] = 1, --7.62mm, ShKAS machine gun
["M1 Garand .30 cal"] = 1, --7.62mm, .30-06
["Browning .30 cal"] = 1, --7.62mm, .30-06
["Browning303MkII"] = 1, --7.7 mm, .303
["Lee-Enfield SMLE No.4 Mk.1"] = 1, --7.7 mm, .303
["MG34"] = 1, --7.92mm
["Besa"] = 1, --7.92mm
["12_7_MG"] = 1, --12.7mm
["A20_TopTurret_M2_L"] = 1, --12.7mm
["A20_TopTurret_M2_R"] = 1, --12.7mm
["M2_Browning"] = 1, --12.7mm
["BrowningM2"] = 1, --12.7mm
["m3_browning"] = 1, --12.7mm
["m3_f84g"] = 1, --12.7mm
["KORD_12_7"] = 1, --12.7mm
["KPVT"] = 1, --14.5mm
["coltMK12"] = 1, --20mm
["HispanoMkII"] = 1, --20mm
["2A14_2"] = 1, --23mm, ZU-23
["2A14_4"] = 1, --23mm, ZSU-23
["NR-23"] = 1, --23mm, NR-23
["GSH_23"] = 1, --23mm
["M242_Bushmaster"] = 1, --25mm
["2A38"] = 1, --30mm, 2S6 Tunguska
["2A72"] = 1, --30mm, BMP-2
["DEFA 554"] = 1, --30mm
["NR-30"] = 1, --30mm
["GSh_30_2"] = 1, --30mm
["GSh_30_6"] = 1, --30mm
["GSh-6-30K"] = 1, --30mm
["GAU_8"] = 1, --30mm
["N-37"] = 1, --37mm
["Flak M1 37mm"] = 1, --37mm
["Bofors 40mm gun"] = 1, --40mm
["Mk.19"] = 1, --40mm
["S_68"] = 1, --57mm
["AAA 01"] = 1,
}
----[[ ##### HELPER/UTILITY FUNCTIONS ##### ]]----
@ -203,13 +382,13 @@ end
local function debugMsg(str)
if splash_damage_options.debug == true then
trigger.action.outText(str , 5)
trigger.action.outText(str , tonumber(splash_damage_options.message_time))
end
end
local function gameMsg(str)
if splash_damage_options.game_messages == true then
trigger.action.outText(str , 5)
trigger.action.outText(str ,tonumber(splash_damage_options.message_time))
end
end
@ -282,15 +461,55 @@ function track_wpns()
--env.info("Weapon is gone") -- Got to here --
--trigger.action.outText("Weapon Type was: ".. wpnData.name, 20)
if splash_damage_options.larger_explosions == true then
--env.info("triggered explosion size: "..getWeaponExplosive(wpnData.name))
trigger.action.explosion(impactPoint, getWeaponExplosive(wpnData.name))
--trigger.action.smoke(impactPoint, 0)
--env.info("triggered explosion size: "..getWeaponExplosive(wpnData.name))
trigger.action.explosion(impactPoint, getWeaponExplosive(wpnData.name))
--trigger.action.smoke(impactPoint, 0)
end
local explosive = getWeaponExplosive(wpnData.name)
if splash_damage_options.rocket_multiplier > 0 and wpnData.cat == Weapon.Category.ROCKET then
explosive = explosive * splash_damage_options.rocket_multiplier
local obj_land_height = land.getHeight({x = impactPoint.x , y = impactPoint.z})
local impact_ground_pos = {
x = impactPoint.x,
y = obj_land_height,
z = impactPoint.z
}
if wpnData.name == "MK77mod1-WPN" or wpnData.name == "BIN_200" then
trigger.action.effectSmokeBig(impact_ground_pos, 2, 0.5, wpnData.name)
elseif wpnData.name == "MK77mod0-WPN" then
trigger.action.effectSmokeBig(impact_ground_pos, 3, 0.5, wpnData.name)
end
blastWave(impactPoint, splash_damage_options.blast_search_radius, wpnData.ordnance, explosive)
local explosive = getWeaponExplosive(wpnData.name)
local weapon = wpnData.wpn
local player = wpnData.player
if wpnData.cat == Weapon.Category.ROCKET then
explosive = explosive * splash_damage_options.rocket_multiplier / 100
elseif clusterWeaps[wpnData.name] then
explosive = getClusterExplosive(weapon)
end
if splash_damage_options.clusterEffectsEnable and clusterWeaps[wpnData.name] then
for i=1,clusterWeaps[wpnData.name]
do
cluster_radius = math.random(0, splash_damage_options.cluster_munition_distribution_radius)
cluster_angle = 2 * math.pi * (math.random())
local X = impactPoint.x + cluster_radius * math.cos(cluster_angle)
local Z = impactPoint.z + cluster_radius * math.sin(cluster_angle)
blastPoint = {
x = X,
y = land.getHeight({x = X , y = Z}),
z = Z
}
--env.info('Generating cluster bomb explosion at: X: ' .. blastPoint.x .. ' Y: ' .. blastPoint.y .. ' Z: ' .. blastPoint.z)
--debugMsg('Generating cluster bomb explosion at: X: ' .. blastPoint.x .. ' Y: ' .. blastPoint.y .. ' Z: ' .. blastPoint.z)
--timer.scheduleFunction(explodeObject, {blastPoint, 0, explosive}, timer.getTime() + math.random(0, 3))
blastWave(blastPoint, splash_damage_options.blast_search_radius, weapon, getClusterExplosive(wpnData.name), player)
end
debugMsg('Cluster explosions generated for ' .. wpnData.name)
end
blastWave(impactPoint, splash_damage_options.blast_search_radius, weapon, explosive, player)
debugMsg('Stop track: '..wpnData.name)
tracked_weapons[wpn_id_] = nil -- remove from tracked weapons first.
end
end
@ -298,36 +517,67 @@ function track_wpns()
end
function onWpnEvent(event)
if event.weapon and ignoredWeaps[event.weapon:getTypeName()] then
return
end
if event.weapon and explTable[event.weapon:getTypeName()] == nil and clusterWeaps[event.weapon:getTypeName()] == nil then
if string.find(event.weapon:getTypeName(), "weapons.shells") then
debugMsg("event shot, but not tracking: "..event.weapon:getTypeName())
return --we wont track these types of weapons, so exit here
end
env.info(event.weapon:getTypeName().." missing from Splash Damage script")
debugMsg(event.weapon:getTypeName().." missing from Splash Damage script")
if splash_damage_options.weapon_missing_message == true then
debugMsg(event.weapon:getTypeName().." missing from Splash Damage script")
debugMsg("desc: "..mist.utils.tableShow(event.weapon:getDesc()))
end
return
end
if event.id == world.event.S_EVENT_SHOT then
if event.weapon then
local ordnance = event.weapon
local weapon_desc = ordnance:getDesc()
if string.find(ordnance:getTypeName(), "weapons.shells") then
debugMsg("event shot, but not tracking: "..ordnance:getTypeName())
return --we wont track these types of weapons, so exit here
end
if explTable[ordnance:getTypeName()] then
--trigger.action.outText(ordnance:getTypeName().." found.", 10)
else
env.info(ordnance:getTypeName().." missing from Splash Damage script")
if splash_damage_options.weapon_missing_message == true then
trigger.action.outText(ordnance:getTypeName().." missing from Splash Damage script", 10)
debugMsg("desc: "..mist.utils.tableShow(weapon_desc))
end
end
--trigger.action.outText(ordnance:getTypeName().." found.", 10)
debugMsg('Weapon shot: ' .. event.weapon:getTypeName())
if (weapon_desc.category ~= 0) and event.initiator then
if (weapon_desc.category == 1) then
if (weapon_desc.MissileCategory ~= 1 and weapon_desc.MissileCategory ~= 2) then
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory() }
end
else
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory() }
end
debugMsg('Tracking weapon: ' .. event.weapon:getTypeName())
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory(), player=event.initiator:getPlayerName() }
end
end
end
--elseif event.id == world.event.S_EVENT_SHOOTING_START or event.id == world.S_EVENT_SHOOTING_END then
--debugMsg("Start/Stop shooting with "..event.weapon_name)
elseif event.id == world.event.S_EVENT_HIT then
--debugMsg('Hit occurred with '..event.weapon:getTypeName()..' ('..event.weapon:getCategory()..')'..': '..mist.utils.tableShow(event.weapon:getDesc()))
--debugMsg('Event table: '..mist.utils.tableShow(event))
if event.weapon and event.target then
local weapon = event.weapon:getTypeName()
if splash_damage_options.shipRadarDamageEnable and event.target:getDesc().category == Unit.Category.SHIP and antiRadiationMissile[weapon] ~= nil then
event.target:enableEmission(false)
env.info("BDA: "..event.target:getTypeName().." radar destroyed")
if event.initiator then
if event.initiator:getPlayerName() ~= nil then
gameMsg("BDA: "..event.target:getTypeName().." radar destroyed")
end
end
end
local player = event.initiator
targetName = event.target:getTypeName()
local impactPoint = event.target:getPosition().p
env.info(weapon.." hit "..targetName)
debugMsg(weapon.." hit "..targetName)
--env.info('Impact point was at: X: ' .. impactPoint.x .. ' Y: ' .. impactPoint.y .. ' Z: ' .. impactPoint.z)
if clusterWeaps[weapon] then
local ordnance = event.weapon
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory(), player=event.initiator }
else
blastWave(impactPoint, splash_damage_options.blast_search_radius, event.weapon, getWeaponExplosive(weapon), player)
end
end
elseif event.id == world.event.S_EVENT_KILL and event.initiator ~= nil then
destroyedBda(event.target)
end
end
local function protectedCall(...)
@ -351,16 +601,28 @@ function explodeObject(table)
trigger.action.explosion(point, power)
end
function getClusterExplosive(name)
if clusterWeaps[name] then
return clusterDamage[name] * splash_damage_options.cluster_multiplier / 100
else
return 0
end
end
function getWeaponExplosive(name)
if explTable[name] then
return explTable[name] * splash_damage_options.explTable_multiplier
return explTable[name] * splash_damage_options.explTable_multiplier / 100
else
return 0
end
end
--controller is only at group level for ground units. we should itterate over the group and only apply effects if health thresholds are met by all units in the group
function modelUnitDamage(units)
function modelUnitDamage(table)
local units = table[1]
local player = table[2]
--debugMsg("units table: "..mist.utils.tableShow(units))
for i, unit in ipairs(units)
do
@ -368,34 +630,57 @@ function modelUnitDamage(units)
if unit:isExist() then --if units are not already dead
local health = (unit:getLife() / unit:getDesc().life) * 100
--debugMsg(unit:getTypeName().." health %"..health)
if player ~= nil and health < 100 then
gameMsg("BDA: "..unit:getTypeName().." damaged: "..100-health.."%")
end
if unit:hasAttribute("Infantry") == true and health > 0 then --if infantry
if health <= splash_damage_options.infantry_cant_fire_health then
---disable unit's ability to fire---
unit:getController():setOption(AI.Option.Ground.id.ROE , AI.Option.Ground.val.ROE.WEAPON_HOLD)
end
end
if unit:getDesc().category == Unit.Category.GROUND_UNIT == true and unit:hasAttribute("Infantry") == false and health > 0 then --if ground unit but not infantry
elseif unit:getDesc().category == Unit.Category.GROUND_UNIT == true and unit:hasAttribute("Infantry") == false and health > 0 then --if ground unit but not infantry
if health <= splash_damage_options.unit_cant_fire_health then
---disable unit's ability to fire---
unit:getController():setOption(AI.Option.Ground.id.ROE , AI.Option.Ground.val.ROE.WEAPON_HOLD)
gameMsg(unit:getTypeName().." weapons disabled")
if player ~= nil then
gameMsg("Critical hit: "..unit:getTypeName().." weapons disabled")
end
end
if health <= splash_damage_options.unit_disabled_health and health > 0 then
---disable unit's ability to move---
unit:getController():setTask({id = 'Hold', params = { }} )
unit:getController():setOnOff(false)
gameMsg(unit:getTypeName().." disabled")
if player ~= nil and health < 100 then
gameMsg("Critical hit: "..unit:getTypeName().." disabled")
end
end
end
else
--debugMsg("unit no longer exists")
--pcall(destroyedBda, unit)
end
end
end
-- This is run inside a function with a protected call (pcall),
-- so we allow the unit to have been destroyed and cleaned up
-- between the start and finish of the function when calling unit:getName()
-- This allows us to avoid "Unit does not exist" errors in the log.
function destroyedBda(unit)
if unit == nil then
gameMsg("BDA: target destroyed")
elseif unit:getName() == nil then
gameMsg("BDA: target destroyed")
else
gameMsg("BDA: "..unit:getTypeName().." critically damaged")
end
end
function blastWave(_point, _radius, weapon, power)
function blastWave(_point, _radius, weapon, power, player)
local foundUnits = {}
local volS = {
id = world.VolumeType.SPHERE,
@ -421,6 +706,8 @@ function blastWave(_point, _radius, weapon, power)
local timing = distance/500
if obj:isExist() then
local damage_for_surface = 0
if tableHasKey(obj:getDesc(), "box") then
local length = (obj:getDesc().box.max.x + math.abs(obj:getDesc().box.min.x))
local height = (obj:getDesc().box.max.y + math.abs(obj:getDesc().box.min.y))
@ -435,7 +722,7 @@ function blastWave(_point, _radius, weapon, power)
local scaled_power_factor = 0.006 * power + 1 --this could be reduced into the calc on the next line
local intensity = (power * scaled_power_factor) / (4 * 3.14 * surface_distance * surface_distance )
local surface_area = _length * height --Ideally we should roughly calculate the surface area facing the blast point, but we'll just find the largest side of the object for now
local damage_for_surface = intensity * surface_area
damage_for_surface = intensity * surface_area
--debugMsg(obj:getTypeName().." sa:"..surface_area.." distance:"..surface_distance.." dfs:"..damage_for_surface)
if damage_for_surface > splash_damage_options.cascade_damage_threshold then
local explosion_size = damage_for_surface
@ -443,19 +730,36 @@ function blastWave(_point, _radius, weapon, power)
explosion_size = intensity * splash_damage_options.static_damage_boost --apply an extra damage boost for static objects. should we factor in surface_area?
--debugMsg("static obj :"..obj:getTypeName())
end
local obj_altitude_ground = getAGL(obj)
-- Deal extra damage to parked airplanes and helicopters to make OCA/Aircraft missions more viable
if (obj:getDesc().category == Unit.Category.AIRPLANE or obj:getDesc().category == Unit.Category.HELICOPTER) and (obj:inAir() == false or obj_altitude_ground < 50) then
explosion_size = intensity * splash_damage_options.oca_aircraft_damage_boost --apply an extra damage boost for aircraft to increase kill probability on OCA/Aircraft missions.
--debugMsg("static obj :"..obj:getTypeName())
end
-- According to toutenglisse on DCS World forums (2022-06-11), ships do not have sensors attributes and therefore obj:hasSensors(Unit.SensorType.RADAR) cannot be used
-- "I don't know why, but no Ship in DCS has ["sensors"] in its attributes (while obviously they have and can use them in game...). No way to use Ship with getDetectedTargets function (except for visual detection)."
if splash_damage_options.shipRadarDamageEnable and obj:getDesc().category == Unit.Category.SHIP and antiRadiationMissile[weapon:getTypeName()] ~= nil then
obj:enableEmission(false)
env.info("BDA: "..event.target:getTypeName().." radar destroyed")
if player ~= nil then
gameMsg("BDA: "..obj:getTypeName().." radar destroyed")
end
end
if explosion_size > power then explosion_size = power end --secondary explosions should not be larger than the explosion that created it
local id = timer.scheduleFunction(explodeObject, {obj_location, distance, explosion_size}, timer.getTime() + timing) --create the explosion on the object location
if player ~= nil then
gameMsg("BDA: "..obj:getTypeName().." damaged: "..damage_for_surface)
end
end
else --debugMsg(obj:getTypeName().." object does not have box property")
else
debugMsg(obj:getTypeName().." object does not have box property") -- should never happen...
end
end
end
end
return true
return true
end
world.searchObjects(Object.Category.UNIT, volS, ifFound)
@ -465,16 +769,25 @@ function blastWave(_point, _radius, weapon, power)
--world.searchObjects(Object.Category.BASE, volS, ifFound)
if splash_damage_options.damage_model == true then
local id = timer.scheduleFunction(modelUnitDamage, foundUnits, timer.getTime() + 1.5) --allow some time for the game to adjust health levels before running our function
local id = timer.scheduleFunction(modelUnitDamage, {foundUnits, player}, timer.getTime() + 1.5) --allow some time for the game to adjust health levels before running our function
end
end
function getAGL(obj)
-- Object's altitude from ground
local obj_vec3 = obj:getPoint()
local obj_land_height = land.getHeight({x = obj_vec3.x , y = obj_vec3.z})
-- Altitude from ground in meters
local obj_altitude_MSL = obj:getPoint().y -- Altitude MSL, in meters
return obj_altitude_MSL - obj_land_height
end
if (script_enable == 1) then
gameMsg("SPLASH DAMAGE 2 SCRIPT RUNNING")
env.info("SPLASH DAMAGE 2 SCRIPT RUNNING")
timer.scheduleFunction(function()
timer.scheduleFunction(function()
protectedCall(track_wpns)
return timer.getTime() + refreshRate
end,

View File

@ -1,5 +1,5 @@
{
"nameInUI": "Splash Damage 2.0 by RotorOps",
"nameInUI": "Splash Damage 2.1",
"defaultValue": false,
"specificOptions": [
{
@ -23,25 +23,77 @@
"defaultValue": false
},
{
"nameInUI": "Overall damage multiplier",
"nameInUI": "Number of seconds to show messages",
"mnemonic": "message_time",
"minimumValue": 5,
"maximumValue": 60,
"defaultValue": 10
},
{
"nameInUI": "Enable cluster munition effects",
"mnemonic": "clusterEffectsEnable",
"defaultValue": false
},
{
"nameInUI": "Ship radars damaged by anti-radiation missiles",
"mnemonic": "shipRadarDamage",
"defaultValue": false
},
{
"nameInUI": "Overall damage multiplier (%)",
"mnemonic": "explTable_multiplier",
"minimumValue": 0.1,
"maximumValue": 2.5,
"defaultValue": 1.0
"minimumValue": 10,
"maximumValue": 500,
"defaultValue": 100
},
{
"nameInUI": "Rockets damage multiplier (%)",
"mnemonic": "rocket_multiplier",
"minimumValue": 10,
"maximumValue": 500,
"defaultValue": 130
},
{
"nameInUI": "Cluster munitions damage multiplier (%)",
"mnemonic": "cluster_multiplier",
"minimumValue": 10,
"maximumValue": 500,
"defaultValue": 100
},
{
"nameInUI": "OCA aircraft damage boost for wave explosions",
"mnemonic": "oca_aircraft_damage_boost",
"minimumValue": 0,
"maximumValue": 5000,
"defaultValue": 3000
},
{
"nameInUI": "Static damage boost for wave explosions",
"mnemonic": "static_damage_boost",
"minimumValue": 500,
"minimumValue": 0,
"maximumValue": 5000,
"defaultValue": 1000
},
{
"nameInUI": "Maximum blast radius",
"nameInUI": "Maximum blast radius (meters)",
"mnemonic": "blast_search_radius",
"minimumValue": 10,
"minimumValue": 0,
"maximumValue": 1000,
"defaultValue": 100
},
{
"nameInUI": "Multiplier to thermobaric and napalm bombs (%)",
"mnemonic": "firebomb_splash_factor",
"minimumValue": 0,
"maximumValue": 4000,
"defaultValue": 800
},
{
"nameInUI": "Distribution radius of submunition explosions (meters)",
"mnemonic": "cluster_munition_distribution_radius",
"minimumValue": 50.0,
"maximumValue": 250.0,
"defaultValue": 75
}
],
"scriptsWorkOrders": [

View File

@ -16,10 +16,19 @@ if dcsRetribution then
splash_damage_options.wave_explosions = dcsRetribution.plugins.splashdamage2.wave_explosions
splash_damage_options.damage_model = dcsRetribution.plugins.splashdamage2.damage_model
splash_damage_options.game_messages = dcsRetribution.plugins.splashdamage2.game_messages
splash_damage_options.message_time = dcsRetribution.plugins.splashdamage2.message_time
splash_damage_options.debug = dcsRetribution.plugins.splashdamage2.debug
splash_damage_options.explTable_multiplier = dcsRetribution.plugins.splashdamage2.explTable_multiplier
splash_damage_options.rocket_multiplier = dcsRetribution.plugins.splashdamage2.rocket_multiplier
splash_damage_options.cluster_multiplier = dcsRetribution.plugins.splashdamage2.cluster_multiplier
splash_damage_options.oca_aircraft_damage_boost = dcsRetribution.plugins.splashdamage2.oca_aircraft_damage_boost
splash_damage_options.static_damage_boost = dcsRetribution.plugins.splashdamage2.static_damage_boost
splash_damage_options.blast_search_radius = dcsRetribution.plugins.splashdamage2.blast_search_radius
splash_damage_options.firebomb_splash_factor = dcsRetribution.plugins.splashdamage2.firebomb_splash_factor
splash_damage_options.cluster_munition_distribution_radius = dcsRetribution.plugins.splashdamage2.cluster_munition_distribution_radius
splash_damage_options.clusterEffectsEnable = dcsRetribution.plugins.splashdamage2.clusterEffectsEnable
splash_damage_options.shipRadarDamageEnable = dcsRetribution.plugins.splashdamage2.shipRadarDamage
end
end
end