Harden minetest.after check

This commit is contained in:
Wuzzy 2019-09-10 15:45:26 +02:00
parent 915ac2da93
commit 955638bccd
1 changed files with 4 additions and 4 deletions

View File

@ -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