forked from itsJarrett/FiveM-DinoWeather
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsh_config.lua
171 lines (156 loc) · 9.83 KB
/
sh_config.lua
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
--[[
_____ _ __ __ _ _
| __ \(_) \ \ / / | | | |
| | | |_ _ __ __\ \ /\ / /__ __ _| |_| |__ ___ _ __
| | | | | '_ \ / _ \ \/ \/ / _ \/ _` | __| '_ \ / _ \ '__|
| |__| | | | | | (_) \ /\ / __/ (_| | |_| | | | __/ |
|_____/|_|_| |_|\___/ \/ \/ \___|\__,_|\__|_| |_|\___|_|
FiveM-DinoWeather
A Weather System that enhances realism by using GTA Natives relating to Zones.
Copyright (C) 2019 Jarrett Boice
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
WeatherConfig = {}
WeatherConfig = setmetatable(WeatherConfig, {})
activeWeatherSystems = {}
WeatherConfig.decemberSnowDays = { 6, 9, 12, 15, 18, 21, 22, 23, 24, 25, 26, 27 }
WeatherConfig.weatherTypes = {
"CLEAR",
"EXTRASUNNY",
"CLOUDS",
"OVERCAST",
"RAIN",
"CLEARING",
"THUNDER",
"SMOG",
"FOGGY",
"XMAS",
"SNOWLIGHT",
"BLIZZARD"
}
WeatherConfig.randomizeTime = 3600000 -- 1 Hour (TIME TO RANDOMIZE WEATHER SYSTEMS IN MILLISECONDS)
WeatherConfig.weatherSystems = {
{
{ "TERMINA", "ELYSIAN", "AIRP", "BANNING", "DELSOL", "RANCHO", "STRAW", "CYPRE", "SANAND" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] }, -- Spring
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] }, -- Summer
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] }, -- Fall
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] } -- Winter
}, -- South LS
{
{ "MURRI", "LMESA", "SKID", "LEGSQU", "TEXTI", "PBOX", "KOREAT" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Central LS
{
{ "MIRR", "EAST_V", "DTVINE", "ALTA", "HAWICK", "BURTON", "ROCKF", "MOVIE", "DELPE", "MORN", "RICHM", "GOLF", "WVINE", "DTVINE", "HORS", "LACT", "LDAM" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- North LS
{
{ "BEACH", "VESP", "VCANA", "DELBE", "PBLUFF" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- LS Beaches
{
{ "EBURO", "PALHIGH", "NOOSE", "TATAMO" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Eastern Valley
{
{ "BANHAMC", "BANHAMCA", "CHU", "TONGVAH" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Coastal Beaches
{
{ "CHIL", "GREATC", "RGLEN", "TONGVAV", "" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- North LS Hills
{
{ "PALMPOW", "WINDF", "RTRACK", "JAIL", "HARMO", "DESRT", "SANDY", "ZQ_UAR", "HUMLAB", "SANCHIA", "GRAPES", "ALAMO", "SLAB", "CALAFAB" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Grand Senora Desert
{
{ "MTGORDO", "ELGORL", "BRADP", "BRADT", "MTCHIL", "GALFISH" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Northern Moutains
{
{ "LAGO", "ARMYB", "NCHU", "CANNY", "MTJOSE" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Zancudo
{
{ "CMSW", "PALCOV", "OCEANA", "PALFOR", "PALETO", "PROCOB" },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4] },
{ WeatherConfig.weatherTypes[1], WeatherConfig.weatherTypes[2], WeatherConfig.weatherTypes[3] },
{ WeatherConfig.weatherTypes[3], WeatherConfig.weatherTypes[4], WeatherConfig.weatherTypes[5], WeatherConfig.weatherTypes[6], WeatherConfig.weatherTypes[7], WeatherConfig.weatherTypes[8] },
{ WeatherConfig.weatherTypes[8], WeatherConfig.weatherTypes[9], WeatherConfig.weatherTypes[12], WeatherConfig.weatherTypes[11] }
}, -- Palteo
}
WeatherConfig.timesOfYear = {
{ 3, 4, 5 }, --SPRING 1
{ 6, 7, 8 }, --SUMMER 2
{ 9, 10, 11 }, --FALL 3
{ 12, 1, 2 } --WINTER 4
}
function getCurrentSeason()
for i, timeOfYear in ipairs(WeatherConfig.timesOfYear) do
for k, month in ipairs(WeatherConfig.timesOfYear[i]) do
if month == os.date("*t").month then
return i
end
end
end
end
function isSnowDay()
for i, decemberSnowDay in ipairs(WeatherConfig.decemberSnowDays) do
if decemberSnowDay == os.date("*t").day then
return true
end
end
return false
end
function randomizeSystems()
for i, weatherSystem in ipairs(WeatherConfig.weatherSystems) do
local currentSeason = getCurrentSeason()
local availableWeathers = weatherSystem[currentSeason + 1]
local pickedWeather = availableWeathers[math.random(1, #availableWeathers)]
for _, weatherZone in ipairs(weatherSystem[1]) do
if os.date("*t").month == 12 and isSnowDay() then
table.insert(activeWeatherSystems, {weatherZone, "XMAS"})
else
table.insert(activeWeatherSystems, {weatherZone, pickedWeather})
end
end
end
end