From edf1aa408718989726627cd9eb982b1f65d778e0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Feb 2021 21:06:17 +0100 Subject: [PATCH] fixes --- climatez.conf | 6 +++--- engine.lua | 44 +++++++++++--------------------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/climatez.conf b/climatez.conf index 307c129..7f496f2 100644 --- a/climatez.conf +++ b/climatez.conf @@ -2,15 +2,15 @@ climate_min_height = -10 #Chance of the a new volume climate to be created ##in seconds -climate_change_ratio = 600 +climate_change_ratio = 5 #Volume of the regional climates (sphere) climate_radius = 80 #Average time of the climate -climate_duration = 80 +climate_duration = 5 #Random deviation for the duration climate_duration_random_ratio = 0.45 #Await this min time between climates -climate_period = 600 +climate_period = 5 #Sounds climate_rain_sound = true #Storm Chance diff --git a/engine.lua b/engine.lua index a03ad84..98ba44e 100644 --- a/engine.lua +++ b/engine.lua @@ -212,16 +212,12 @@ end local function get_id() local id --search for a free position - for i= 1, #climatez.climates do + for i= 1, (#climatez.climates+1) do if not climatez.climates[i] then id = i break end end - --if no site, add to the end - if not id then - id = #climatez.climates + 1 - end return id end @@ -234,7 +230,6 @@ local function add_climate_player(player, _climate_id, _downfall) clouds_color = nil, rain_sound_handle = nil, } - local sky_color = player:get_sky().sky_color local downfall_sky_color, downfall_clouds_color if _downfall == "rain" or _downfall == "storm" or _downfall == "snow" then downfall_sky_color = "#808080" @@ -243,18 +238,13 @@ local function add_climate_player(player, _climate_id, _downfall) downfall_sky_color = "#DEB887" downfall_clouds_color = "#DEB887" end - if sky_color then - climatez.players[player_name].sky_color = sky_color - end + climatez.players[player_name].sky_color = player:get_sky().sky_color or "#8cbafa" player:set_sky({ sky_color = { day_sky = downfall_sky_color, } }) - local clouds_color = player:get_clouds().color - if clouds_color then - climatez.players[player_name].clouds_color = clouds_color - end + climatez.players[player_name].clouds_color = player:get_clouds().color or "#fff0f0e5" player:set_clouds({ color = downfall_clouds_color, }) @@ -271,26 +261,14 @@ end local function remove_climate_player(player) local player_name = player:get_player_name() - if climatez.players[player_name].sky_color then - player:set_sky({ - sky_color = climatez.players[player_name].sky_color, - }) - else - player:set_sky({ - sky_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 + player:set_sky({ + sky_color = { + day_sky = climatez.players[player_name].sky_color, + } + }) + player:set_clouds({ + color = climatez.players[player_name].clouds_color, + }) local downfall = climatez.players[player_name].downfall local rain_sound_handle = climatez.players[player_name].rain_sound_handle if rain_sound_handle and climatez.settings.climate_rain_sound