Jump to content

NEW! Moose 'Astro update' provides sunrise/sunset times


Pikey

Recommended Posts

Daylight Tools released for MOOSE (Astro update)

When the Super Carrier dropped we were envious that Eagle Dynamics could recognise Case 1-3 changes depending on whether it was night or day. FunkyFranky loves a problem (it's an addiction) so he ran with this and carried on to give us functions in MOOSE to discover all sorts of daylight/nighttime solutions in the MOOSE COORDINATE and UTILS Classes. Master branch here

 

 

COORDINATE:GetMinutesToSunrise(OnlyToday)

Get minutes until the next sun rise at this coordinate.

COORDINATE:GetMinutesToSunset(OnlyToday)

Get minutes until the next sun set at this coordinate.

COORDINATE:GetSunrise(InSeconds)

Get todays sun rise time.

COORDINATE:GetSunriseAtDate(Day, Month, Year, InSeconds)

Get sun rise time for a specific date at the coordinate.

COORDINATE:GetSunset(InSeconds)

Get todays sun set time.

COORDINATE:GetSunsetAtDate(Day, Month, Year, InSeconds)

Get sun set time for a specific date at the coordinate.

 

There is also COORDINATE/POINT_VEC2 IsDay() and IsNight() and similar functions in the very extensive UTILS class.

 

What can I use this for?

 

The most obvious usage is to automate your alignment of Case1 and Case3 changes in Airboss Recovery windows so that your Super Carrier ATC changes with you.

 

The remaining ideas are only limited by your imagination. Personally here are some I considered:

 

  • For mission builders not wanting to keep guessing when sunrise or sunset is, if they want to time their mission, its a huge time saver, you can now put some code in startup, run the mission on the day and date you want and get the sunrise and sunset times printed to screen, so you can perfectly plan "Dawn strikes", "Sunset returns", and cool mood lighting for your missions. This is amazingly useful!
  • For any spawns or a Dispatcher class of an aircraft that does not normally fly at night, you can now predict where in a mission darkness comes and stop them, including playing the same mission by changing the time and things "just happen as expected". This is especially valuable for WW2 or earlier eras.
  • MD's looking for some new gameplay on their persistent servers can use the tools to change their mission behaviour during the diurnal cycle - for example, stopping enemy CAP's switching SAM's on and allowing ground units to come out of cover and move at night.
  • Night time is mainly when illumination and flare is used. One can make intelligent choices on their usage now.
  • ATIS class could be edited/changed to now provide visibility with more certainty.(Still need to look into that)
  • A Player MENU with information on local sunrise/sunset... because the times we've been on a server, not really paid attention to the daylight time, month, time locally... A player information service when you enter a server telling you how much daylight is left, would be HANDY, right?

Anyway, these are ready to use. And it's within a few minutes of perfect accuracy and alignment. I don't know how ED implemented this in their code, but we align almost perfectly to their own diurnal cycle.

 

Demo YT:

 

And the demo code used for this:

 

-- Fujairah airbase. 

local fuj=AIRBASE:FindByName(AIRBASE.PersianGulf.Fujairah_Intl)
 -- Coordinate local 

coord=fuj:GetCoordinate() 

-- Function
local function checksunrise() 

-- Get Sunrise time 

local sunrise=coord:GetSunrise() 

-- Get Sunset time. 

local sunset=coord:GetSunset() 

-- Current time.
local clock=UTILS.SecondsToClock(timer.getAbsTime(), true) 

-- Is it day?
local isday=coord:IsDay() 

-- Seconds to next sunrise. 

local sectosunrise=coord:GetMinutesToSunrise()*60 

-- Seconds to next sunset. 

local sectosunset=coord:GetMinutesToSunset()*60 

-- Message text. 

local text=string.format("Fujairah:") 

text=text..string.format("
Current %s (day %d)", clock, UTILS.GetMissionDay()) text=text..string.format("
Sun rise %s", sunrise) text=text..string.format("
Sun set %s", sunset) text=text..string.format("
Todays sunrise in %d min", coord:GetMinutesToSunrise(true)) 
text=text..string.format("
Next sunrise in %s (HH:MM:SS)", UTILS.SecondsToClock(sectosunrise, true)) text=text..string.format("
Todays sunset in %d min", coord:GetMinutesToSunset(true)) 
text=text..string.format("
Next sunrise in %s (HH:MM:SS)", UTILS.SecondsToClock(sectosunset, true)) 
text=text..string.format("
Is Day=%s", tostring(isday)) 

-- Send message. 

MESSAGE:New(text, 60, nil, true):ToAll() 
env.info(text) 

end 

local scheduler=SCHEDULER:New(nil, checksunrise, {}, 5, 60)

 

Learn a scripting language whilst in lockdown and update your CV's!

Daylight.png.8bce0e8dcc435bf976814e0a46b15c36.png

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

The brief change log is:

COORDINATE * Added functions to get sunrise and sunset times.

UTILS * Added functions to calculate sunset and sunrise * Added function to replace illegal characters.

AIRBOSS v1.1.5 * Fixed wrong function name when recovery is resumed. * Replace illegcal characters in player names when writing trapsheet.

Note that the ilegal characters fix will help many squadrons with thei rissues on recording Airboss trapsheets where pilots have "funny characters" in their names.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Does a lunar table command also exist?

No, sorry, that is a bit more involved.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...