diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 360f4fe5de..f7c4305095 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -150,13 +150,6 @@ minetest.register_globalstep(function(dtime) for _,player in pairs(get_connected_players()) do - local c_x, c_y = unpack(player_collision(player)) - - if player:get_velocity().x + player:get_velocity().y < .5 and c_x + c_y > 0 then - --minetest.chat_send_player(player:get_player_name(), "pushed at " .. c_x + c_y .. " parsecs.") - player:add_velocity({x=c_x, y=0, z=c_y}) - end - --[[ _ _ _ __ _ _ __ (_)_ __ ___ __ _| |_(_) ___ _ __ ___ @@ -173,6 +166,14 @@ minetest.register_globalstep(function(dtime) local wielded = player:get_wielded_item() local player_velocity = player:get_velocity() or player:get_player_velocity() + local c_x, c_y = unpack(player_collision(player)) + + 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 + add_velocity(player, {x = c_x, y = 0, z = c_y}) + player_velocity = player:get_velocity() or player:get_player_velocity() + end + -- control head bone local pitch = - degrees(player:get_look_vertical()) local yaw = degrees(player:get_look_horizontal())