inform other mods when npc_talk_reload is issued

This commit is contained in:
Sokomine 2022-10-15 18:08:47 +02:00
parent 2460714a6b
commit e7e097ea20

View File

@ -1,5 +1,10 @@
yl_speak_up = {}
-- some mods (i.e. yl_speak_up_addons) need to be called again when
-- this mod is reloaded via chat command "/npc_talk_reload";
-- this is a list of such functions
yl_speak_up.inform_when_reloaded = {}
local modpath = minetest.get_modpath("yl_speak_up")..DIR_DELIM
yl_speak_up.worldpath = minetest.get_worldpath()..DIR_DELIM
yl_speak_up.modpath = modpath
@ -122,6 +127,11 @@ yl_speak_up.reload = function(modpath, log_entry)
if(log_entry) then
minetest.log("action","[MOD] yl_speak_up "..tostring(log_entry))
end
-- reload all mods that may have to add something as well
for i, f in ipairs(yl_speak_up.inform_when_reloaded) do
f()
end
end
-- register all the necessary things; this ought to be done only once