From 7441f0269b199bde790606f45734949537eb9a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Wed, 17 Mar 2021 09:09:13 +0100 Subject: [PATCH] Use get_node_light for sunlight in 5.3 Avoids servers running 5.3 crashing. --- mods/ENTITIES/mcl_mobs/api.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 7d93f2bad4..3b929a119e 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1047,7 +1047,10 @@ local do_env_damage = function(self) end end - local sunlight = minetest.get_natural_light(pos, self.time_of_day) + -- Use get_node_light for Minetest version 5.3 where get_natural_light + -- does not exist yet. + local get_light = minetest.get_natural_light or minetest.get_node_light + local sunlight = get_light(pos, self.time_of_day) -- bright light harms mob if self.light_damage ~= 0 and (sunlight or 0) > 12 then