add deeper = darker
parent
ce724ee926
commit
a5eb1d240e
|
@ -50,7 +50,7 @@ minetest.register_node("mcl_core:water_flowing", {
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
liquid_range = 7,
|
liquid_range = 7,
|
||||||
waving = 3,
|
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},
|
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,
|
_mcl_blast_resistance = 100,
|
||||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
-- 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_alternative_source = "mcl_core:water_source",
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
liquid_range = 7,
|
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,
|
stack_max = 64,
|
||||||
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||||
_mcl_blast_resistance = 100,
|
_mcl_blast_resistance = 100,
|
||||||
|
|
|
@ -3,6 +3,8 @@ mcl_playerplus = {
|
||||||
is_pressing_jump = {},
|
is_pressing_jump = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local hud_water = {}
|
||||||
|
|
||||||
local get_connected_players = minetest.get_connected_players
|
local get_connected_players = minetest.get_connected_players
|
||||||
local dir_to_yaw = minetest.dir_to_yaw
|
local dir_to_yaw = minetest.dir_to_yaw
|
||||||
local get_item_group = minetest.get_item_group
|
local get_item_group = minetest.get_item_group
|
||||||
|
@ -25,6 +27,26 @@ local mcl_playerplus_internal = {}
|
||||||
local time = 0
|
local time = 0
|
||||||
local look_pitch = 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 function player_collision(player)
|
||||||
|
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
|
@ -349,16 +371,16 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- set head pitch and yaw when flying
|
-- set head pitch and yaw when flying
|
||||||
local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 50, player_vel_yaw - yaw, 0)
|
local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 50, player_vel_yaw - yaw, 0)
|
||||||
set_bone_pos(player,"Head_Control", nil, head_rot)
|
set_bone_pos(player,"Head_Control", nil, head_rot)
|
||||||
|
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties(player, player_props_elytra)
|
set_properties(player, player_props_elytra)
|
||||||
|
|
||||||
-- control body bone when flying
|
-- control body bone when flying
|
||||||
local body_rot = vector.new((75 - degrees(dir_to_pitch(player_velocity))), -player_vel_yaw + yaw, 0)
|
local body_rot = vector.new((75 - degrees(dir_to_pitch(player_velocity))), -player_vel_yaw + yaw, 0)
|
||||||
set_bone_pos(player, "Body_Control", nil, body_rot)
|
set_bone_pos(player, "Body_Control", nil, body_rot)
|
||||||
elseif parent then
|
elseif parent then
|
||||||
set_properties(player, player_props_riding)
|
set_properties(player, player_props_riding)
|
||||||
|
|
||||||
local parent_yaw = degrees(parent:get_yaw())
|
local parent_yaw = degrees(parent:get_yaw())
|
||||||
local head_rot = vector.new(pitch, -limit_vel_yaw(yaw, parent_yaw) + parent_yaw, 0)
|
local head_rot = vector.new(pitch, -limit_vel_yaw(yaw, parent_yaw) + parent_yaw, 0)
|
||||||
set_bone_pos(player, "Head_Control", nil, head_rot)
|
set_bone_pos(player, "Head_Control", nil, head_rot)
|
||||||
|
@ -367,10 +389,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- controls head pitch when sneaking
|
-- controls head pitch when sneaking
|
||||||
local head_rot = vector.new(pitch, player_vel_yaw - yaw, player_vel_yaw - yaw)
|
local head_rot = vector.new(pitch, player_vel_yaw - yaw, player_vel_yaw - yaw)
|
||||||
set_bone_pos(player, "Head_Control", nil, head_rot)
|
set_bone_pos(player, "Head_Control", nil, head_rot)
|
||||||
|
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties(player, player_props_sneaking)
|
set_properties(player, player_props_sneaking)
|
||||||
|
|
||||||
-- sneaking body conrols
|
-- sneaking body conrols
|
||||||
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))
|
||||||
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and is_sprinting(name) == true then
|
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and is_sprinting(name) == true then
|
||||||
|
@ -378,10 +400,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
is_swimming = true
|
is_swimming = true
|
||||||
local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 20, player_vel_yaw - yaw, 0)
|
local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 20, player_vel_yaw - yaw, 0)
|
||||||
set_bone_pos(player, "Head_Control", nil, head_rot)
|
set_bone_pos(player, "Head_Control", nil, head_rot)
|
||||||
|
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties(player, player_props_swimming)
|
set_properties(player, player_props_swimming)
|
||||||
|
|
||||||
-- control body bone when swimming
|
-- control body bone when swimming
|
||||||
local body_rot = vector.new((75 + degrees(dir_to_pitch(player_velocity))), player_vel_yaw - yaw, 180)
|
local body_rot = vector.new((75 + degrees(dir_to_pitch(player_velocity))), player_vel_yaw - yaw, 180)
|
||||||
set_bone_pos(player,"Body_Control", nil, body_rot)
|
set_bone_pos(player,"Body_Control", nil, body_rot)
|
||||||
|
@ -395,6 +417,25 @@ 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
|
||||||
|
|
||||||
|
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()
|
elytra.last_yaw = player:get_look_horizontal()
|
||||||
-- Update jump status immediately since we need this info in real time.
|
-- 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.
|
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
||||||
|
@ -639,7 +680,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
|
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
|
||||||
}
|
}
|
||||||
mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0}
|
mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0}
|
||||||
|
|
||||||
-- Minetest bug: get_bone_position() returns all zeros vectors.
|
-- Minetest bug: get_bone_position() returns all zeros vectors.
|
||||||
-- Workaround: call set_bone_position() one time first.
|
-- Workaround: call set_bone_position() one time first.
|
||||||
player:set_bone_position("Head_Control", vector.new(0, 6.75, 0))
|
player:set_bone_position("Head_Control", vector.new(0, 6.75, 0))
|
||||||
|
|
Loading…
Reference in New Issue