Skip to content

Commit

Permalink
Weather - Winter Terrain Temperatures (#9943)
Browse files Browse the repository at this point in the history
* a -> an

* Added last resort catch for winter maps to define suitable temps

* removed debug line

* purge 🧼

* added check for "snow" in raintexture

* cleaned up conditions

* Update arma-3-scheduler-and-our-practices.md

* isNull && {}

* Update fnc_getMapData.sqf

* Update fnc_getMapData.sqf

* Update fnc_getMapData.sqf

* changed order in condition checks and indentation

* not so lazy

* deep config lookup -> _cfg

* comment

* removed accidental empty line

* 🎢

* Update fnc_getMapData.sqf

* Revert "Update fnc_getMapData.sqf"

This reverts commit a57d114.

* Update addons/weather/functions/fnc_getMapData.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/weather/functions/fnc_getMapData.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/weather/functions/fnc_getMapData.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* then -> exitWith

---------

Co-authored-by: Mr. Zorn <56258612+PulsarNeutronStar@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 10, 2024
1 parent 3255dbe commit 2b5ea16
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions addons/weather/functions/fnc_getMapData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,35 @@ GVAR(currentHumidity) = 0;
GVAR(currentOvercast) = 0;

// Get all non inherited arrays to filter maps that inherit from Stratis/Altis/Tanoa
private _nonInheritedArrays = configProperties [configFile >> "CfgWorlds" >> _worldName, "isArray _x", false];
private _cfgPath = configFile >> "CfgWorlds" >> _worldName;
private _nonInheritedArrays = configProperties [_cfgPath, "isArray _x", false];
// And check if any custom non-inherited weather is defined through config and use that if so
if ((configFile >> "CfgWorlds" >> _worldName >> "ACE_TempDay") in _nonInheritedArrays) exitWith {
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_TempDay")) then {
GVAR(TempDay) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_TempDay");
if ((_cfgPath >> "ACE_TempDay") in _nonInheritedArrays) exitWith {
if (isArray (_cfgPath >> "ACE_TempDay")) then {
GVAR(TempDay) = getArray (_cfgPath >> "ACE_TempDay");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_TempNight")) then {
GVAR(TempNight) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_TempNight");
if (isArray (_cfgPath >> "ACE_TempNight")) then {
GVAR(TempNight) = getArray (_cfgPath >> "ACE_TempNight");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_Humidity")) then {
GVAR(Humidity) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_Humidity");
if (isArray (_cfgPath >> "ACE_Humidity")) then {
GVAR(Humidity) = getArray (_cfgPath >> "ACE_Humidity");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMin")) then {
GVAR(WindSpeedMin) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMin");
if (isArray (_cfgPath >> "ACE_WindSpeedMin")) then {
GVAR(WindSpeedMin) = getArray (_cfgPath >> "ACE_WindSpeedMin");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMean")) then {
GVAR(WindSpeedMean) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMean");
if (isArray (_cfgPath >> "ACE_WindSpeedMean")) then {
GVAR(WindSpeedMean) = getArray (_cfgPath >> "ACE_WindSpeedMean");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMax")) then {
GVAR(WindSpeedMax) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindSpeedMax");
if (isArray (_cfgPath >> "ACE_WindSpeedMax")) then {
GVAR(WindSpeedMax) = getArray (_cfgPath >> "ACE_WindSpeedMax");
};
if (isArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindDirectionProbabilities")) then {
GVAR(WindDirectionProbabilities) = getArray (configFile >> "CfgWorlds" >> _worldName >> "ACE_WindDirectionProbabilities");
if (isArray (_cfgPath >> "ACE_WindDirectionProbabilities")) then {
GVAR(WindDirectionProbabilities) = getArray (_cfgPath >> "ACE_WindDirectionProbabilities");
};
};

// Check if the map is among the most popular
if (_worldName in ["chernarus", "bootcamp_acr", "woodland_acr", "utes"]) then {
if (_worldName in ["chernarus", "bootcamp_acr", "woodland_acr", "utes"]) exitWith {
// 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];
Expand Down Expand Up @@ -239,3 +240,17 @@ if (_worldName in ["kunduz"]) exitWith {
[0.04, 0.02, 0.05, 0.14, 0.19, 0.07, 0.10, 0.07] // December
];
};


// Catches any "Winter" Map that hasnt been defined otherwise - this should stay at the end of the file
// Values are not based on any RL reference since the snow terrain textures persists regardless the date
_cfgPath = _cfgPath >> "RainParticles";
if (
"winter" in _worldName ||
{"snow" in getText (_cfgPath >> "rainDropTexture")} ||
{getNumber (_cfgPath >> "snow") != 0}
) exitWith {
GVAR(TempDay) = [-10,-9,-8,-7,-6,-5,-6,-7,-8,-9,-10,-11];
GVAR(TempNight) = [-15,-14,-13,-12,-11,-10,-9,-10,-11,-12,-13,-17];
GVAR(Humidity) = [82, 80, 81, 82, 83, 82, 81, 82, 83, 82, 83, 82];
};

0 comments on commit 2b5ea16

Please sign in to comment.