Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snow option to Change Weather module #682

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion addons/modules/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,61 @@ if (isServer) then {
_unit allowFleeing 0;
}] call CBA_fnc_addEventHandler;

[QGVAR(applyWeatherSnow), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably renamed to something like "toggle snow"

params ["_turnOnSnow"];

if (_turnOnSnow) then {
setRain [
"a3\data_f\snowflake4_ca.paa", // rainDropTexture
4, // texDropCount
0.01, // minRainDensity
25, // effectRadius
0.05, // windCoef
2.5, // dropSpeed
0.5, // rndSpeed
0.5, // rndDir
0.07, // dropWidth
0.07, // dropHeight
[1, 1, 1, 0.5], // dropColor
0.0, // lumSunFront
0.2, // lumSunBack
0.5, // refractCoef
0.5, // refractSaturation
true, // snow
false // dropColorStrong
]
} else {
setRain [];
};
}] call CBA_fnc_addEventHandler;

[QGVAR(applyWeather), {
params ["_forced", "_overcast", "_rain", "_lightning", "_rainbow", "_waves", "_wind", "_gusts", "_fog"];
params ["_forced", "_overcast", "_rain", "_lightning", "_rainbow", "_waves", "_wind", "_gusts", "_fog", ["_precipitation", -1]];
mharis001 marked this conversation as resolved.
Show resolved Hide resolved

0 setOvercast _overcast;
0 setLightnings _lightning;
0 setRainbow _rainbow;
0 setWaves _waves;
0 setGusts _gusts;

if (_precipitation == 0) then {
// Set rain particles to default
[QGVAR(applyWeatherSnow), false] call CBA_fnc_localEvent;
};

if (isServer) then {
0 setRain _rain;
0 setFog _fog;
setWind _wind;

if (_precipitation == 1) then {
// Broadcast globally and make JIP compatible
[QGVAR(applyWeatherSnow), true, QGVAR(applyWeatherSnowJIPID)] call CBA_fnc_globalEventJIP;
} else {
// Remove Event from JIP queue
QGVAR(applyWeatherSnowJIPID) call CBA_fnc_removeGlobalEventJIP;
};

if (_forced) then {
forceWeatherChange;
};
Expand Down
9 changes: 8 additions & 1 deletion addons/modules/functions/fnc_moduleWeather.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ params ["_logic"];
[0, 1, rain],
true
],
[
"TOOLBOX",
[LSTRING(ModuleWeather_Precipitation), LSTRING(ModuleWeather_Precipitation_Tooltip)],
[parseNumber (rainParams select 15), 1, 2, [LSTRING(ModuleWeather_Rain), LSTRING(ModuleWeather_Snow)]],
true
],
[
"SLIDER:PERCENT",
[LSTRING(ModuleWeather_Lightning), LSTRING(ModuleWeather_Lightning_Tooltip)],
Expand Down Expand Up @@ -96,6 +102,7 @@ params ["_logic"];
"_forced",
"_overcast",
"_rain",
"_precipitation",
johnb432 marked this conversation as resolved.
Show resolved Hide resolved
"_lightning",
"_rainbow",
"_waves",
Expand All @@ -110,7 +117,7 @@ params ["_logic"];
private _wind = [KMH_TO_MS(_windSpeed) * sin _windDirection, KMH_TO_MS(_windSpeed) * cos _windDirection, true];
private _fog = [_fogDensity, _fogDecay, _fogAltitude];

[QGVAR(applyWeather), [_forced, _overcast, _rain, _lightning, _rainbow, _waves, _wind, _gusts, _fog]] call CBA_fnc_globalEvent;
[QGVAR(applyWeather), [_forced, _overcast, _rain, _lightning, _rainbow, _waves, _wind, _gusts, _fog, _precipitation]] call CBA_fnc_globalEvent;
}, {}, [], QGVAR(moduleWeather)] call EFUNC(dialog,create);

deleteVehicle _logic;
15 changes: 15 additions & 0 deletions addons/modules/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,21 @@
<Chinese>設置降雨強度,要求雲量大於70%。</Chinese>
<Italian>Imposta l'intensità della pioggia, richiede un cielo coperto superiore al 70%.</Italian>
</Key>
<Key ID="STR_ZEN_Modules_ModuleWeather_Precipitation">
<English>Precipitation</English>
<German>Niederschlag</German>
<French>Précipitation</French>
</Key>
<Key ID="STR_ZEN_Modules_ModuleWeather_Precipitation_Tooltip">
<English>Sets the type of precipitation.</English>
<German>Legt den Niederschlagstyp fest.</German>
<French>Défini le type de précipitation.</French>
</Key>
<Key ID="STR_ZEN_Modules_ModuleWeather_Snow">
<English>Snow</English>
<German>Schnee</German>
<French>Neige</French>
</Key>
<Key ID="STR_ZEN_Modules_ModuleWeather_Lightning">
<English>Lightning</English>
<German>Blitzschlag</German>
Expand Down