Update Utils.lua

This commit is contained in:
Frank
2020-06-15 20:33:27 +02:00
parent 1129e34e01
commit 50305f3d6f
+76 -1
View File
@@ -1400,4 +1400,79 @@ function UTILS.GetSunset(Day, Month, Year, Latitude, Longitude, Tlocal)
local DayOfYear=UTILS.GetDayOfYear(Year, Month, Day)
return UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tlocal)
end
end
--- Get weather of this mission from env.mission.weather variable.
-- @return #table Clouds table which has entries "thickness", "density", "base", "iprecptns".
-- @return #number Visibility distance in meters.
-- @return #number Ground turbulence in m/s.
-- @return #table Fog table, which has entries "thickness", "visibility" or nil if fog is disabled in the mission.
-- @return #number Dust density or nil if dust is disabled in the mission.
-- @return #boolean static If true, static weather is used. If false, dynamic weather is used.
function UTILS.GetWeather()
-- Weather data from mission file.
local weather=env.mission.weather
-- Clouds
--[[
["clouds"] =
{
["thickness"] = 430,
["density"] = 7,
["base"] = 0,
["iprecptns"] = 1,
}, -- end of ["clouds"]
]]
local clouds=weather.clouds
-- 0=static, 1=dynamic
local static=weather.atmosphere_type==0
-- Visibilty distance in meters.
local visibility=weather.visibility.distance
-- Ground turbulence.
local turbulence=weather.groundTurbulence
-- Dust
--[[
["enable_dust"] = false,
["dust_density"] = 0,
]]
local dust=nil
if weather.enable_dust==true then
dust=weather.dust_density
end
-- Fog
--[[
["enable_fog"] = false,
["fog"] =
{
["thickness"] = 0,
["visibility"] = 25,
}, -- end of ["fog"]
]]
local fog=nil
if weather.enable_fog==true then
fog=weather.fog
end
return clouds, visibility, turbulence, fog, dust, static
end
--- Get fog in mission.
-- @return #number Visibility in meters.
-- @return #number Thickness in meters.
function UTILS.GetWeatherFog()
-- Weather data from mission file.
local weather=env.mission.weather
if weather.enable_fog==true then
return weather.fog.thickness, weather.fog.visibility
end
end