mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
SEAD - adding workaround for AGM_154 which lost target data
This commit is contained in:
parent
8a3120be39
commit
890dae8ba7
@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl**, **applevangelist**
|
-- ### Authors: **FlightControl**, **applevangelist**
|
||||||
--
|
--
|
||||||
-- Last Update: Nov 2021
|
-- Last Update: Feb 2022
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@ -33,7 +33,7 @@
|
|||||||
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
||||||
--
|
--
|
||||||
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
||||||
-- Once a HARM attack is detected, SEADwill shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
-- Once a HARM attack is detected, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
||||||
-- vehicles around (*if* they are drivable, that is). There's a component of randomness in detection and evasion, which is based on the
|
-- vehicles around (*if* they are drivable, that is). There's a component of randomness in detection and evasion, which is based on the
|
||||||
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
||||||
-- period of time to stay defensive, before it takes evasive actions.
|
-- period of time to stay defensive, before it takes evasive actions.
|
||||||
@ -141,7 +141,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
|||||||
self:AddTransition("*", "ManageEvasion", "*")
|
self:AddTransition("*", "ManageEvasion", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
|
||||||
self:I("*** SEAD - Started Version 0.4.2")
|
self:I("*** SEAD - Started Version 0.4.3")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -267,9 +267,10 @@ end
|
|||||||
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
||||||
-- @param #number height Height when the missile was fired
|
-- @param #number height Height when the missile was fired
|
||||||
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
||||||
|
-- @param #string SEADWeaponName Weapon Name
|
||||||
-- @return #SEAD self
|
-- @return #SEAD self
|
||||||
function SEAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
|
function SEAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup,SEADWeaponName)
|
||||||
self:T("**** Calculating hit zone")
|
self:T("**** Calculating hit zone for " .. (SEADWeaponName or "None"))
|
||||||
if SEADWeapon and SEADWeapon:isExist() then
|
if SEADWeapon and SEADWeapon:isExist() then
|
||||||
--local pos = SEADWeapon:getPoint()
|
--local pos = SEADWeapon:getPoint()
|
||||||
|
|
||||||
@ -285,6 +286,9 @@ function SEAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADG
|
|||||||
|
|
||||||
-- velocity
|
-- velocity
|
||||||
local wpndata = SEAD.HarmData["AGM_88"]
|
local wpndata = SEAD.HarmData["AGM_88"]
|
||||||
|
if string.find(SEADWeaponName,"154",1) then
|
||||||
|
wpndata = SEAD.HarmData["AGM_154"]
|
||||||
|
end
|
||||||
local mveloc = math.floor(wpndata[2] * 340.29)
|
local mveloc = math.floor(wpndata[2] * 340.29)
|
||||||
local c1 = (2*mheight*9.81)/(mveloc^2)
|
local c1 = (2*mheight*9.81)/(mveloc^2)
|
||||||
local c2 = (mveloc^2) / 9.81
|
local c2 = (mveloc^2) / 9.81
|
||||||
@ -459,14 +463,15 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
local _targetskill = "Random"
|
local _targetskill = "Random"
|
||||||
local _targetgroupname = "none"
|
local _targetgroupname = "none"
|
||||||
local _target = EventData.Weapon:getTarget() -- Identify target
|
local _target = EventData.Weapon:getTarget() -- Identify target
|
||||||
if not _target or self.debug then -- AGM-88 w/o target data
|
if not _target or self.debug then -- AGM-88 or 154 w/o target data
|
||||||
if string.find(SEADWeaponName,"AGM_88",1,true) then
|
self:E("***** SEAD - No target data for " .. (SEADWeaponName or "None"))
|
||||||
self:I("**** Tracking AGM-88 with no target data.")
|
if string.find(SEADWeaponName,"AGM_88",1,true) or string.find(SEADWeaponName,"AGM_154",1,true) then
|
||||||
|
self:I("**** Tracking AGM-88/154 with no target data.")
|
||||||
local pos0 = SEADPlane:GetCoordinate()
|
local pos0 = SEADPlane:GetCoordinate()
|
||||||
local fheight = SEADPlane:GetHeight()
|
local fheight = SEADPlane:GetHeight()
|
||||||
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup)
|
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup,SEADWeaponName)
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
local targetcat = _target:getCategory() -- Identify category
|
local targetcat = _target:getCategory() -- Identify category
|
||||||
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user