master
root 2021-02-20 21:06:17 +01:00
parent 56d26b12c5
commit edf1aa4087
2 changed files with 14 additions and 36 deletions

View File

@ -2,15 +2,15 @@
climate_min_height = -10 climate_min_height = -10
#Chance of the a new volume climate to be created #Chance of the a new volume climate to be created
##in seconds ##in seconds
climate_change_ratio = 600 climate_change_ratio = 5
#Volume of the regional climates (sphere) #Volume of the regional climates (sphere)
climate_radius = 80 climate_radius = 80
#Average time of the climate #Average time of the climate
climate_duration = 80 climate_duration = 5
#Random deviation for the duration #Random deviation for the duration
climate_duration_random_ratio = 0.45 climate_duration_random_ratio = 0.45
#Await this min time between climates #Await this min time between climates
climate_period = 600 climate_period = 5
#Sounds #Sounds
climate_rain_sound = true climate_rain_sound = true
#Storm Chance #Storm Chance

View File

@ -212,16 +212,12 @@ end
local function get_id() local function get_id()
local id local id
--search for a free position --search for a free position
for i= 1, #climatez.climates do for i= 1, (#climatez.climates+1) do
if not climatez.climates[i] then if not climatez.climates[i] then
id = i id = i
break break
end end
end end
--if no site, add to the end
if not id then
id = #climatez.climates + 1
end
return id return id
end end
@ -234,7 +230,6 @@ local function add_climate_player(player, _climate_id, _downfall)
clouds_color = nil, clouds_color = nil,
rain_sound_handle = nil, rain_sound_handle = nil,
} }
local sky_color = player:get_sky().sky_color
local downfall_sky_color, downfall_clouds_color local downfall_sky_color, downfall_clouds_color
if _downfall == "rain" or _downfall == "storm" or _downfall == "snow" then if _downfall == "rain" or _downfall == "storm" or _downfall == "snow" then
downfall_sky_color = "#808080" downfall_sky_color = "#808080"
@ -243,18 +238,13 @@ local function add_climate_player(player, _climate_id, _downfall)
downfall_sky_color = "#DEB887" downfall_sky_color = "#DEB887"
downfall_clouds_color = "#DEB887" downfall_clouds_color = "#DEB887"
end end
if sky_color then climatez.players[player_name].sky_color = player:get_sky().sky_color or "#8cbafa"
climatez.players[player_name].sky_color = sky_color
end
player:set_sky({ player:set_sky({
sky_color = { sky_color = {
day_sky = downfall_sky_color, day_sky = downfall_sky_color,
} }
}) })
local clouds_color = player:get_clouds().color climatez.players[player_name].clouds_color = player:get_clouds().color or "#fff0f0e5"
if clouds_color then
climatez.players[player_name].clouds_color = clouds_color
end
player:set_clouds({ player:set_clouds({
color = downfall_clouds_color, color = downfall_clouds_color,
}) })
@ -271,26 +261,14 @@ end
local function remove_climate_player(player) local function remove_climate_player(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if climatez.players[player_name].sky_color then player:set_sky({
player:set_sky({ sky_color = {
sky_color = climatez.players[player_name].sky_color, day_sky = climatez.players[player_name].sky_color,
}) }
else })
player:set_sky({ player:set_clouds({
sky_color = { color = climatez.players[player_name].clouds_color,
day_sky = "#8cbafa", })
}
})
end
if climatez.players[player_name].clouds_color then
player:set_clouds({
color = climatez.players[player_name].clouds_color,
})
else
player:set_clouds({
color = "#fff0f0e5",
})
end
local downfall = climatez.players[player_name].downfall local downfall = climatez.players[player_name].downfall
local rain_sound_handle = climatez.players[player_name].rain_sound_handle local rain_sound_handle = climatez.players[player_name].rain_sound_handle
if rain_sound_handle and climatez.settings.climate_rain_sound if rain_sound_handle and climatez.settings.climate_rain_sound