From 061b77e375b362e2cc33b60734eab419ba4a9b0c Mon Sep 17 00:00:00 2001 From: ulteq Date: Sun, 3 May 2015 23:32:53 +0200 Subject: [PATCH] Fixed completely fucked up temperature day/night cycle --- addons/weather/functions/fnc_updateTemperature.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 870d00333c..82f126e33f 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -11,13 +11,13 @@ */ #include "script_component.hpp" -private ["_time", "_month", "_hourlyCoef"]; +private ["_time", "_month", "_timeRatio"]; _time = daytime; _month = date select 1; -_hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440)); +_timeRatio = abs(_time - 12) / 12; -GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef; +GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _timeRatio) + (GVAR(TempNight) select (_month - 1)) * _timeRatio; GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast; GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;