Merge pull request 'playerplus: fix deprecated add_player_velocity calls' (#2200) from fix-deprecated-add-vel into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2200
This commit is contained in:
cora 2022-05-13 21:51:46 +00:00
commit 88e87bccff

View file

@ -242,8 +242,7 @@ minetest.register_globalstep(function(dtime)
local c_x, c_y = unpack(player_collision(player)) local c_x, c_y = unpack(player_collision(player))
if player_velocity.x + player_velocity.y < .5 and c_x + c_y > 0 then if player_velocity.x + player_velocity.y < .5 and c_x + c_y > 0 then
local add_velocity = player.add_player_velocity or player.add_velocity player:add_velocity({x = c_x, y = 0, z = c_y})
add_velocity(player, {x = c_x, y = 0, z = c_y})
player_velocity = player:get_velocity() or player:get_player_velocity() player_velocity = player:get_velocity() or player:get_player_velocity()
end end
@ -286,8 +285,7 @@ minetest.register_globalstep(function(dtime)
if elytra.rocketing > 0 then if elytra.rocketing > 0 then
elytra.rocketing = elytra.rocketing - dtime elytra.rocketing = elytra.rocketing - dtime
if vector.length(player_velocity) < 40 then if vector.length(player_velocity) < 40 then
local add_velocity = player.add_velocity or player.add_player_velocity player:add_velocity(vector.multiply(player:get_look_dir(), 4))
add_velocity(player, vector.multiply(player:get_look_dir(), 4))
add_particle({ add_particle({
pos = fly_pos, pos = fly_pos,
velocity = {x = 0, y = 0, z = 0}, velocity = {x = 0, y = 0, z = 0},