jumpdrive: fix player position after jump

This commit is contained in:
Sergei Mozhaisky 2019-12-03 08:36:13 +00:00
parent d423583859
commit da2a054a4c
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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