diff --git a/jumpdrive/common.lua b/jumpdrive/common.lua index 2638c71..1eb44ba 100644 --- a/jumpdrive/common.lua +++ b/jumpdrive/common.lua @@ -36,6 +36,11 @@ jumpdrive.simulate_jump = function(pos, player, show_marker) return false, "Error: mapgen was active in this area, please try again later for your own safety!" end + + if player:get_physics_override().gravity == 0 then + return false, "Error: jump is not finished!" + end + local meta = minetest.get_meta(pos) local radius = jumpdrive.get_radius(pos) local distance = vector.distance(pos, targetPos) diff --git a/jumpdrive/move.lua b/jumpdrive/move.lua index 63643b4..f773133 100644 --- a/jumpdrive/move.lua +++ b/jumpdrive/move.lua @@ -107,10 +107,13 @@ jumpdrive.move = function(source_pos1, source_pos2, target_pos1, target_pos2) if xMatch and yMatch and zMatch and player:is_player() then minetest.log("action", "[jumpdrive] moving player: " .. player:get_player_name()) local new_player_pos = vector.add(playerPos, delta_vector) - player:set_pos( new_player_pos ); local op = player:get_physics_override() player:set_physics_override({speed = 0, gravity = 0, jump = 0}) - minetest.after(3, function(o) player:set_physics_override({gravity = o.gravity, jump = o.jump, speed = o.speed}) end, op) + player:set_pos( new_player_pos ); + minetest.after(3, function(o, pos) + player:set_physics_override({gravity = o.gravity, jump = o.jump, speed = o.speed}) + player:set_pos( pos ); + end, op, new_player_pos) end end