From 9ae11194386aedcdeae247d4aca2350fd8f23a03 Mon Sep 17 00:00:00 2001 From: kay27 Date: Sat, 15 May 2021 03:17:16 +0400 Subject: [PATCH] [mcl_mobs] Fix server crash for mobs in unloaded areas, https://git.minetest.land/MineClone2/MineClone2/issues/1703 --- mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index eda7e8871..d75bda6c6 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -938,10 +938,13 @@ mobs.mob_step = function(self, dtime) end end - if self.burn_timer == 0 and minetest_get_node_light(pos) > 12 and minetest_get_node_light(pos, 0.5) == 15 then - mcl_burning.set_on_fire(self.object, 1) - self.burn_timer = 1 --1.7 seconds - self.pause_timer = 0.4 + if self.burn_timer == 0 then + local light_current, light_day = minetest_get_node_light(pos), minetest_get_node_light(pos, 0.5) + if light_current and light_day and light_current > 12 and light_day == 15 then + mcl_burning.set_on_fire(self.object, 1) + self.burn_timer = 1 --1.7 seconds + self.pause_timer = 0.4 + end end end