From 2132cdacc529422acd9061c990c0b2bd3a5bdf80 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 3 Jun 2018 16:17:55 +0200 Subject: [PATCH] Improve minetest.after checks --- mods/ENTITIES/mcl_mobs/mount.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/mount.lua b/mods/ENTITIES/mcl_mobs/mount.lua index b12c074da7..04050eb0e6 100644 --- a/mods/ENTITIES/mcl_mobs/mount.lua +++ b/mods/ENTITIES/mcl_mobs/mount.lua @@ -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