mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
commit
b0e7cefb06
@ -52,7 +52,7 @@
|
||||
#define ACE_NOZEROING discreteDistance[] = {}; \
|
||||
discreteDistanceInitIndex = 0; \
|
||||
weaponInfoType = "RscWeaponEmpty"
|
||||
|
||||
|
||||
#define ACE_NOTURRETZEROING discreteDistance[] = {}; \
|
||||
discreteDistanceInitIndex = 0; \
|
||||
turretInfoType = "RscWeaponEmpty"
|
||||
@ -62,7 +62,7 @@
|
||||
irDistance = 300
|
||||
|
||||
#define ACE_LASER_DISTANCE_VANILLA irDistance = 300
|
||||
|
||||
|
||||
#define ACE_NOLASER irLaserPos = "laser pos"; \
|
||||
irLaserEnd = "laser dir"; \
|
||||
irDistance = 0
|
||||
@ -100,9 +100,6 @@
|
||||
|
||||
#define ACE_BWC ace_bwc = 1
|
||||
|
||||
#define ACE_wind ([] call ace_ballistic_fnc_wind)
|
||||
|
||||
|
||||
// SCRIPTING MACROS
|
||||
|
||||
// Items
|
||||
@ -129,7 +126,7 @@
|
||||
#define KNOCKOUT ace_common_fx_fnc_knockout
|
||||
#define RING ace_common_fx_fnc_ring
|
||||
|
||||
// Stamina
|
||||
// Stamina
|
||||
#define INC_MASS ace_stamina_fnc_inc_mass
|
||||
|
||||
// Does this work, due to BWC_CONFIG(NAME) ?
|
||||
@ -164,7 +161,7 @@
|
||||
}
|
||||
|
||||
// Addaction defines for colored text
|
||||
#define ACE_TEXT_ORANGE(Text) ("<t color='#ffa500'>" + ##Text + "</t>")
|
||||
#define ACE_TEXT_ORANGE(Text) ("<t color='#ffa500'>" + ##Text + "</t>")
|
||||
#define ACE_TEXT_RED(Text) ("<t color='#FF0000'>" + ##Text + "</t>")
|
||||
#define ACE_TEXT_GREEN(Text) ("<t color='#00FF00'>" + ##Text + "</t>")
|
||||
#define ACE_TEXT_YELLOW(Text) ("<t color='#FFFF00'>" + ##Text + "</t>")
|
||||
|
1
addons/weather/$PBOPREFIX$
Normal file
1
addons/weather/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\weather
|
12
addons/weather/CfgEventhandlers.hpp
Normal file
12
addons/weather/CfgEventhandlers.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit));
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_PostServerInit));
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
19
addons/weather/CfgWorlds.hpp
Normal file
19
addons/weather/CfgWorlds.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class CfgWorlds {
|
||||
class CAWorld;
|
||||
|
||||
class Stratis: CAWorld {
|
||||
// Source: http://www.iten-online.ch/klima/europa/griechenland/limnos.htm
|
||||
ACE_TempDay[] = {10, 10, 12, 16, 21, 26, 29, 28, 25, 20, 15, 11};
|
||||
ACE_TempNight[] = {4, 4, 6, 8, 13, 17, 20, 20, 16, 12, 8, 6};
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Limnos,Greece
|
||||
ACE_Humidity[] = {78, 77, 78, 74, 71, 60, 59, 61, 65, 72, 79, 80};
|
||||
};
|
||||
|
||||
class Altis: CAWorld {
|
||||
// Source: http://www.iten-online.ch/klima/europa/griechenland/limnos.htm
|
||||
ACE_TempDay[] = {10, 10, 12, 16, 21, 26, 29, 28, 25, 20, 15, 11};
|
||||
ACE_TempNight[] = {4, 4, 6, 8, 13, 17, 20, 20, 16, 12, 8, 6};
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Limnos,Greece
|
||||
ACE_Humidity[] = {78, 77, 78, 74, 71, 60, 59, 61, 65, 72, 79, 80};
|
||||
};
|
||||
};
|
76
addons/weather/XEH_postInit.sqf
Normal file
76
addons/weather/XEH_postInit.sqf
Normal file
@ -0,0 +1,76 @@
|
||||
//XEH_postInit.sqf
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
"ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = time; };
|
||||
"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = time; };
|
||||
"ACE_MISC_PARAMS" addPublicVariableEventHandler {
|
||||
if !(isServer) then {
|
||||
30 setLightnings (ACE_MISC_PARAMS select 0);
|
||||
30 setRainbow (ACE_MISC_PARAMS select 1);
|
||||
30 setFog (ACE_MISC_PARAMS select 2);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Update Wind
|
||||
simulWeatherSync;
|
||||
_fnc_updateWind = {
|
||||
ACE_wind = [] call FUNC(getWind);
|
||||
setWind [ACE_wind select 0, ACE_wind select 1, true];
|
||||
2 setGusts 0;
|
||||
|
||||
// Set waves: 0 when no wind, 1 when wind >= 16 m/s
|
||||
1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0);
|
||||
|
||||
//systemChat format ["w:%1 %2,ACE_w:%1 %2, w", [wind select 0, wind select 1, ACE_wind select 0, ACE_wind select 1]];
|
||||
};
|
||||
[_fnc_updateWind, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
// Update Rain
|
||||
_fnc_updateRain = {
|
||||
if(GVAR(enableRain)) then {
|
||||
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);
|
||||
};
|
||||
};
|
||||
};
|
||||
[_fnc_updateRain, 2, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
// Update Temperature
|
||||
_fnc_updateTemperature = {
|
||||
_time = daytime;
|
||||
_month = date select 1;
|
||||
|
||||
// Temperature
|
||||
_hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440));
|
||||
|
||||
GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef;
|
||||
GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(currentTemperature) - 2 * humidity - 4 * overcast;
|
||||
GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;
|
||||
|
||||
// Humidity
|
||||
GVAR(currentHumidity) = (GVAR(Humidity) select _month) / 100;
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity)
|
||||
|
||||
if (rain > 0 && overcast > 0.7) then {
|
||||
GVAR(currentHumidity) = 1;
|
||||
} else {
|
||||
_avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;
|
||||
_pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
|
||||
_PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature)));
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2;
|
||||
};
|
||||
GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1;
|
||||
|
||||
// @todo: take altitude and humidity into account
|
||||
GVAR(currentRelativeDensity) = (273.15 + 20) / (273.15 + GVAR(currentTemperature));
|
||||
};
|
||||
[_fnc_updateTemperature, 20, []] call CBA_fnc_addPerFrameHandler;
|
3
addons/weather/XEH_postServerInit.sqf
Normal file
3
addons/weather/XEH_postServerInit.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
[FUNC(serverController), 60] call cba_fnc_addPerFrameHandler;
|
17
addons/weather/XEH_preClientInit.sqf
Normal file
17
addons/weather/XEH_preClientInit.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
FUNC(KEEPTIME) = {
|
||||
if((count GVAR(WINDSPEED)) > 0) then {
|
||||
private ["_wind", "_p", "_str"];
|
||||
_wind = ACE_wind;
|
||||
|
||||
_p = _wind call CBA_fnc_vect2polar;
|
||||
_str = format["Wind: %1 at %2m/s (%3MPH)\n%4", floor(_p select 1), floor(_p select 0), floor((_p select 0)*2.23693629), GVAR(WINDSPEED)];
|
||||
TRACE_2("Wind",_wind,_str);
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
[FUNC(KEEPTIME), 0.0, []] call CBA_fnc_addPerFrameHandler;
|
||||
#endif
|
45
addons/weather/XEH_preInit.sqf
Normal file
45
addons/weather/XEH_preInit.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
LOG(MSG_INIT);
|
||||
|
||||
PREP(serverController);
|
||||
PREP(getMapData);
|
||||
PREP(getWind);
|
||||
|
||||
|
||||
|
||||
// Rain variables
|
||||
GVAR(enableRain) = true;
|
||||
GVAR(rain_next_period) = -1;
|
||||
GVAR(rain_period_count) = 0;
|
||||
GVAR(rain_initial_rain) = 0;
|
||||
if(overcast >= 0.7) then {
|
||||
GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3));
|
||||
};
|
||||
GVAR(current_rain) = GVAR(rain_initial_rain);
|
||||
GVAR(rain_current_range) = -1+(random 2);
|
||||
GVAR(overcast_multiplier) = 1;
|
||||
|
||||
// Wind Variables
|
||||
ACE_wind = [0, 0, 0];
|
||||
GVAR(wind_initial_dir) = (random 360);
|
||||
GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1;
|
||||
GVAR(wind_mean_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_mean_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_current_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_range_speed) = -1+(random 2);
|
||||
GVAR(wind_current_range_dir) = -1+(random 2);
|
||||
GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10));
|
||||
GVAR(wind_next_major_period) = -1;
|
||||
GVAR(wind_period_count) = 0;
|
||||
GVAR(wind_major_period_count) = 0;
|
||||
GVAR(wind_total_time) = 0;
|
||||
GVAR(wind_period_start_time) = time;
|
||||
|
||||
// Init weather variables, in case they are needed before postInit
|
||||
call FUNC(getMapData);
|
||||
|
||||
ADDON = true;
|
24
addons/weather/config.cpp
Normal file
24
addons/weather/config.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};// "ACE_Kestrel4500" };
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"q1184", "Rocko", "CAA-Picard"};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventhandlers.hpp"
|
||||
|
||||
#include "CfgWorlds.hpp"
|
||||
|
||||
/*class ACE_Parameters_Numeric {
|
||||
GVAR(XXXX) = 100;
|
||||
};
|
||||
|
||||
class ACE_Parameters_Boolean {
|
||||
GVAR(XXXX) = 0;
|
||||
};*/
|
88
addons/weather/functions/fnc_getMapData.sqf
Normal file
88
addons/weather/functions/fnc_getMapData.sqf
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Author: Ruthberg, CAA-Picard
|
||||
*
|
||||
* Get the weather data for the current map
|
||||
*
|
||||
* Argument:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Check if the weather data is defined in the map config
|
||||
if (isArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay")) exitWith {
|
||||
GVAR(TempDay) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay");
|
||||
GVAR(TempNight) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempNight");
|
||||
GVAR(Humidity) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_Humidity");
|
||||
};
|
||||
|
||||
// Check if the map is among the most popular
|
||||
if (toLower worldName in ["chernarus", "bootcamp_acr", "woodland_acr", "utes"]) then {
|
||||
// Source: http://www.iten-online.ch/klima/europa/tschechien/prag.htm
|
||||
GVAR(TempDay) = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2];
|
||||
GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Prague,Czech-Republic
|
||||
GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
|
||||
};
|
||||
|
||||
if (toLower worldName in ["takistan", "zargabad", "mountains_acr", "shapur_baf", "provinggrounds_pmc"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/asien/afghanistan/kabul.htm
|
||||
GVAR(TempDay) = [4.5, 5.5, 12.5, 19.2, 24.4, 30.2, 32.1, 32, 28.5, 22.4, 15, 8.3];
|
||||
GVAR(TempNight) = [-7.1, -5.7, 0.7, 6, 8.8, 12.4, 15.3, 14.3, 9.4, 3.9, -1.2, -4.7];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Kabul,Afghanistan
|
||||
GVAR(Humidity) = [68, 69, 62, 60, 49, 37, 38, 39, 40, 41, 56, 61];
|
||||
};
|
||||
|
||||
if (toLower worldName in ["fallujah"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/asien/irak/bagdad.htm
|
||||
GVAR(TempDay) = [16, 19, 23, 29, 36, 41, 43, 43, 40, 33, 24, 17];
|
||||
GVAR(TempNight) = [4, 6, 10, 15, 20, 23, 25, 25, 21, 16, 10, 5];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Bagdad,Iraq
|
||||
GVAR(Humidity) = [69, 60, 55, 50, 36, 23, 21, 22, 29, 38, 58, 68];
|
||||
};
|
||||
|
||||
if (toLower worldName in ["fata", "Abbottabad"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/asien/pakistan/zhob.htm
|
||||
GVAR(TempDay) = [12.4, 15.8, 20.8, 26.9, 32.8, 37, 36.8, 35.9, 33.8, 28.2, 22.2, 16.2];
|
||||
GVAR(TempNight) = [-0.6, 2.4, 7.4, 13.1, 18.2, 22.8, 23.8, 22.9, 19.2, 12, 5.6, 1.2];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Zhob,Pakistan
|
||||
GVAR(Humidity) = [50, 40, 42, 40, 30, 30, 50, 49, 40, 32, 38, 41];
|
||||
};
|
||||
|
||||
if (worldName in ["sfp_wamako"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
|
||||
GVAR(TempDay) = [33.4, 35, 38.4, 41.5, 41.4, 40, 35.6, 32.9, 35.8, 38.2, 36.4, 33.1];
|
||||
GVAR(TempNight) = [14.9, 16.3, 20.4, 23.7, 25.8, 24.8, 23.1, 22, 22.6, 21.6, 18.6, 15.3];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Tahoua,Niger
|
||||
GVAR(Humidity) = [68, 60, 57, 50, 32, 22, 20, 21, 25, 38, 58, 69];
|
||||
};
|
||||
|
||||
if (worldName in ["sfp_sturko"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
|
||||
GVAR(TempDay) = [2.2, 2.4, 5.1, 10.2, 16.1, 20.1, 21.1, 20.9, 17.2, 12.7, 7.4, 3.9];
|
||||
GVAR(TempNight) = [-2, -2.3, -0.7, 2.6, 7.1, 11.4, 13.1, 12.7, 10, 6.9, 3.1, -0.1];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,karlskrona,Sweden
|
||||
GVAR(Humidity) = [86, 85, 80, 72, 68, 69, 74, 77, 79, 81, 86, 88];
|
||||
};
|
||||
|
||||
if (worldName in ["Bornholm"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
|
||||
GVAR(TempDay) = [1.9, 1.7, 3.8, 8.1, 14, 18.1, 19.6, 19.8, 16.2, 11.9, 7.3, 3.9];
|
||||
GVAR(TempNight) = [-1.6, -2.1, -0.7, 1.7, 6.2, 10.7, 13, 13.1, 10.6, 7.2, 3.5, 0.1];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,allinge,Denmark
|
||||
GVAR(Humidity) = [85, 84, 80, 76, 69, 69, 76, 77, 79, 81, 86, 86];
|
||||
};
|
||||
if (worldName in ["Imrali"]) exitWith {
|
||||
// Source: http://www.iten-online.ch/klima/europa/tuerkei/bursa.htm
|
||||
GVAR(TempDay) = [9.3, 10.7, 13.6, 18.8, 23.5, 28.2, 30.3, 30.2, 27, 21.4, 16.5, 11.8];
|
||||
GVAR(TempNight) = [1.4, 2.4, 3.7, 7.1, 10.9, 14.3, 16.5, 16.3, 13, 9.5, 6, 3.8];
|
||||
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Bursa,Turkey
|
||||
GVAR(Humidity) = [78, 75, 70, 70, 71, 61, 58, 59, 63, 69, 77, 76];
|
||||
};
|
||||
|
||||
// Assume default values
|
||||
GVAR(TempDay) = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2];
|
||||
GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
|
||||
GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
|
22
addons/weather/functions/fnc_getWind.sqf
Normal file
22
addons/weather/functions/fnc_getWind.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
_return = [0,0,0];
|
||||
if(!isNil "ACE_WIND_PARAMS") then {
|
||||
_dir = ACE_WIND_PARAMS select 0;
|
||||
_dirRange = (ACE_WIND_PARAMS select 1) - (ACE_WIND_PARAMS select 0);
|
||||
_spd = ACE_WIND_PARAMS select 2;
|
||||
_spdRange = (ACE_WIND_PARAMS select 3) - (ACE_WIND_PARAMS select 2);
|
||||
_period = ACE_WIND_PARAMS select 4;
|
||||
|
||||
_periodPosition = (time - GVAR(wind_period_start_time)) min _period;
|
||||
_periodPercent = _periodPosition/_period;
|
||||
_spdInc = _spdRange * _periodPercent;
|
||||
_dirInc = _dirRange * _periodPercent;
|
||||
_spd = (_spd + _spdInc);
|
||||
_dir = _dir + _dirInc;
|
||||
if (_dir > 360) then {_dir = _dir - 360};
|
||||
if (_dir < 0) then {_dir = _dir + 360};
|
||||
|
||||
_return = [_spd * sin _dir, _spd * cos _dir, 0];
|
||||
};
|
||||
_return;
|
87
addons/weather/functions/fnc_serverController.sqf
Normal file
87
addons/weather/functions/fnc_serverController.sqf
Normal file
@ -0,0 +1,87 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Rain simulation
|
||||
if(GVAR(rain_period_count) > GVAR(rain_next_period)) then {
|
||||
|
||||
if(overcast >= 0.7) then {
|
||||
_lastRain = GVAR(current_rain);
|
||||
_rainOverCast = ((overcast-0.7)/0.3);
|
||||
GVAR(rain_next_period) = ceil((1+random(10))/GVAR(overcast_multiplier));
|
||||
|
||||
GVAR(current_rain) = (GVAR(current_rain)+(((GVAR(current_rain)))*((_rainOverCast*(GVAR(overcast_multiplier)))/8)*GVAR(rain_current_range)));
|
||||
GVAR(current_rain) = (GVAR(current_rain) max 0.01) min 1;
|
||||
|
||||
_transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20))+1;
|
||||
GVAR(rain_current_range) = -1+(random 2);
|
||||
|
||||
ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime];
|
||||
TRACE_4("",_lastRain,_rainOverCast,_transitionTime, overcast);
|
||||
} else {
|
||||
GVAR(current_rain) = 0;
|
||||
_lastRain = GVAR(current_rain);
|
||||
_rainOverCast = 1;
|
||||
_transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20))+1;
|
||||
|
||||
ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime];
|
||||
TRACE_4("",_lastRain,_rainOverCast,_transitionTime, overcast);
|
||||
};
|
||||
|
||||
GVAR(rain_period_start_time) = time;
|
||||
publicVariable "ACE_RAIN_PARAMS";
|
||||
};
|
||||
|
||||
// Wind simulation
|
||||
if(GVAR(wind_period_count) > GVAR(wind_next_period)) then {
|
||||
_startDir = GVAR(wind_current_dir);
|
||||
_startSpeed = GVAR(wind_current_speed);
|
||||
GVAR(wind_current_dir) = (GVAR(wind_current_dir)+(((GVAR(wind_current_dir)))*((overcast*(GVAR(overcast_multiplier)))/8)*GVAR(wind_current_range_dir)));
|
||||
|
||||
GVAR(wind_current_speed) = (GVAR(wind_current_speed)+(((GVAR(wind_current_speed)))*(overcast*(GVAR(overcast_multiplier))/12)*GVAR(wind_current_range_speed)));
|
||||
GVAR(wind_current_speed) = GVAR(wind_current_speed) max 0.01;
|
||||
|
||||
if(GVAR(wind_current_dir) < 0) then {
|
||||
GVAR(wind_current_dir) = GVAR(wind_current_dir)+360;
|
||||
};
|
||||
GVAR(wind_current_dir) = GVAR(wind_current_dir) % 360;
|
||||
|
||||
GVAR(wind_current_range_speed) = (-1)+(random 2);
|
||||
|
||||
GVAR(wind_current_range_dir) = (-1)+(random 2);
|
||||
|
||||
GVAR(wind_next_period) = ceil((2+random(5))/(GVAR(overcast_multiplier)));
|
||||
GVAR(wind_period_count) = 0;
|
||||
|
||||
_gustCount = floor(random(GVAR(wind_next_period)*(overcast*((GVAR(overcast_multiplier)^3)))));
|
||||
|
||||
_time = GVAR(wind_next_period)*60;
|
||||
_gusts = [];
|
||||
if(_gustCount > 0) then {
|
||||
_maxInterval = _time/_gustCount;
|
||||
for "_i" from 0 to _gustCount-1 do {
|
||||
_gustTime = (random (3 min _maxInterval));
|
||||
_timeTillGust = (_maxInterval*_i)+(random (_maxInterval - _gustTime));
|
||||
_gustSpeed = (random 1);
|
||||
_gustDir = (GVAR(wind_current_dir)+(GVAR(wind_current_dir)*(-1+(random 2))))*(overcast*(GVAR(overcast_multiplier)));
|
||||
_gusts set[(count _gusts), [_timeTillGust, _gustTime, _gustSpeed, _gustDir]];
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(wind_total_time) = GVAR(wind_total_time) + GVAR(wind_next_period);
|
||||
|
||||
ACE_WIND_PARAMS = [_startDir,
|
||||
GVAR(wind_current_dir),
|
||||
_startSpeed,
|
||||
GVAR(wind_current_speed),
|
||||
_time,
|
||||
_gusts];
|
||||
|
||||
GVAR(wind_period_start_time) = time;
|
||||
publicVariable "ACE_WIND_PARAMS";
|
||||
};
|
||||
|
||||
// Sync misc. parameters
|
||||
ACE_MISC_PARAMS = [lightnings, rainbow, fogParams];
|
||||
publicVariable "ACE_MISC_PARAMS";
|
||||
|
||||
GVAR(rain_period_count) = GVAR(rain_period_count) + 1;
|
||||
GVAR(wind_period_count) = GVAR(wind_period_count) + 1;
|
1
addons/weather/functions/script_component.hpp
Normal file
1
addons/weather/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\weather\script_component.hpp"
|
12
addons/weather/script_component.hpp
Normal file
12
addons/weather/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT weather
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
//#define DEBUG_ENABLED_WEATHER
|
||||
#ifdef DEBUG_ENABLED_WEATHER
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_WEATHER
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_WEATHER
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Loading…
Reference in New Issue
Block a user