From e2bf1f727d9e712674c20a131839c0d4110c0f58 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 5 Jan 2024 15:37:52 +0100 Subject: [PATCH] FLIGHTGROUP - Amending landing on an AFB w/o runways SRS - some improvements --- Moose Development/Moose/Ops/FlightGroup.lua | 15 ++++++++++++--- Moose Development/Moose/Sound/SRS.lua | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index ba55abbfb..1be7c0dbe 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -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 --- diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index 559d23c56..d440ed974 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -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