2015-04-17 04:44:38 +00:00
|
|
|
/*
|
2015-04-24 08:58:55 +00:00
|
|
|
* Author: ACE2 Team, Ruthberg
|
2015-04-17 04:44:38 +00:00
|
|
|
* Calculate current wind locally from the data broadcasted by the server
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2015-04-17 04:44:38 +00:00
|
|
|
* None
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-04-17 04:44:38 +00:00
|
|
|
* Wind <ARRAY>
|
2016-01-05 07:39:29 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [] call ace_weather_fnc_getWind
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-04-17 04:44:38 +00:00
|
|
|
*/
|
2015-01-20 23:18:40 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-21 18:20:05 +00:00
|
|
|
if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] };
|
2015-01-20 23:18:40 +00:00
|
|
|
|
2015-08-04 00:11:24 +00:00
|
|
|
ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"];
|
2016-01-05 21:29:52 +00:00
|
|
|
//Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];]
|
2015-04-20 13:11:14 +00:00
|
|
|
|
2016-03-02 10:01:39 +00:00
|
|
|
private _periodPosition = (CBA_missionTime - GVAR(wind_period_start_time)) min _period;
|
2016-01-05 07:39:29 +00:00
|
|
|
private _periodPercent = _periodPosition / _period;
|
2015-04-20 14:33:36 +00:00
|
|
|
|
2015-04-22 10:56:07 +00:00
|
|
|
_spd = _spd + _spdChange * _periodPercent;
|
|
|
|
_dir = _dir + _dirChange * _periodPercent;
|
|
|
|
|
|
|
|
_dir = (360 + _dir) % 360;
|
|
|
|
|
2015-04-22 19:16:01 +00:00
|
|
|
TRACE_1("PeriodStartTime",Round(GVAR(wind_period_start_time)));
|
2015-04-22 10:56:07 +00:00
|
|
|
TRACE_2("Dir: Current/Change",Round(_dir),Round(_dirChange));
|
|
|
|
TRACE_2("Spd: Current/Change",Round(_spd * 10) / 10,Round(_spdChange * 10) / 10);
|
|
|
|
TRACE_3("Period/Position/Percent",Round(_period),Round(_periodPosition),Round(_periodPercent * 100) / 100);
|
|
|
|
|
2015-04-22 17:46:27 +00:00
|
|
|
// TODO: Add some deterministic noise
|
|
|
|
|
2015-04-22 10:56:07 +00:00
|
|
|
[-_spd * sin(_dir), -_spd * cos(_dir), 0]
|