Correct conditions for water-air transition forced skycolor update

This commit is contained in:
teknomunk 2024-06-19 06:54:44 -05:00
parent 629907c0df
commit c999d10ad5

@ -407,13 +407,30 @@ minetest.register_globalstep(function(dtime)
set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0)) set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0))
end end
local underwater local playerinfo = mcl_playerinfo[name] or {}
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and underwater ~= true then local plusinfo = playerinfo.mcl_playerplus
mcl_weather.skycolor.update_sky_color() if not plusinfo then
local underwater = true plusinfo = {}
elseif get_item_group(mcl_playerinfo[name].node_head, "water") == 0 and underwater == true then playerinfo.mcl_playerplus = plusinfo
mcl_weather.skycolor.update_sky_color() end
local underwater = false
-- Only process if node_head changed
if plusinfo.old_node_head ~= playerinfo.node_head then
local node_head = playerinfo.node_head or ""
local old_node_head = plusinfo.old_node_head or ""
plusinfo.old_node_head = playerinfo.node_head
minetest.log(dump({
node_head = node_head,
old_node_head = old_node_head,
new_group = get_item_group(node_head, "water"),
old_group = get_item_group(old_node_head, "water"),
}))
-- Update skycolor if moving in or out of water
if (get_item_group(node_head, "water") == 0) ~= (get_item_group(old_node_head, "water") == 0) then
mcl_weather.skycolor.update_sky_color()
end
end end
elytra.last_yaw = player:get_look_horizontal() elytra.last_yaw = player:get_look_horizontal()