From 19047843ccb402c9fa25f63e5731643ab1003aa7 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 12 Nov 2023 16:53:34 +0100 Subject: [PATCH] #SEAD * Added data and actions for TALD ADM_141 --- Moose Development/Moose/Functional/Sead.lua | 22 +++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Functional/Sead.lua b/Moose Development/Moose/Functional/Sead.lua index b80246523..aaeb9afd0 100644 --- a/Moose Development/Moose/Functional/Sead.lua +++ b/Moose Development/Moose/Functional/Sead.lua @@ -19,7 +19,7 @@ -- -- ### Authors: **FlightControl**, **applevangelist** -- --- Last Update: September 2023 +-- Last Update: Oct 2023 -- -- === -- @@ -80,6 +80,7 @@ SEAD = { ["BGM_109"] = "BGM_109", ["AGM_154"] = "AGM_154", ["HY-2"] = "HY-2", + ["ADM_141A"] = "ADM_141A", } --- Missile enumerators - from DCS ME and Wikipedia @@ -100,6 +101,7 @@ SEAD = { ["BGM_109"] = {460, 0.705}, --in-game ~465kn ["AGM_154"] = {130, 0.61}, ["HY-2"] = {90,1}, + ["ADM_141A"] = {126,0.6}, } --- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles. @@ -143,7 +145,7 @@ function SEAD:New( SEADGroupPrefixes, Padding ) self:AddTransition("*", "ManageEvasion", "*") self:AddTransition("*", "CalculateHitZone", "*") - self:I("*** SEAD - Started Version 0.4.4") + self:I("*** SEAD - Started Version 0.4.5") return self end @@ -348,8 +350,9 @@ end -- @param #string SEADWeaponName -- @param Wrapper.Group#GROUP SEADGroup Attacker Group -- @param #number timeoffset Offset for tti calc +-- @param Wrapper.Weapon#WEAPON Weapon -- @return #SEAD self -function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset) +function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset,Weapon) local timeoffset = timeoffset or 0 if _targetskill == "Random" then -- when skill is random, choose a skill local Skills = { "Average", "Good", "High", "Excellent" } @@ -372,6 +375,10 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP reach = wpndata[1] * 1.1 local mach = wpndata[2] wpnspeed = math.floor(mach * 340.29) + if Weapon then + wpnspeed = Weapon:GetSpeed() + self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed)) + end end -- time to impact local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time @@ -457,6 +464,9 @@ function SEAD:HandleEventShot( EventData ) local SEADWeapon = EventData.Weapon -- Identify the weapon fired local SEADWeaponName = EventData.WeaponName -- return weapon type + local WeaponWrapper = WEAPON:New(EventData.Weapon) + --local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps + self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName) --self:T({ SEADWeapon }) @@ -513,7 +523,11 @@ function SEAD:HandleEventShot( EventData ) end end if SEADGroupFound == true then -- yes we are being attacked - self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup) + if string.find(SEADWeaponName,"ADM_141",1,true) then + self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper) + else + self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper) + end end end return self