Merge pull request 'Fixed an invalid player object crash' (#4131) from player_crash_fix into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4131
Reviewed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
This commit is contained in:
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 2024-01-11 20:00:02 +00:00
commit c1115c9cef

View file

@ -230,7 +230,10 @@ minetest.register_globalstep(function(dtime)
player_set_animation(player, "die")
elseif player:get_meta():get_int("mcl_damage:damage_animation") > 0 then
player_set_animation(player, "walk", animation_speed_mod)
local name = player:get_player_name()
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)
elseif mcl_playerplus.elytra[player] and mcl_playerplus.elytra[player].active then