Adjust destination if player clicked on the downside of a node

This commit is contained in:
Wuzzy 2015-02-16 01:12:25 +01:00
parent 596c9a88c9
commit 3b5e0f56eb

View File

@ -28,6 +28,14 @@ function teletool.teleport(player, pointed_thing)
texture = "teletool_particle_departure.png",
})
minetest.sound_play( {name="teletool_teleport1", gain=1}, {pos=src, max_hear_distance=12})
-- This trick prevents the player's head to spawn in a walkable node if the player clicked on the lower side of a node
-- NOTE: This piece of code must be updated as soon the collision boxes of players become configurable
local destnode = minetest.get_node({x=dest.x, y=dest.y+1, z=dest.z})
if minetest.registered_nodes[destnode.name].walkable then
dest.y = dest.y - 1
end
player:setpos(dest)
minetest.add_particlespawner({
amount = 25,