mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Merge pull request 'Underwater Darkness HUD Removal' (#3367) from water_darkness_hud_removal into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3367 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
commit
63ace64cae
@ -50,7 +50,7 @@ minetest.register_node("mcl_core:water_flowing", {
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
waving = 3,
|
||||
post_effect_color = {a=20, r=0x03, g=0x3C, b=0x5C},
|
||||
post_effect_color = {a=60, r=0x03, g=0x3C, b=0x5C},
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
|
@ -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,13 @@ 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)
|
||||
local underwater
|
||||
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and underwater ~= true then
|
||||
mcl_weather.skycolor.update_sky_color()
|
||||
local underwater = true
|
||||
elseif get_item_group(mcl_playerinfo[name].node_head, "water") == 0 and underwater == true then
|
||||
mcl_weather.skycolor.update_sky_color()
|
||||
local underwater = false
|
||||
end
|
||||
|
||||
elytra.last_yaw = player:get_look_horizontal()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
Loading…
Reference in New Issue
Block a user