From ce724ee926170d24367a2ca6c8bd96c406bf9e69 Mon Sep 17 00:00:00 2001 From: epCode Date: Mon, 14 Nov 2022 14:42:33 -0800 Subject: [PATCH] make sky color change when submerged --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index a4108598f..66f5c9363 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,6 +1,8 @@ local mods_loaded = false local NIGHT_VISION_RATIO = 0.45 +water_color = "#0b4880" + function mcl_weather.set_sky_box_clear(player) player:set_sky({ type = "regular", @@ -96,7 +98,19 @@ mcl_weather.skycolor = { local pos = player:get_pos() local dim = mcl_worlds.pos_to_dimension(pos) local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - if dim == "overworld" then + if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then + player:set_sky({ type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + }, + clouds = true, + }) + elseif dim == "overworld" then if (mcl_weather.state == "none") then -- Clear weather mcl_weather.set_sky_box_clear(player)