only load interface_mobs_api.lua if mobs_redo is available

This commit is contained in:
Sokomine 2023-07-08 05:12:27 +02:00
parent 491675ad09
commit 006c7f24bb

View File

@ -9,6 +9,14 @@ function yl_speak_up.init_mob_table()
return false
end
-- this only makes sense if mobs_redo exists and is loaded
if(not(minetest.get_modpath("mobs"))
or not(minetest.global_exists("mobs"))
or not(mobs.mob_class)) then
minetest.log("action","[MOD] yl_speak_up Info: mobs_redo mod not found. Not loading interface.")
return
end
-- React to right-clicking a mobs_redo mob:
-- * capture the mob with a lasso or net (if appropriate)
@ -103,6 +111,8 @@ function yl_speak_up.mobs_after_activate(self, staticdata, def, dtime)
end
-- we need to override this function from mobs_redo mod so that color
-- changes to the name tag color are possible
yl_speak_up.orig_mobs_update_tag = mobs.mob_class.update_tag
-- update nametag and infotext
mobs.mob_class.update_tag = function(self)