From b9686c2d9fb83e4449629a05033866ddd3c7eb3a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 25 Jan 2018 03:55:08 +0100 Subject: [PATCH] Allow to disable weather changes --- mods/ENVIRONMENT/mcl_weather/weather_core.lua | 17 +++++++++-------- settingtypes.txt | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/weather_core.lua b/mods/ENVIRONMENT/mcl_weather/weather_core.lua index 0838798727..f4f22cffc3 100644 --- a/mods/ENVIRONMENT/mcl_weather/weather_core.lua +++ b/mods/ENVIRONMENT/mcl_weather/weather_core.lua @@ -19,9 +19,6 @@ mcl_weather.end_time = nil -- registered weathers mcl_weather.reg_weathers = {} --- automaticly calculates intervals and swap weathers -mcl_weather.auto_mode = true - -- global flag to disable/enable ABM logic. mcl_weather.allow_abm = true @@ -123,16 +120,20 @@ mcl_weather.get_random_pos_by_player_look_dir = function(player) end minetest.register_globalstep(function(dtime) - if mcl_weather.auto_mode == false then - return 0 - end - if mcl_weather.end_time == nil then mcl_weather.end_time = mcl_weather.get_rand_end_time() end -- recalculate weather if mcl_weather.end_time <= minetest.get_gametime() then - mcl_weather.set_random_weather(mcl_weather.state, mcl_weather.reg_weathers[mcl_weather.state]) + local changeWeather = minetest.settings:get_bool("mcl_doWeatherCycle") + if changeWeather == nil then + changeWeather = true + end + if changeWeather then + mcl_weather.set_random_weather(mcl_weather.state, mcl_weather.reg_weathers[mcl_weather.state]) + else + mcl_weather.end_time = mcl_weather.get_rand_end_time() + end end end) diff --git a/settingtypes.txt b/settingtypes.txt index 9268fb2509..56dd867549 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -30,6 +30,9 @@ mcl_keepInventory (Keep inventory on death) bool false # If enabled, chat messages are shown to everyone when a player dies. mcl_showDeathMessages (Show death messages) bool true +# If enabled, the weather will change naturally over time. +mcl_doWeatherCycle (Change weather) bool true + # If enabled, only peaceful mobs will appear naturally. This does not # affect monster spawners. # This setting is only read at startup.