/
PMC_weather.sqf
61 lines (48 loc) · 1.41 KB
/
PMC_weather.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// random weather
private _Overcast_Random_Amount = _this select 0;
private _ran = (random _Overcast_Random_Amount);
// apparently rain doesnt work if overcast value is above 1 :)
if (_ran > 1) then { _ran = 1; };
0 setOvercast _ran;
forceWeatherChange;
[_ran] spawn
{
sleep 7;
player sideChat format["Initial weather: %1", _this select 0];
hint format["Initial weather: %1", _this select 0];
};
// this is run on server only
[_Overcast_Random_Amount] spawn
{
private
[
"_duration",
"_ForeCast",
"_minimum_change_time",
"_Overcast_Random_Amount",
"_PMC_WeatherChangeTime",
"_PMC_do_overcast"
];
_Overcast_Random_Amount = _this select 0;
call compile preProcessFileLineNumbers "PMC\PMC_weather_to_string.sqf";
while {true} do
{
_duration = random (60 * 10);
_minimum_change_time = 5400;
_PMC_do_overcast = random _Overcast_Random_Amount;
_ForeCast = [_PMC_do_overcast] call PMC_weather_to_string;
PMC_Weather_forecast = format
[
"PMC_Weather: report: %1 change time %2 min, duration %3 min. setOvercast: %4",
_ForeCast,
(floor (_minimum_change_time / 60)),
(floor (_duration / 60)),
_PMC_do_overcast
];
publicVariable "PMC_Weather_forecast";
_minimum_change_time setOvercast _PMC_do_overcast;
simulWeatherSync;
diag_log format["%1", PMC_Weather_forecast];
sleep (_minimum_change_time + _duration);
};
};