Improve minetest.after checks
This commit is contained in:
parent
201c2bf170
commit
2132cdacc5
|
@ -151,11 +151,12 @@ function mobs.attach(entity, player)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.after(0.2, function(player)
|
minetest.after(0.2, function(name)
|
||||||
if player:is_player() then
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if player then
|
||||||
mcl_player.player_set_animation(player, "sit" , 30)
|
mcl_player.player_set_animation(player, "sit" , 30)
|
||||||
end
|
end
|
||||||
end, player)
|
end, player:get_player_name())
|
||||||
|
|
||||||
player:set_look_horizontal(entity.object:get_yaw() - rot_view)
|
player:set_look_horizontal(entity.object:get_yaw() - rot_view)
|
||||||
end
|
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}
|
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)
|
minetest.after(0.1, function(name, pos)
|
||||||
if player:is_player() then
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if player then
|
||||||
player:set_pos(pos)
|
player:set_pos(pos)
|
||||||
end
|
end
|
||||||
end, player, pos)
|
end, player:get_player_name(), pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue