diff --git a/Moose Development/Moose/Core/RadioQueue.lua b/Moose Development/Moose/Core/RadioQueue.lua index 7ee3c02ae..756b5a967 100644 --- a/Moose Development/Moose/Core/RadioQueue.lua +++ b/Moose Development/Moose/Core/RadioQueue.lua @@ -351,13 +351,21 @@ function RADIOQUEUE:Broadcast(transmission) self.senderinit=true end + -- Set subtitle only if duration>0 sec. + local subtitle=nil + local duration=nil + if transmission.subtitle and transmission.subduration and transmission.subduration>0 then + subtitle=transmission.subtitle + duration=transmission.subduration + end + -- Command to tranmit the call. local commandTransmit={ id = "TransmitMessage", params = { file=filename, - duration=transmission.subduration, - subtitle=transmission.subtitle or "", + duration=duration, + subtitle=subtitle, loop=false, }} diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index dfd9fbebe..7dbb616dd 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -130,6 +130,7 @@ -- **Note** that you should use a different relay unit for each ATIS! -- -- By default, subtitles are displayed for 10 seconds. This can be changed using @{#ATIS.SetSubtitleDuration}(*duration*) with *duration* being the duration in seconds. +-- Setting a *duration* of 0 will completely disable all subtitles. -- -- ## Active Runway -- @@ -523,7 +524,7 @@ _ATIS={} --- ATIS class version. -- @field #string version -ATIS.version="0.6.3" +ATIS.version="0.6.4" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1537,6 +1538,7 @@ function ATIS:onafterBroadcast(From, Event, To) -- Runway length. if self.rwylength then + local runact=self.airbase:GetActiveRunway(self.runwaym2t) local length=runact.length if not self.metric then length=UTILS.MetersToFeet(length) diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 7346dcc38..d31ae647a 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -474,8 +474,11 @@ UTILS.tostringMGRS = function(MGRS, acc) --R2.1 if acc == 0 then return MGRS.UTMZone .. ' ' .. MGRS.MGRSDigraph else - return MGRS.UTMZone .. ' ' .. MGRS.MGRSDigraph .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Easting/(10^(5-acc)), 0)) - .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Northing/(10^(5-acc)), 0)) + --return MGRS.UTMZone .. ' ' .. MGRS.MGRSDigraph .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Easting/(10^(5-acc)), 0)) + -- .. ' ' .. string.format('%0' .. acc .. 'd', UTILS.Round(MGRS.Northing/(10^(5-acc)), 0)) + + -- Truncate rather than round MGRS grid! + return string.format("%s %s %s %s", MGRS.UTMZone, MGRS.MGRSDigraph, string.sub(tostring(MGRS.Easting), 1, acc), string.sub(tostring(MGRS.Northing), 1, acc)) end end diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 541412c3b..ccfbc5a59 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -352,7 +352,13 @@ function AIRBASE:Register( AirbaseName ) local self = BASE:Inherit( self, POSITIONABLE:New( AirbaseName ) ) --#AIRBASE self.AirbaseName = AirbaseName self.AirbaseID = self:GetID(true) - self.AirbaseZone = ZONE_RADIUS:New( AirbaseName, self:GetVec2(), 2500 ) + local vec2=self:GetVec2() + if vec2 then + self.AirbaseZone = ZONE_RADIUS:New( AirbaseName, vec2, 2500 ) + else + self:E(string.format("ERROR: Cound not get position Vec2 of airbase %s", AirbaseName)) + end + return self end @@ -450,7 +456,7 @@ function AIRBASE:GetID(unique) else - for DCSAirbaseId, DCSAirbase in pairs(world.getAirbases()) do + for DCSAirbaseId, DCSAirbase in ipairs(world.getAirbases()) do -- Get the airbase name. local AirbaseName = DCSAirbase:getName() @@ -458,8 +464,12 @@ function AIRBASE:GetID(unique) -- This gives the incorrect value to be inserted into the airdromeID for DCS 2.5.6! local airbaseID=tonumber(DCSAirbase:getID()) + local airbaseCategory=self:GetAirbaseCategory() + + --env.info(string.format("FF airbase=%s id=%s category=%s", tostring(AirbaseName), tostring(airbaseID), tostring(airbaseCategory))) + -- No way AFIK to get the DCS version. So we check if the event exists. That should tell us if we are on DCS 2.5.6 or prior to that. - if world.event.S_EVENT_KILL and world.event.S_EVENT_KILL>0 and self:GetAirbaseCategory()==Airbase.Category.AIRDROME then + if world.event.S_EVENT_KILL and world.event.S_EVENT_KILL>0 and airbaseCategory==Airbase.Category.AIRDROME then -- We have to take the key value of this loop! airbaseID=DCSAirbaseId @@ -471,7 +481,7 @@ function AIRBASE:GetID(unique) end if AirbaseName==self.AirbaseName then - if self:GetAirbaseCategory()==Airbase.Category.SHIP then + if airbaseCategory==Airbase.Category.SHIP then -- Ships get a negative sign as their unit number might be the same as the ID of another airbase. return unique and -airbaseID or airbaseID else @@ -1011,7 +1021,15 @@ end -- @param #AIRBASE self -- @return #number Category of airbase from GetDesc().category. function AIRBASE:GetAirbaseCategory() - return self:GetDesc().category + local desc=self:GetDesc() + local category=Airbase.Category.AIRDROME + + if desc and desc.category then + category=desc.category + else + self:E(string.format("ERROR: Cannot get category of airbase %s due to DCS 2.5.6 bug! Assuming it is an AIRDROME for now...", tostring(self.AirbaseName))) + end + return category end