Further cleanup

This commit is contained in:
teknomunk 2024-06-12 20:12:04 -05:00
parent 820848fb2e
commit 24ff7347b2
1 changed files with 8 additions and 4 deletions

View File

@ -9,8 +9,10 @@ local mods_loaded = false
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
function mcl_weather.set_sky_box_clear(player, sky, fog) function mcl_weather.set_sky_box_clear(player, sky, fog)
local pos = player:get_pos() -- Make sure the player's head isn't in water before changing the skybox
if minetest.get_item_group( mcl_playerinfo[player:get_player_name()].node_head, "water") ~= 0 then return end local node_head = mcl_playerinfo[player:get_player_name()].node_head
if minetest.get_item_group(node_head, "water") ~= 0 then return end
local sc = { local sc = {
day_sky = "#7BA4FF", day_sky = "#7BA4FF",
day_horizon = "#C0D8FF", day_horizon = "#C0D8FF",
@ -39,8 +41,10 @@ function mcl_weather.set_sky_box_clear(player, sky, fog)
end end
function mcl_weather.set_sky_color(player, def) function mcl_weather.set_sky_color(player, def)
local pos = player:get_pos() -- Make sure the player's head isn't in water before changing the skybox
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1.5, 0)).name, "water") ~= 0 then return end local node_head = mcl_playerinfo[player:get_player_name()].node_head
if minetest.get_item_group(node_head, "water") ~= 0 then return end
player:set_sky({ player:set_sky({
type = def.type, type = def.type,
sky_color = def.sky_color, sky_color = def.sky_color,