set yl_speak_up.orig_mobs_update_tag only *once*

This commit is contained in:
Sokomine 2023-07-22 20:49:37 +02:00
parent d5cfe54938
commit 336c02694c
2 changed files with 5 additions and 2 deletions

View File

@ -233,7 +233,7 @@ yl_speak_up.reload = function(modpath, log_entry)
-- some general functions that are useful for mobs_redo
-- (react to right-click, nametag color etc.)
-- only gets loaded if mobs_redo (mobs) exists as mod
dofile(yl_speak_up.modpath .. "interface_mobs_api.lua")
dofile(modpath .. "interface_mobs_api.lua")
-- initialize and load all registered generic dialogs
yl_speak_up.load_generic_dialogs()

View File

@ -92,7 +92,10 @@ 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
-- BUT: Only do this once. NOT at each reset!
if(not(yl_speak_up.orig_mobs_update_tag)) then
yl_speak_up.orig_mobs_update_tag = mobs.mob_class.update_tag
end
-- update nametag and infotext
mobs.mob_class.update_tag = function(self)