From 66dd87af250460665b953581943005a880aeba89 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 19 Nov 2021 02:39:32 +0100 Subject: [PATCH] Give mobs sunburn at correct light level Before this patch, the light level that makes mobs that burn in sunlight catch fire had been mistakenly specified as minetest.LIGHT_MAX or more. The correct light level for sunlight is LIGHT_SUN, which is one higher than minetest.LIGHT_MAX. Since minetest.LIGHT_MAX is the maximum light value that a node can have and torches emit light at that light level, mobs that burn in sunlight caught fire inside torch nodes. --- mods/ENTITIES/mcl_mobs/api.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6d74d9d7..cb43ce1e 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -14,6 +14,8 @@ local DEFAULT_FALL_SPEED = -10 local FLOP_HEIGHT = 5.0 local FLOP_HOR_SPEED = 1.5 +local LIGHT_SUN = minetest.LIGHT_MAX + 1 + local MOB_CAP = {} MOB_CAP.hostile = 70 MOB_CAP.passive = 10 @@ -1057,7 +1059,7 @@ local do_env_damage = function(self) if mod_worlds then _, dim = mcl_worlds.y_to_layer(pos.y) end - if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then + if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) == LIGHT_SUN and dim == "overworld" then if self.ignited_by_sunlight then mcl_burning.set_on_fire(self.object, 10) else