Files
DayZ-Epoch/SQF/dayz_code/compile/fn_sunRise.sqf
ebaydayz 77e760fe73 Update private tags
From
e69f8d5306

Moved dog files to the \dog\ folder and pzombie files to the \pzombie\
folder. Also removed some legacy files that are no longer used.

The actions\ and compile\ folders are fully up to date now
2016-03-30 14:55:45 -04:00

23 lines
704 B
Plaintext

/*
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["_daytime"];
_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