Merge branch 'FF/Ops' into FF/OpsDev

This commit is contained in:
Frank
2023-12-03 21:10:24 +01:00
45 changed files with 2232 additions and 327 deletions

View File

@@ -241,6 +241,13 @@ AIRBASE.Nevada = {
-- * AIRBASE.Normandy.Broglie
-- * AIRBASE.Normandy.Bernay_Saint_Martin
-- * AIRBASE.Normandy.Saint_Andre_de_lEure
-- * AIRBASE.Normandy.Biggin_Hill
-- * AIRBASE.Normandy.Manston
-- * AIRBASE.Normandy.Detling
-- * AIRBASE.Normandy.Lympne
-- * AIRBASE.Normandy.Abbeville_Drucat
-- * AIRBASE.Normandy.Merville_Calonne
-- * AIRBASE.Normandy.Saint_Omer_Wizernes
--
-- @field Normandy
AIRBASE.Normandy = {
@@ -313,7 +320,14 @@ AIRBASE.Normandy = {
["Beaumont_le_Roger"] = "Beaumont-le-Roger",
["Broglie"] = "Broglie",
["Bernay_Saint_Martin"] = "Bernay Saint Martin",
["Saint_Andre_de_lEure"] = "Saint-Andre-de-lEure",
["Saint_Andre_de_lEure"] = "Saint-Andre-de-lEure",
["Biggin_Hill"] = "Biggin Hill",
["Manston"] = "Manston",
["Detling"] = "Detling",
["Lympne"] = "Lympne",
["Abbeville_Drucat"] = "Abbeville Drucat",
["Merville_Calonne"] = "Merville Calonne",
["Saint_Omer_Wizernes"] = "Saint-Omer Wizernes",
}
--- Airbases of the Persion Gulf Map:

View File

@@ -3974,7 +3974,7 @@ function CONTROLLABLE:OptionAAAttackRange( range )
local Controller = self:_GetController()
if Controller then
if self:IsAir() then
self:SetOption( AI.Option.Air.val.MISSILE_ATTACK, range )
self:SetOption( AI.Option.Air.id.MISSILE_ATTACK, range )
end
end
return self

View File

@@ -2942,7 +2942,7 @@ function GROUP:GetCustomCallSign(ShortCallsign,Keepnumber,CallsignTranslations)
return callsign
end
---
--- Set a GROUP to act as recovery tanker
-- @param #GROUP self
-- @param Wrapper.Group#GROUP CarrierGroup.
-- @param #number Speed Speed in knots.
@@ -2968,3 +2968,37 @@ function GROUP:SetAsRecoveryTanker(CarrierGroup,Speed,ToKIAS,Altitude,Delay,Last
return self
end
--- Get a list of Link16 S/TN data from a GROUP. Can (as of Nov 2023) be obtained from F-18, F-16, F-15E (not the user flyable one) and A-10C-II groups.
-- @param #GROUP self
-- @return #table Table of data entries, indexed by unit name, each entry is a table containing STN, VCL (voice call label), VCN (voice call number), and Lead (#boolean, if true it's the flight lead)
-- @return #string Report Formatted report of all data
function GROUP:GetGroupSTN()
local tSTN = {} -- table
local units = self:GetUnits()
local gname = self:GetName()
gname = string.gsub(gname,"(#%d+)$","")
local report = REPORT:New()
report:Add("Link16 S/TN Report")
report:Add("Group: "..gname)
report:Add("==================")
for _,_unit in pairs(units) do
local unit = _unit -- Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
local STN, VCL, VCN, Lead = unit:GetSTN()
local name = unit:GetName()
tSTN[name] = {
STN=STN,
VCL=VCL,
VCN=VCN,
Lead=Lead,
}
local lead = Lead == true and "(*)" or ""
report:Add(string.format("| %s%s %s %s",tostring(VCL),tostring(VCN),tostring(STN),lead))
end
end
report:Add("==================")
local text = report:Text()
return tSTN,text
end

View File

@@ -1659,3 +1659,36 @@ function UNIT:GetSkill()
local skill = _DATABASE.Templates.Units[name].Template.skill or "Random"
return skill
end
--- Get Link16 STN or SADL TN and other datalink info from Unit, if any.
-- @param #UNIT self
-- @return #string STN STN or TN Octal as string, or nil if not set/capable.
-- @return #string VCL Voice Callsign Label or nil if not set/capable.
-- @return #string VCN Voice Callsign Number or nil if not set/capable.
-- @return #string Lead If true, unit is Flight Lead, else false or nil.
function UNIT:GetSTN()
self:F2(self.UnitName)
local STN = nil -- STN/TN
local VCL = nil -- VoiceCallsignLabel
local VCN = nil -- VoiceCallsignNumber
local FGL = false -- FlightGroupLeader
local template = self:GetTemplate()
if template.AddPropAircraft then
if template.AddPropAircraft.STN_L16 then
STN = template.AddPropAircraft.STN_L16
elseif template.AddPropAircraft.SADL_TN then
STN = template.AddPropAircraft.SADL_TN
end
VCN = template.AddPropAircraft.VoiceCallsignNumber
VCL = template.AddPropAircraft.VoiceCallsignLabel
end
if template.datalinks and template.datalinks.Link16 and template.datalinks.Link16.settings then
FGL = template.datalinks.Link16.settings.flightLead
end
-- A10CII
if template.datalinks and template.datalinks.SADL and template.datalinks.SADL.settings then
FGL = template.datalinks.SADL.settings.flightLead
end
return STN, VCL, VCN, FGL
end

View File

@@ -223,7 +223,15 @@ function WEAPON:New(WeaponObject)
-- Set log ID.
self.lid=string.format("[%s] %s | ", self.typeName, self.name)
if self.launcherUnit then
self.releaseHeading = self.launcherUnit:GetHeading()
self.releaseAltitudeASL = self.launcherUnit:GetAltitude()
self.releaseAltitudeAGL = self.launcherUnit:GetAltitude(true)
self.releaseCoordinate = self.launcherUnit:GetCoordinate()
self.releasePitch = self.launcherUnit:GetPitch()
end
-- Set default parameters
self:SetTimeStepTrack()
self:SetDistanceInterceptPoint()
@@ -552,6 +560,52 @@ function WEAPON:GetImpactCoordinate()
return self.impactCoord
end
--- Get the heading on which the weapon was released
-- @param #WEAPON self
-- @param #bool AccountForMagneticInclination (Optional) If true will account for the magnetic declination of the current map. Default is true
-- @return #number Heading
function WEAPON:GetReleaseHeading(AccountForMagneticInclination)
AccountForMagneticInclination = AccountForMagneticInclination or true
if AccountForMagneticInclination then return UTILS.ClampAngle(self.releaseHeading - UTILS.GetMagneticDeclination()) else return UTILS.ClampAngle(self.releaseHeading) end
end
--- Get the altitude above sea level at which the weapon was released
-- @param #WEAPON self
-- @return #number Altitude in meters
function WEAPON:GetReleaseAltitudeASL()
return self.releaseAltitudeASL
end
--- Get the altitude above ground level at which the weapon was released
-- @param #WEAPON self
-- @return #number Altitude in meters
function WEAPON:GetReleaseAltitudeAGL()
return self.releaseAltitudeAGL
end
--- Get the coordinate where the weapon was released
-- @param #WEAPON self
-- @return Core.Point#COORDINATE Impact coordinate (if any).
function WEAPON:GetReleaseCoordinate()
return self.releaseCoordinate
end
--- Get the pitch of the unit when the weapon was released
-- @param #WEAPON self
-- @return #number Degrees
function WEAPON:GetReleasePitch()
return self.releasePitch
end
--- Get the heading of the weapon when it impacted. Note that this might not exist if the weapon has not impacted yet!
-- @param #WEAPON self
-- @param #bool AccountForMagneticInclination (Optional) If true will account for the magnetic declination of the current map. Default is true
-- @return #number Heading
function WEAPON:GetImpactHeading(AccountForMagneticInclination)
AccountForMagneticInclination = AccountForMagneticInclination or true
if AccountForMagneticInclination then return UTILS.ClampAngle(self.impactHeading - UTILS.GetMagneticDeclination()) else return self.impactHeading end
end
--- Check if weapon is in the air. Obviously not really useful for torpedos. Well, then again, this is DCS...
-- @param #WEAPON self
-- @return #boolean If `true`, weapon is in the air and `false` if not. Returns `nil` if weapon object itself is `nil`.
@@ -712,7 +766,10 @@ function WEAPON:_TrackWeapon(time)
-- Update coordinate.
self.coordinate:UpdateFromVec3(self.vec3)
-- Safe the last velocity of the weapon. This is needed to get the impact heading
self.last_velocity = self.weapon:getVelocity()
-- Keep on tracking by returning the next time below.
self.tracking=true
@@ -781,7 +838,10 @@ function WEAPON:_TrackWeapon(time)
-- Safe impact coordinate.
self.impactCoord=COORDINATE:NewFromVec3(self.vec3)
-- Safe impact heading, using last_velocity because self:GetVelocityVec3() is no longer possible
self.impactHeading = UTILS.VecHdg(self.last_velocity)
-- Mark impact point on F10 map.
if self.impactMark then
self.impactCoord:MarkToAll(string.format("Impact point of weapon %s\ntype=%s\nlauncher=%s", self.name, self.typeName, self.launcherName))