From 955638bccd53528d03ea63c214e1ebc965f8e0e2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 10 Sep 2019 15:45:26 +0200 Subject: [PATCH] Harden minetest.after check --- mods/ENTITIES/mcl_mobs/api.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b3e87178ba..912cfaf833 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -453,14 +453,14 @@ local check_for_death = function(self, cause, cmi_cause) self.health = self.hp_max end - -- play damage sound if health was reduced and make mob flash red. + -- play damage sound if health was reduced and make mob flash red. if damaged then self.object:set_texture_mod("^[colorize:#FF000040") - minetest.after(.2, function() - if self then + minetest.after(.2, function(self) + if self and self.object then self.object:set_texture_mod("") end - end) + end, self) mob_sound(self, self.sounds.damage) end