FLIGHTGROUP - Amending landing on an AFB w/o runways

SRS - some improvements
This commit is contained in:
Applevangelist 2024-01-05 15:37:52 +01:00
parent 65315251b5
commit e2bf1f727d
2 changed files with 26 additions and 5 deletions

View File

@ -3230,13 +3230,22 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
local TaskFinal = self.group:TaskFunction("FLIGHTGROUP._OnFinal", self)
-- Final approach waypoint.
local papp=airbase:GetCoordinate():Translate(x1, runway.heading-180):SetAltitude(h1)
local rheading
if runway then
rheading = runway.heading-180
else
-- AB HeloBase w/o runway eg Naqoura
local wind = airbase:GetCoordinate():GetWind()
rheading = -wind
end
local papp=airbase:GetCoordinate():Translate(x1, rheading):SetAltitude(h1)
wp[#wp+1]=papp:WaypointAirTurningPoint("BARO", UTILS.KnotsToKmph(SpeedLand), {TaskFinal}, "Final Approach")
-- Okay, it looks like it's best to specify the coordinates not at the airbase but a bit away. This causes a more direct landing approach.
local pland=airbase:GetCoordinate():Translate(x2, runway.heading-180):SetAltitude(h2)
local pland=airbase:GetCoordinate():Translate(x2, rheading):SetAltitude(h2)
wp[#wp+1]=pland:WaypointAirLanding(UTILS.KnotsToKmph(SpeedLand), airbase, {}, "Landing")
elseif airbase:IsShip() or airbase:IsHelipad() then
---

View File

@ -516,8 +516,20 @@ end
-- @return #MSRS self
function MSRS:SetBackend(Backend)
self:F( {Backend=Backend} )
self.backend=Backend or MSRS.Backend.SRSEXE
Backend = Backend or MSRS.Backend.SRSEXE -- avoid nil
local function Checker(back)
local ok = false
for _,_backend in pairs(MSRS.Backend) do
if tostring(back) == _backend then ok = true end
end
return ok
end
if Checker(Backend) then
self.backend=Backend or MSRS.Backend.SRSEXE
else
MESSAGE:New("ERROR: Backend "..tostring(Backend).." is not supported!",30,"MSRS",true):ToLog():ToAll()
end
return self
end