ACE3/addons/weather/functions/fnc_updateTemperature.sqf
ulteq cda060d3e0 Weather - Properly sync overcast value (#5688)
* Makes sure that all clients share the same (numeric) overcast value
* Only affects the barometric pressure calculation
* Does not affect the actual weather on the clients
2017-10-27 12:39:48 +02:00

28 lines
774 B
Plaintext

/*
* Author: ACE2 Team
* Updates GVAR(currentTemperature) based on the map data
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_weather_fnc_updateTemperature
*
* Public: No
*/
#include "script_component.hpp"
private _time = daytime;
private _month = date select 1;
private _timeRatio = abs(_time - 12) / 12;
GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _timeRatio) + (GVAR(TempNight) select (_month - 1)) * _timeRatio;
GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * GVAR(currentOvercast);
GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;
TRACE_2("temperatureShift/badWeatherShift",GVAR(temperatureShift),GVAR(badWeatherShift));