From 7bfbaac7720aa1b652e85d9291497a28a3af1efa Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Sun, 4 Feb 2024 17:31:11 +0000 Subject: [PATCH] Fix damage animation and player invul crash in mcl_playerplus (#4176) Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4176 Reviewed-by: the-real-herowl Co-authored-by: Eliy21 Co-committed-by: Eliy21 --- mods/PLAYER/mcl_playerplus/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 8343290bf..646030202 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -749,6 +749,8 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, if time_diff <= 500000 and time_diff >= 0 then player:get_meta():set_int("mcl_damage:invulnerable", 1) minetest.after(0.5, function() + local player = minetest.get_player_by_name(name) + if not player then return end player:get_meta():set_int("mcl_damage:invulnerable", 0) end) damage = damage - mcl_playerplus_internal[name].last_damage @@ -761,6 +763,8 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, mcl_playerplus_internal[name].invul_timestamp = time_now player:get_meta():set_int("mcl_damage:damage_animation", 1) minetest.after(0.5, function() + local player = minetest.get_player_by_name(name) + if not player then return end player:get_meta():set_int("mcl_damage:damage_animation", 0) end) end