Adjust destination if player clicked on the downside of a node
This commit is contained in:
parent
596c9a88c9
commit
3b5e0f56eb
8
init.lua
8
init.lua
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user