From 0cb19ea9b15ec4c8404c5ce7c5fab7cf8f1bbe6a Mon Sep 17 00:00:00 2001 From: general Date: Thu, 21 Jul 2022 15:28:14 -0400 Subject: [PATCH] detect when weather are enabled so do not crash twilight mod lodading * twiligh mod try to set the weather but the weather mod could be disabled * fixed and close https://github.com/D00Med/LegendofMinetest/issues/49 --- mods/twilight/init.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/twilight/init.lua b/mods/twilight/init.lua index dd7492e..336c03f 100644 --- a/mods/twilight/init.lua +++ b/mods/twilight/init.lua @@ -12,7 +12,12 @@ local twilightsky = { "sky_pos_x.png", } -if minetest.setting_getbool("twilight") then +weather_mode = false +if minetest.setting_get("enable_weather") then +weather_mode = true +end + +if minetest.setting_getbool("twilight") and weather_mode then twilight_mode = true else twilight_mode = false @@ -141,11 +146,13 @@ if twilight_mode == true then end else for _, player in ipairs(minetest.get_connected_players()) do + if weather_mode then if hyrule_weather.weather == "twilight" then player:set_sky({}, "regular", {}) -- Sets skybox player:override_day_night_ratio(nil) hyrule_weather.weather = "none" hyrule_weather.current = 7 + end end local pname = player:get_player_name(); local inv = minetest.get_inventory({type="player", name=pname});