Jump to content

IsNight

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (IsNight – created via PowerShell script (2025-11-11T21:11:59Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: IsNight
Function Description: Determines whether the current location of an aircraft is in darkness (i.e., the sun is below the horizon). The function calculates the local time offset based on the mission theatre, then queries the simulated sun elevation for the aircraft’s latitude/longitude. If the elevation angle is negative, it returns true (night); otherwise false.
File Location: cmm.DCSFunctions.lua
Syntax: CMM.IsNight( table PlayerAirFrame )
Return Value: boolean
Parameters: Name Description
PlayerAirFrameThe unit object whose position will be checked.
Example: local isNight = CMM.IsNight(Event.initiator); env.info("Is it night? "..tostring(isNight))
Example Description: Shows how to call CMM.IsNight with an event initiator (an aircraft unit) and log whether the aircraft is currently in darkness.
Related Functions:
Notes: