Fix player fall through floor when use ender pearl

This commit is contained in:
Wuzzy 2017-05-26 15:10:35 +02:00
parent 9697232566
commit 447489f7a9
1 changed files with 2 additions and 1 deletions

View File

@ -162,6 +162,7 @@ end
local pearl_on_step = function(self, dtime) local pearl_on_step = function(self, dtime)
self.timer=self.timer+dtime self.timer=self.timer+dtime
local pos = self.object:getpos() local pos = self.object:getpos()
pos.y = math.floor(pos.y)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
@ -171,7 +172,7 @@ local pearl_on_step = function(self, dtime)
local player = minetest.get_player_by_name(self._thrower) local player = minetest.get_player_by_name(self._thrower)
if player then if player then
-- Teleport and hurt player -- Teleport and hurt player
player:setpos(pos) player:setpos({x=pos.x, y=pos.y+0.5, z=pos.z})
player:set_hp(player:get_hp() - 5) player:set_hp(player:get_hp() - 5)
end end
self.object:remove() self.object:remove()