mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-23 17:55:18 +00:00
Added Library.environment.getWindAverage()
This commit is contained in:
@@ -240,12 +240,12 @@ do
|
|||||||
return timeOfDayInSeconds < sunriseTime or timeOfDayInSeconds > sunsetTime
|
return timeOfDayInSeconds < sunriseTime or timeOfDayInSeconds > sunsetTime
|
||||||
end
|
end
|
||||||
|
|
||||||
function Library.environment.getWindLevel()
|
function Library.environment.getWindAverage()
|
||||||
local windSpeed = 0
|
local windSpeed = 0
|
||||||
local windSpeedValuesCount = 0
|
local windSpeedValuesCount = 0
|
||||||
|
|
||||||
if not env or not env.mission or not env.mission.weather or not env.mission.weather.wind then
|
if not env or not env.mission or not env.mission.weather or not env.mission.weather.wind then
|
||||||
return Library.environment.windAmount.CALM
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,v in ipairs({"at8000", "atGround", "at2000"}) do
|
for _,v in ipairs({"at8000", "atGround", "at2000"}) do
|
||||||
@@ -255,11 +255,13 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if windSpeedValuesCount == 0 then
|
windSpeed = math.max(0, windSpeed / windSpeedValuesCount)
|
||||||
return Library.environment.windAmount.CALM
|
return windSpeed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Library.environment.getWindLevel()
|
||||||
|
local windSpeed = Library.environment.getWindAverage()
|
||||||
|
|
||||||
windSpeed = windSpeed / windSpeedValuesCount
|
|
||||||
if windSpeed < 1 then
|
if windSpeed < 1 then
|
||||||
return Library.environment.windAmount.CALM
|
return Library.environment.windAmount.CALM
|
||||||
elseif windSpeed < 4 then
|
elseif windSpeed < 4 then
|
||||||
|
|||||||
Reference in New Issue
Block a user