mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Improve minetest.after checks
This commit is contained in:
parent
201c2bf170
commit
2132cdacc5
1 changed files with 8 additions and 6 deletions
|
@ -151,11 +151,12 @@ function mobs.attach(entity, player)
|
|||
}
|
||||
})
|
||||
|
||||
minetest.after(0.2, function(player)
|
||||
if player:is_player() then
|
||||
minetest.after(0.2, function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
mcl_player.player_set_animation(player, "sit" , 30)
|
||||
end
|
||||
end, player)
|
||||
end, player:get_player_name())
|
||||
|
||||
player:set_look_horizontal(entity.object:get_yaw() - rot_view)
|
||||
end
|
||||
|
@ -171,11 +172,12 @@ function mobs.detach(player, offset)
|
|||
|
||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||
|
||||
minetest.after(0.1, function(player, pos)
|
||||
if player:is_player() then
|
||||
minetest.after(0.1, function(name, pos)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
player:set_pos(pos)
|
||||
end
|
||||
end, player, pos)
|
||||
end, player:get_player_name(), pos)
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue