mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-19 05:36:02 +00:00
Updates
This commit is contained in:
@@ -1995,6 +1995,27 @@ do -- COORDINATE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get sun rise time for a specific day of the year at the coordinate.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number DayOfYear The day of the year.
|
||||||
|
-- @param #boolean InSeconds If true, return the sun rise time in seconds.
|
||||||
|
-- @return #string Sunrise time, e.g. "05:41".
|
||||||
|
function COORDINATE:GetSunriseAtDayOfYear(DayOfYear, InSeconds)
|
||||||
|
|
||||||
|
local Latitude, Longitude=self:GetLLDDM()
|
||||||
|
|
||||||
|
local Tdiff=UTILS.GMTToLocalTimeDifference()
|
||||||
|
|
||||||
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
||||||
|
|
||||||
|
if InSeconds then
|
||||||
|
return sunrise
|
||||||
|
else
|
||||||
|
return UTILS.SecondsToClock(sunrise, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Get todays sun rise time.
|
--- Get todays sun rise time.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #boolean InSeconds If true, return the sun rise time in seconds.
|
-- @param #boolean InSeconds If true, return the sun rise time in seconds.
|
||||||
@@ -2073,8 +2094,36 @@ do -- COORDINATE
|
|||||||
|
|
||||||
--- Check if it is day, i.e. if the sun has risen about the horizon at this coordinate.
|
--- Check if it is day, i.e. if the sun has risen about the horizon at this coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string Clock (Optional) Time in format "HH:MM:SS+D", e.g. "05:40:00+3" to check if is day at 5:40 at third day after mission start. Default is to check right now.
|
||||||
-- @return #boolean If true, it is day. If false, it is night time.
|
-- @return #boolean If true, it is day. If false, it is night time.
|
||||||
function COORDINATE:IsDay()
|
function COORDINATE:IsDay(Clock)
|
||||||
|
|
||||||
|
if Clock then
|
||||||
|
|
||||||
|
local Time=UTILS.ClockToSeconds(Clock)
|
||||||
|
|
||||||
|
local clock=UTILS.Split(Clock, "+")[1]
|
||||||
|
|
||||||
|
-- Tomorrows day of the year.
|
||||||
|
local DayOfYear=UTILS.GetMissionDayOfYear(Time)
|
||||||
|
|
||||||
|
local Latitude, Longitude=self:GetLLDDM()
|
||||||
|
|
||||||
|
local Tdiff=UTILS.GMTToLocalTimeDifference()
|
||||||
|
|
||||||
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
||||||
|
local sunset=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff)
|
||||||
|
|
||||||
|
local time=UTILS.ClockToSeconds(clock)
|
||||||
|
|
||||||
|
-- Check if time is between sunrise and sunset.
|
||||||
|
if time>sunrise and time<=sunset then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
-- Todays sun rise in sec.
|
-- Todays sun rise in sec.
|
||||||
local sunrise=self:GetSunrise(true)
|
local sunrise=self:GetSunrise(true)
|
||||||
@@ -2094,11 +2143,14 @@ do -- COORDINATE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if it is night, i.e. if the sun has set below the horizon at this coordinate.
|
--- Check if it is night, i.e. if the sun has set below the horizon at this coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string Clock (Optional) Time in format "HH:MM:SS+D", e.g. "05:40:00+3" to check if is night at 5:40 at third day after mission start. Default is to check right now.
|
||||||
-- @return #boolean If true, it is night. If false, it is day time.
|
-- @return #boolean If true, it is night. If false, it is day time.
|
||||||
function COORDINATE:IsNight()
|
function COORDINATE:IsNight(Clock)
|
||||||
return not self:IsDay()
|
return not self:IsDay(Clock)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get sun set time for a specific date at the coordinate.
|
--- Get sun set time for a specific date at the coordinate.
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ end
|
|||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #string StaticShape Shape of the static, e.g. "carrier_tech_USA".
|
-- @param #string StaticShape Shape of the static, e.g. "carrier_tech_USA".
|
||||||
-- @return #SPAWNSTATIC self
|
-- @return #SPAWNSTATIC self
|
||||||
function SPAWNSTATIC:InitShape(StaticType)
|
function SPAWNSTATIC:InitShape(StaticShape)
|
||||||
self.InitStaticShape=StaticType
|
self.InitStaticShape=StaticShape
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -373,6 +373,10 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
Template.heading = math.rad(self.InitStaticHeading)
|
Template.heading = math.rad(self.InitStaticHeading)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.InitStaticShape then
|
||||||
|
Template.shape_name=self.InitStaticShape
|
||||||
|
end
|
||||||
|
|
||||||
if self.InitStaticLivery then
|
if self.InitStaticLivery then
|
||||||
Template.livery_id=self.InitStaticLivery
|
Template.livery_id=self.InitStaticLivery
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2624,10 +2624,10 @@ end
|
|||||||
|
|
||||||
--- Set time before carrier turns and recovery window opens.
|
--- Set time before carrier turns and recovery window opens.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number interval Time interval in seconds. Default 600 sec.
|
-- @param #number interval Time interval in seconds. Default 300 sec.
|
||||||
-- @return #AIRBOSS self
|
-- @return #AIRBOSS self
|
||||||
function AIRBOSS:SetRecoveryTurnTime(interval)
|
function AIRBOSS:SetRecoveryTurnTime(interval)
|
||||||
self.dTturn=interval or 600
|
self.dTturn=interval or 300
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1045,12 +1045,13 @@ function UTILS.GetDCSMissionDate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the day of the mission.
|
--- Returns the day of the mission.
|
||||||
|
-- @param #number Time (Optional) Abs. time in seconds. Default now, i.e. the value return from timer.getAbsTime().
|
||||||
-- @return #number Day of the mission. Mission starts on day 0.
|
-- @return #number Day of the mission. Mission starts on day 0.
|
||||||
function UTILS.GetMissionDay()
|
function UTILS.GetMissionDay(Time)
|
||||||
|
|
||||||
local time=timer.getAbsTime()
|
Time=Time or timer.getAbsTime()
|
||||||
|
|
||||||
local clock=UTILS.SecondsToClock(time, false)
|
local clock=UTILS.SecondsToClock(Time, false)
|
||||||
|
|
||||||
local x=tonumber(UTILS.Split(clock, "+")[2])
|
local x=tonumber(UTILS.Split(clock, "+")[2])
|
||||||
|
|
||||||
@@ -1058,12 +1059,13 @@ function UTILS.GetMissionDay()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the current day of the year of the mission.
|
--- Returns the current day of the year of the mission.
|
||||||
|
-- @param #number Time (Optional) Abs. time in seconds. Default now, i.e. the value return from timer.getAbsTime().
|
||||||
-- @return #number Current day of year of the mission. For example, January 1st returns 0, January 2nd returns 1 etc.
|
-- @return #number Current day of year of the mission. For example, January 1st returns 0, January 2nd returns 1 etc.
|
||||||
function UTILS.GetMissionDayOfYear()
|
function UTILS.GetMissionDayOfYear(Time)
|
||||||
|
|
||||||
local Date, Year, Month, Day=UTILS.GetDCSMissionDate()
|
local Date, Year, Month, Day=UTILS.GetDCSMissionDate()
|
||||||
|
|
||||||
local d=UTILS.GetMissionDay()
|
local d=UTILS.GetMissionDay(Time)
|
||||||
|
|
||||||
return UTILS.GetDayOfYear(Year, Month, Day)+d
|
return UTILS.GetDayOfYear(Year, Month, Day)+d
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user