IsNight
Appearance
| 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 |
| PlayerAirFrame | The 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: | ||