Formatting

This commit is contained in:
Raffson 2023-11-19 18:13:46 +01:00
parent 5de863fbb8
commit 1c609e1b70
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -2928,29 +2928,29 @@ end
function SkynetIADSAbstractRadarElement:informOfHARM(harmContact)
local radars = self:getRadars()
for j = 1, #radars do
local radar = radars[j]
if radar:isExist() then
local distanceNM = mist.utils.metersToNM(self:getDistanceInMetersToContact(radar, harmContact:getPosition().p))
local harmToSAMHeading = mist.utils.toDegree(mist.utils.getHeadingPoints(harmContact:getPosition().p, radar:getPosition().p))
local harmToSAMAspect = self:calculateAspectInDegrees(harmContact:getMagneticHeading(), harmToSAMHeading)
local speedKT = harmContact:getGroundSpeedInKnots(0)
local secondsToImpact = self:getSecondsToImpact(distanceNM, speedKT)
--TODO: use tti instead of distanceNM?
-- when iterating through the radars, store shortest tti and work with that value??
if ( harmToSAMAspect < SkynetIADSAbstractRadarElement.HARM_TO_SAM_ASPECT and distanceNM < SkynetIADSAbstractRadarElement.HARM_LOOKAHEAD_NM ) then
self:addObjectIdentifiedAsHARM(harmContact)
if ( #self:getPointDefences() > 0 and self:pointDefencesGoLive() == true and self.iads:getDebugSettings().harmDefence ) then
self.iads:printOutputToLog("POINT DEFENCES GOING LIVE FOR: "..self:getDCSName().." | TTI: "..secondsToImpact)
end
--self.iads:printOutputToLog("Ignore HARM shutdown: "..tostring(self:shallIgnoreHARMShutdown()))
if ( self:getIsAPointDefence() == false and ( self:isDefendingHARM() == false or ( self:getHARMShutdownTime() < secondsToImpact ) ) and self:shallIgnoreHARMShutdown() == false) then
self:goSilentToEvadeHARM(secondsToImpact)
break
end
for j = 1, #radars do
local radar = radars[j]
if radar:isExist() then
local distanceNM = mist.utils.metersToNM(self:getDistanceInMetersToContact(radar, harmContact:getPosition().p))
local harmToSAMHeading = mist.utils.toDegree(mist.utils.getHeadingPoints(harmContact:getPosition().p, radar:getPosition().p))
local harmToSAMAspect = self:calculateAspectInDegrees(harmContact:getMagneticHeading(), harmToSAMHeading)
local speedKT = harmContact:getGroundSpeedInKnots(0)
local secondsToImpact = self:getSecondsToImpact(distanceNM, speedKT)
--TODO: use tti instead of distanceNM?
-- when iterating through the radars, store shortest tti and work with that value??
if ( harmToSAMAspect < SkynetIADSAbstractRadarElement.HARM_TO_SAM_ASPECT and distanceNM < SkynetIADSAbstractRadarElement.HARM_LOOKAHEAD_NM ) then
self:addObjectIdentifiedAsHARM(harmContact)
if ( #self:getPointDefences() > 0 and self:pointDefencesGoLive() == true and self.iads:getDebugSettings().harmDefence ) then
self.iads:printOutputToLog("POINT DEFENCES GOING LIVE FOR: "..self:getDCSName().." | TTI: "..secondsToImpact)
end
--self.iads:printOutputToLog("Ignore HARM shutdown: "..tostring(self:shallIgnoreHARMShutdown()))
if ( self:getIsAPointDefence() == false and ( self:isDefendingHARM() == false or ( self:getHARMShutdownTime() < secondsToImpact ) ) and self:shallIgnoreHARMShutdown() == false) then
self:goSilentToEvadeHARM(secondsToImpact)
break
end
end
end
end
end
function SkynetIADSAbstractElement:addObjectIdentifiedAsHARM(harmContact)