0
0
Fork 0

Remove water HUD code

This commit is contained in:
FossFanatic 2023-01-27 15:47:25 +00:00 committed by Gitea
parent 1abd226e07
commit 3546d04aaa
1 changed files with 3 additions and 40 deletions

View File

@ -3,8 +3,6 @@ mcl_playerplus = {
is_pressing_jump = {},
}
local hud_water = {}
local get_connected_players = minetest.get_connected_players
local dir_to_yaw = minetest.dir_to_yaw
local get_item_group = minetest.get_item_group
@ -27,26 +25,6 @@ local mcl_playerplus_internal = {}
local time = 0
local look_pitch = 0
local function calculate_water_depth(pos)
for i=1, 50 do
if get_item_group(minetest.get_node(vector.new(pos.x,pos.y+i,pos.z)).name, "water") == 0 then
return i
end
end
return 50
end
local function remove_water_hud(player)
if hud_water[player] then
mcl_weather.skycolor.update_sky_color()
for i=1, #hud_water[player] do
player:hud_remove(hud_water[player][i])
end
hud_water[player] = nil
end
end
local function player_collision(player)
local pos = player:get_pos()
@ -417,23 +395,8 @@ minetest.register_globalstep(function(dtime)
set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0))
end
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 then
if not hud_water[player] or hud_water[player] and calculate_water_depth(player:get_pos()) ~= #hud_water[player] then
remove_water_hud(player)
hud_water[player] = {}
for i=1, calculate_water_depth(player:get_pos()) do
table.insert(hud_water[player], player:hud_add({
hud_elem_type = "image",
text = "mcl_playerplus_water.png",
position = {x = 0.5, y = 0.5},
scale = {x = 32, y = 16},
offset = {x = 0, y = 0},
z_index = -1002,
}))
end
end
else
remove_water_hud(player)
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 or get_item_group(mcl_playerinfo[name].node_head, "water") ~= 1 then
mcl_weather.skycolor.update_sky_color()
end
elytra.last_yaw = player:get_look_horizontal()
@ -643,7 +606,7 @@ minetest.register_globalstep(function(dtime)
local vi = area:indexp({x=x, y=y, z=z})
local nodename = get_name_from_content_id(data[vi])
local light_block_group = minetest.get_item_group(nodename, "light_block")
local tex
if nodename == "mcl_core:barrier" then
tex = "mcl_core_barrier.png"