This commit is contained in:
Aaron Clark
2012-11-04 20:28:50 -06:00
commit 76e9a0582e
1049 changed files with 94406 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/*
Author: CarlGustaffa (modified by gammadust)
Description:
Returns the sun's rise in hours for the current day of the year on any island (whos latitude may differ).
Parameters:
None needed.
Returns:
Sun's rise in hours, in the same format as engine's [daytime] command (16.5 == 16:30)
To obtain sun's set, just subtract the result from 24.
Reference:
http://forums.bistudio.com/showthread.php?107476-How-do-I-detect-sundown-sunrise
*/
private ["_lat", "_day", "_hour"];
_lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude");
_day = 360 * (dateToNumber date);
_hour = acos ((24 * sin(_lat) * cos(_day)) / ((12 * cos(_day) - 78) * cos(_lat)));
_daytime = _hour / 360 * 24;
_daytime