ACE3/addons/weather/functions/fnc_updateRain.sqf
ulteq 89e33dc177 Refactored the weather module:
* No changes in functionality
2015-04-20 13:54:22 +02:00

27 lines
741 B
Plaintext

/*
* Author: ACE2 Team
*
* Updates rain based on ACE_RAIN_PARAMS
*
* Argument:
* Nothing
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
private ["_oldStrength", "_rainStrength", "_transitionTime", "_periodPosition", "_periodPercent"];
if (!GVAR(enableRain)) exitWith {};
if (!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then {
_oldStrength = ACE_RAIN_PARAMS select 0;
_rainStrength = ACE_RAIN_PARAMS select 1;
_transitionTime = ACE_RAIN_PARAMS select 2;
_periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime;
_periodPercent = (_periodPosition/_transitionTime) min 1;
0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength);
};