From 8be35bae5383c633f520dae0a04f6fbdd2718f3f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Jan 2020 01:11:02 +0100 Subject: [PATCH] Make mcl_worlds dependency in mcl_mobs optional --- mods/ENTITIES/mcl_mobs/api.lua | 6 +++++- mods/ENTITIES/mcl_mobs/mod.conf | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index bef78212ea..9ca5461816 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -91,6 +91,7 @@ local mod_weather = minetest.get_modpath("mcl_weather") ~= nil local mod_tnt = minetest.get_modpath("mcl_tnt") ~= nil local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil +local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil -- play sound local mob_sound = function(self, soundname, is_opinion, fixed_pitch) @@ -705,7 +706,10 @@ local do_env_damage = function(self) if self.light_damage ~= 0 and (minetest.get_node_light(pos) or 0) > 12 then deal_light_damage(self, pos, self.light_damage) end - local _, dim = mcl_worlds.y_to_layer(pos.y) + local _, dim = nil, "overworld" + if mod_worlds then + _, dim = mcl_worlds.y_to_layer(pos.y) + end if self.sunlight_damage ~= 0 and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then deal_light_damage(self, pos, self.sunlight_damage) end diff --git a/mods/ENTITIES/mcl_mobs/mod.conf b/mods/ENTITIES/mcl_mobs/mod.conf index 13a94a2b9a..4f619b93ed 100644 --- a/mods/ENTITIES/mcl_mobs/mod.conf +++ b/mods/ENTITIES/mcl_mobs/mod.conf @@ -1,2 +1,2 @@ name = mcl_mobs -optional_depends = mcl_weather,mcl_tnt,mcl_hunger,invisibility,lucky_block,cmi,doc_identifier +optional_depends = mcl_weather, mcl_tnt, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier