add deeper = darker

This commit is contained in:
epCode 2022-11-14 14:43:13 -08:00 committed by Gitea
parent ce724ee926
commit a5eb1d240e
2 changed files with 51 additions and 10 deletions

View File

@ -50,7 +50,7 @@ minetest.register_node("mcl_core:water_flowing", {
liquid_viscosity = WATER_VISC,
liquid_range = 7,
waving = 3,
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
post_effect_color = {a=20, 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
@ -95,7 +95,7 @@ S("• When water is directly below lava, the water turns into stone."),
liquid_alternative_source = "mcl_core:water_source",
liquid_viscosity = WATER_VISC,
liquid_range = 7,
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
post_effect_color = {a=60, r=0x03, g=0x3C, b=0x5C},
stack_max = 64,
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
_mcl_blast_resistance = 100,

View File

@ -3,6 +3,8 @@ 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
@ -25,6 +27,26 @@ 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()
@ -395,6 +417,25 @@ 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 = 8, y = 4},
offset = {x = 0, y = 0},
z_index = -1002,
}))
end
end
else
remove_water_hud(player)
end
elytra.last_yaw = player:get_look_horizontal()
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.