Merge remote-tracking branch 'origin/testing' into compatibility

This commit is contained in:
kay27 2022-03-15 02:06:05 +04:00
commit b095966562
1 changed files with 47 additions and 18 deletions

View File

@ -484,8 +484,8 @@ minetest.register_globalstep(function(dtime)
then then
break break
else else
-- show head slightly above water level: -- pull head slightly above water level:
head_alt_1 = head_alt_1 + (next_alt - head_alt_1) * 0.26 head_alt_1 = head_alt_1 + (next_alt - head_alt_1) * 0.5
break break
end end
end end
@ -495,7 +495,16 @@ minetest.register_globalstep(function(dtime)
if delta_y > 0 then if delta_y > 0 then
fly_pos.y = new_alt fly_pos.y = new_alt
player:set_pos(fly_pos) player:set_pos(fly_pos)
player:add_velocity({x = 0, y = -player_velocity.y / 3, z = 0}) local velocity_y = player_velocity.y
local add_velocity_y
if velocity_y > 1 then
add_velocity_y = -velocity_y/5
elseif velocity_y >= -1 then
add_velocity_y = -velocity_y/2.5
else
add_velocity_y = -velocity_y/2
end
player:add_velocity({x = 0, y = add_velocity_y, z = 0})
player_pos_for_bubble_columns[name] = fly_pos player_pos_for_bubble_columns[name] = fly_pos
else else
player_pos_for_bubble_columns[name] = nil player_pos_for_bubble_columns[name] = nil
@ -515,25 +524,45 @@ minetest.register_globalstep(function(dtime)
if stands_on == "mcl_nether:magma" then if stands_on == "mcl_nether:magma" then
fly_pos.y = math.floor(fly_pos.y) + (control.sneak and 0.51 or 0.5) fly_pos.y = math.floor(fly_pos.y) + (control.sneak and 0.51 or 0.5)
player:set_pos(fly_pos) player:set_pos(fly_pos)
player:add_velocity({x = 0, y = -player_velocity.y / 2, z = 0}) local add_velocity_y
player_pos_for_bubble_columns[name] = fly_pos local velocity_y = player_velocity.y
if velocity_y < -1 then
add_velocity_y = -velocity_y/5
elseif velocity_y <= 1 then
add_velocity_y = -velocity_y/2.5
else else
fly_pos.y = player_pos_for_bubble_columns[name].y - (whirlpool_head and time/2 or time/5) add_velocity_y = -velocity_y/2
local will_stand_on = minetest.get_node({x = fly_pos.x, y = fly_pos.y - 0.0001, z = fly_pos.z}).name end
if will_stand_on == "mcl_nether:magma" then player:add_velocity({x = 0, y = add_velocity_y, z = 0})
fly_pos.y = math.floor(fly_pos.y) + (control.sneak and 0.51 or 0.5)
player:set_pos(fly_pos)
player:add_velocity({x = 0, y = -player_velocity.y / 2, z = 0})
player_pos_for_bubble_columns[name] = fly_pos player_pos_for_bubble_columns[name] = fly_pos
elseif will_stand_on == "mcl_core:whirlpool_source" then elseif stands_on == "mcl_core:whirlpool_source" then
local estimated_pos_y = player_pos_for_bubble_columns[name].y - (whirlpool_head and time/2 or time/5)
local next_pos_y = fly_pos.y
while next_pos_y > estimated_pos_y do
next_pos_y = next_pos_y - math.min(1, next_pos_y - estimated_pos_y)
local will_stand_on = minetest.get_node({x = fly_pos.x, y = next_pos_y - 0.0001, z = fly_pos.z}).name
if will_stand_on ~= "mcl_core:whirlpool_source" then
next_pos_y = math.floor(next_pos_y - 0.0001) + (control.sneak and 0.51 or 0.5)
break
end
end
fly_pos.y = next_pos_y
player:set_pos(fly_pos) player:set_pos(fly_pos)
player:add_velocity({x = 0, y = -player_velocity.y / 2, z = 0}) local add_velocity_y
local velocity_y = player_velocity.y
if velocity_y < -1 then
add_velocity_y = -velocity_y/5
elseif velocity_y <= 1 then
add_velocity_y = -velocity_y/2.5
else
add_velocity_y = -velocity_y/2
end
player:add_velocity({x = 0, y = add_velocity_y, z = 0})
player_pos_for_bubble_columns[name] = fly_pos player_pos_for_bubble_columns[name] = fly_pos
else else
player_pos_for_bubble_columns[name] = nil player_pos_for_bubble_columns[name] = nil
end end
end end
end
elseif player_pos_for_bubble_columns[name] then elseif player_pos_for_bubble_columns[name] then
player_pos_for_bubble_columns[name] = nil player_pos_for_bubble_columns[name] = nil
end end