mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
The Channel Update
**AIRBASE** - Added "The Channel" map airbase name enumerators. **ATIS v0.8.0** - Added sunset and sunrise times (required new sound files). - Supports "The Channel" map (needs new sound files). **UTILS** - Corrected NTTR local time diff to GMT-8 (was -7) hours. - Corrected Normany local time diff to GMT+0 (was -1) hours. - Added "The Channel" map local time diff as GMT+2 (should be GMT). - Fixed bug in UTILS.GMTToLocalTimeDifference() function.
This commit is contained in:
parent
833d4f7b65
commit
fb3115a0f1
@ -2034,8 +2034,10 @@ do -- COORDINATE
|
|||||||
-- Sunrise in seconds of the day.
|
-- Sunrise in seconds of the day.
|
||||||
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
||||||
|
|
||||||
|
local date=UTILS.GetDCSMissionDate()
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
--self:I(string.format("Sun rise at lat=%.3f long=%.3f on %s + %d days (DayOfYear=%d): %s (GMT %d)", Latitude, Longitude, date, x, DayOfYear, UTILS.SecondsToClock(sunrise), Tdiff))
|
--self:I(string.format("Sun rise at lat=%.3f long=%.3f on %s (DayOfYear=%d): %s (%d sec of the day) (GMT %d)", Latitude, Longitude, date, DayOfYear, tostring(UTILS.SecondsToClock(sunrise)), sunrise, Tdiff))
|
||||||
|
|
||||||
if InSeconds then
|
if InSeconds then
|
||||||
return sunrise
|
return sunrise
|
||||||
@ -2197,8 +2199,10 @@ do -- COORDINATE
|
|||||||
-- Sunrise in seconds of the day.
|
-- Sunrise in seconds of the day.
|
||||||
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff)
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff)
|
||||||
|
|
||||||
|
local date=UTILS.GetDCSMissionDate()
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
--self:I(string.format("Sun rise at lat=%.3f long=%.3f on %s + %d days (DayOfYear=%d): %s (GMT %d)", Latitude, Longitude, date, x, DayOfYear, UTILS.SecondsToClock(sunrise), Tdiff))
|
--self:I(string.format("Sun set at lat=%.3f long=%.3f on %s (DayOfYear=%d): %s (%d sec of the day) (GMT %d)", Latitude, Longitude, date, DayOfYear, tostring(UTILS.SecondsToClock(sunrise)), sunrise, Tdiff))
|
||||||
|
|
||||||
if InSeconds then
|
if InSeconds then
|
||||||
return sunrise
|
return sunrise
|
||||||
|
|||||||
@ -434,6 +434,8 @@ ATIS.RunwayM2T={
|
|||||||
-- @field #ATIS.Soundfile Right
|
-- @field #ATIS.Soundfile Right
|
||||||
-- @field #ATIS.Soundfile Snow
|
-- @field #ATIS.Soundfile Snow
|
||||||
-- @field #ATIS.Soundfile SnowStorm
|
-- @field #ATIS.Soundfile SnowStorm
|
||||||
|
-- @field #ATIS.Soundfile SunriseAt
|
||||||
|
-- @field #ATIS.Soundfile SunsetAt
|
||||||
-- @field #ATIS.Soundfile Temperature
|
-- @field #ATIS.Soundfile Temperature
|
||||||
-- @field #ATIS.Soundfile Thousand
|
-- @field #ATIS.Soundfile Thousand
|
||||||
-- @field #ATIS.Soundfile ThunderStorm
|
-- @field #ATIS.Soundfile ThunderStorm
|
||||||
@ -505,6 +507,8 @@ ATIS.Sound = {
|
|||||||
Right={filename="Right.ogg", duration=0.44},
|
Right={filename="Right.ogg", duration=0.44},
|
||||||
Snow={filename="Snow.ogg", duration=0.48},
|
Snow={filename="Snow.ogg", duration=0.48},
|
||||||
SnowStorm={filename="SnowStorm.ogg", duration=0.82},
|
SnowStorm={filename="SnowStorm.ogg", duration=0.82},
|
||||||
|
SunriseAt={filename="SunriseAt.ogg", duration=0.92},
|
||||||
|
SunsetAt={filename="SunsetAt.ogg", duration=0.95},
|
||||||
Temperature={filename="Temperature.ogg", duration=0.64},
|
Temperature={filename="Temperature.ogg", duration=0.64},
|
||||||
Thousand={filename="Thousand.ogg", duration=0.55},
|
Thousand={filename="Thousand.ogg", duration=0.55},
|
||||||
ThunderStorm={filename="ThunderStorm.ogg", duration=0.81},
|
ThunderStorm={filename="ThunderStorm.ogg", duration=0.81},
|
||||||
@ -531,7 +535,7 @@ _ATIS={}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version="0.7.1"
|
ATIS.version="0.8.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -599,12 +603,12 @@ function ATIS:New(airbasename, frequency, modulation)
|
|||||||
|
|
||||||
-- Add FSM transitions.
|
-- Add FSM transitions.
|
||||||
-- From State --> Event --> To State
|
-- From State --> Event --> To State
|
||||||
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
|
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
|
||||||
self:AddTransition("*", "Status", "*") -- Update status.
|
self:AddTransition("*", "Status", "*") -- Update status.
|
||||||
self:AddTransition("*", "Broadcast", "*") -- Broadcast ATIS message.
|
self:AddTransition("*", "Broadcast", "*") -- Broadcast ATIS message.
|
||||||
self:AddTransition("*", "CheckQueue", "*") -- Check if radio queue is empty.
|
self:AddTransition("*", "CheckQueue", "*") -- Check if radio queue is empty.
|
||||||
self:AddTransition("*", "Report", "*") -- Report ATIS text.
|
self:AddTransition("*", "Report", "*") -- Report ATIS text.
|
||||||
self:AddTransition("*", "Stop", "Stopped") -- Stop.
|
self:AddTransition("*", "Stop", "Stopped") -- Stop.
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
--- Pseudo Functions ---
|
--- Pseudo Functions ---
|
||||||
@ -943,9 +947,10 @@ end
|
|||||||
-- Default is per map:
|
-- Default is per map:
|
||||||
--
|
--
|
||||||
-- * Caucasus +4
|
-- * Caucasus +4
|
||||||
-- * Nevada -7
|
-- * Nevada -8
|
||||||
-- * Normandy +1
|
-- * Normandy 0
|
||||||
-- * Persian Gulf +4
|
-- * Persian Gulf +4
|
||||||
|
-- * The Channel +2 (should be 0)
|
||||||
--
|
--
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @param #number delta Time difference in hours.
|
-- @param #number delta Time difference in hours.
|
||||||
@ -1244,8 +1249,6 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
if WINDFROM=="000" then
|
if WINDFROM=="000" then
|
||||||
WINDFROM="360"
|
WINDFROM="360"
|
||||||
end
|
end
|
||||||
|
|
||||||
env.info(string.format("FF WINDFROM = %s", tostring(WINDFROM)))
|
|
||||||
|
|
||||||
if self.metric then
|
if self.metric then
|
||||||
WINDSPEED=string.format("%d", windSpeed)
|
WINDSPEED=string.format("%d", windSpeed)
|
||||||
@ -1267,15 +1270,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
-- User specified.
|
-- User specified.
|
||||||
time=time-self.zuludiff*60*60
|
time=time-self.zuludiff*60*60
|
||||||
else
|
else
|
||||||
if self.theatre==DCSMAP.Caucasus then
|
time=time-UTILS.GMTToLocalTimeDifference()*60*60
|
||||||
time=time-4*60*60 -- Caucasus UTC+4 hours
|
|
||||||
elseif self.theatre==DCSMAP.PersianGulf then
|
|
||||||
time=time-4*60*60 -- Abu Dhabi UTC+4 hours
|
|
||||||
elseif self.theatre==DCSMAP.NTTR then
|
|
||||||
time=time+7*60*60 -- Las Vegas UTC-7 hours
|
|
||||||
elseif self.theatre==DCSMAP.Normandy then
|
|
||||||
time=time-1*60*60 -- Calais UTC+1 hour
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local clock=UTILS.SecondsToClock(time)
|
local clock=UTILS.SecondsToClock(time)
|
||||||
@ -1293,6 +1288,18 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
self:T3(string.format("ZULU =%s", tostring(ZULU)))
|
self:T3(string.format("ZULU =%s", tostring(ZULU)))
|
||||||
self:T3(string.format("NATO =%s", tostring(NATO)))
|
self:T3(string.format("NATO =%s", tostring(NATO)))
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
--- Sunrise and Sunset ---
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
local sunrise=coord:GetSunrise()
|
||||||
|
sunrise=UTILS.Split(sunrise, ":")
|
||||||
|
local SUNRISE=string.format("%s%s", sunrise[1], sunrise[2])
|
||||||
|
|
||||||
|
local sunset=coord:GetSunset()
|
||||||
|
sunset=UTILS.Split(sunset, ":")
|
||||||
|
local SUNSET=string.format("%s%s", sunset[1], sunset[2])
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
--- Temperature and Dew Point ---
|
--- Temperature and Dew Point ---
|
||||||
---------------------------------
|
---------------------------------
|
||||||
@ -1444,6 +1451,20 @@ function ATIS:onafterBroadcast(From, Event, To)
|
|||||||
self:Transmission(ATIS.Sound.TimeZulu, 0.2, subtitle)
|
self:Transmission(ATIS.Sound.TimeZulu, 0.2, subtitle)
|
||||||
alltext=alltext..";\n"..subtitle
|
alltext=alltext..";\n"..subtitle
|
||||||
|
|
||||||
|
-- Sunrise Time
|
||||||
|
subtitle=string.format("Sunrise at %s local time", SUNRISE)
|
||||||
|
self:Transmission(ATIS.Sound.SunriseAt, 0.5, subtitle)
|
||||||
|
self.radioqueue:Number2Transmission(SUNRISE, nil, 0.2)
|
||||||
|
self:Transmission(ATIS.Sound.TimeLocal, 0.2)
|
||||||
|
alltext=alltext..";\n"..subtitle
|
||||||
|
|
||||||
|
-- Sunset Time
|
||||||
|
subtitle=string.format("Sunset at %s local time", SUNSET)
|
||||||
|
self:Transmission(ATIS.Sound.SunsetAt, 0.5, subtitle)
|
||||||
|
self.radioqueue:Number2Transmission(SUNSET, nil, 0.5)
|
||||||
|
self:Transmission(ATIS.Sound.TimeLocal, 0.2)
|
||||||
|
alltext=alltext..";\n"..subtitle
|
||||||
|
|
||||||
-- Visibility
|
-- Visibility
|
||||||
if self.metric then
|
if self.metric then
|
||||||
subtitle=string.format("Visibility %s km", VISIBILITY)
|
subtitle=string.format("Visibility %s km", VISIBILITY)
|
||||||
|
|||||||
@ -48,11 +48,13 @@ BIGSMOKEPRESET = {
|
|||||||
-- @field #string Normandy Normandy map.
|
-- @field #string Normandy Normandy map.
|
||||||
-- @field #string NTTR Nevada Test and Training Range map.
|
-- @field #string NTTR Nevada Test and Training Range map.
|
||||||
-- @field #string PersianGulf Persian Gulf map.
|
-- @field #string PersianGulf Persian Gulf map.
|
||||||
|
-- @field #string TheChannel The Channel map.
|
||||||
DCSMAP = {
|
DCSMAP = {
|
||||||
Caucasus="Caucasus",
|
Caucasus="Caucasus",
|
||||||
NTTR="Nevada",
|
NTTR="Nevada",
|
||||||
Normandy="Normandy",
|
Normandy="Normandy",
|
||||||
PersianGulf="PersianGulf"
|
PersianGulf="PersianGulf",
|
||||||
|
TheChannel="TheChannel",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1114,6 +1116,8 @@ function UTILS.GetMagneticDeclination(map)
|
|||||||
declination=-10
|
declination=-10
|
||||||
elseif map==DCSMAP.PersianGulf then
|
elseif map==DCSMAP.PersianGulf then
|
||||||
declination=2
|
declination=2
|
||||||
|
elseif map==DCSMAP.TheChannel then
|
||||||
|
declination=-10
|
||||||
else
|
else
|
||||||
declination=0
|
declination=0
|
||||||
end
|
end
|
||||||
@ -1235,9 +1239,11 @@ function UTILS.GMTToLocalTimeDifference()
|
|||||||
elseif theatre==DCSMAP.PersianGulf then
|
elseif theatre==DCSMAP.PersianGulf then
|
||||||
return 4 -- Abu Dhabi UTC+4 hours
|
return 4 -- Abu Dhabi UTC+4 hours
|
||||||
elseif theatre==DCSMAP.NTTR then
|
elseif theatre==DCSMAP.NTTR then
|
||||||
return -7 -- Las Vegas UTC-7 hours
|
return -8 -- Las Vegas UTC-8 hours
|
||||||
elseif theatre==DCSMAP.Normandy then
|
elseif theatre==DCSMAP.Normandy then
|
||||||
return 1 -- Calais UTC+1 hour
|
return 0 -- Calais UTC+1 hour
|
||||||
|
elseif theatre==DCSMAP.TheChannel then
|
||||||
|
return 2 -- This map currently needs +2
|
||||||
else
|
else
|
||||||
BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre)))
|
BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre)))
|
||||||
return 0
|
return 0
|
||||||
@ -1359,9 +1365,9 @@ function UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, Rising, Tlocal)
|
|||||||
local T = H + RA - (0.06571 * t) - 6.622
|
local T = H + RA - (0.06571 * t) - 6.622
|
||||||
|
|
||||||
-- Adjust back to UTC
|
-- Adjust back to UTC
|
||||||
local UT = fit_into_range(T - lng_hour, 0, 24)
|
local UT = fit_into_range(T - lng_hour +Tlocal, 0, 24)
|
||||||
|
|
||||||
return floor(UT)*60*60+frac(UT)*60*60+Tlocal*60*60
|
return floor(UT)*60*60+frac(UT)*60*60--+Tlocal*60*60
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get sun rise of a specific day of the year at a specific location.
|
--- Get sun rise of a specific day of the year at a specific location.
|
||||||
|
|||||||
@ -289,6 +289,31 @@ AIRBASE.PersianGulf = {
|
|||||||
["Tunb_Island_AFB"] = "Tunb Island AFB",
|
["Tunb_Island_AFB"] = "Tunb Island AFB",
|
||||||
["Tunb_Kochak"] = "Tunb Kochak",
|
["Tunb_Kochak"] = "Tunb Kochak",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- These are all airbases of the The Channel Map:
|
||||||
|
--
|
||||||
|
-- * AIRBASE.TheChannel.Abbeville_Drucat
|
||||||
|
-- * AIRBASE.TheChannel.Merville_Calonne
|
||||||
|
-- * AIRBASE.TheChannel.Saint_Omer_Longuenesse
|
||||||
|
-- * AIRBASE.TheChannel.Dunkirk_Mardyck
|
||||||
|
-- * AIRBASE.TheChannel.Manston
|
||||||
|
-- * AIRBASE.TheChannel.Hawkinge
|
||||||
|
-- * AIRBASE.TheChannel.Lympne
|
||||||
|
-- * AIRBASE.TheChannel.Detling
|
||||||
|
-- * AIRBASE.TheChannel.High_Halden
|
||||||
|
--
|
||||||
|
-- @field TheChannel
|
||||||
|
AIRBASE.TheChannel = {
|
||||||
|
["Abbeville_Drucat"] = "Abbeville Drucat",
|
||||||
|
["Merville_Calonne"] = "Merville Calonne",
|
||||||
|
["Saint_Omer_Longuenesse"] = "Saint Omer Longuenesse",
|
||||||
|
["Dunkirk_Mardyck"] = "Dunkirk Mardyck",
|
||||||
|
["Manston"] = "Manston",
|
||||||
|
["Hawkinge"] = "Hawkinge",
|
||||||
|
["Lympne"] = "Lympne",
|
||||||
|
["Detling"] = "Detling",
|
||||||
|
["High_Halden"] = "High Halden",
|
||||||
|
}
|
||||||
|
|
||||||
--- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".
|
--- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".
|
||||||
-- @type AIRBASE.ParkingSpot
|
-- @type AIRBASE.ParkingSpot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user