added register_on_reload; made interface_mobs_api.lua work again for mobs.lua
This commit is contained in:
parent
0a7a06e050
commit
f1072821f1
29
init.lua
29
init.lua
@ -5,6 +5,19 @@ yl_speak_up = {}
|
||||
-- this is a list of such functions
|
||||
yl_speak_up.inform_when_reloaded = {}
|
||||
|
||||
yl_speak_up.register_on_reload = function(fun, desc)
|
||||
-- avoid double entries
|
||||
for i, f in ipairs(yl_speak_up.inform_when_reloaded) do
|
||||
if(f == fun) then
|
||||
return
|
||||
end
|
||||
end
|
||||
table.insert(yl_speak_up.inform_when_reloaded, fun)
|
||||
minetest.log("action","[MOD] yl_speak_up Will execute function \""..tostring(desc)..
|
||||
"\" on reload.")
|
||||
end
|
||||
|
||||
|
||||
local modpath = minetest.get_modpath("yl_speak_up")..DIR_DELIM
|
||||
yl_speak_up.worldpath = minetest.get_worldpath()..DIR_DELIM
|
||||
yl_speak_up.modpath = modpath
|
||||
@ -41,6 +54,22 @@ yl_speak_up.custom_server_functions = {}
|
||||
-- may store a table of registered mobs in the future; currently not really used
|
||||
yl_speak_up.mob_table = {}
|
||||
|
||||
-- the real implementation happens in interface_mobs_api.lua
|
||||
-- mobs.lua may need this at an earlier point
|
||||
yl_speak_up.mobs_on_rightclick = function(self, clicker)
|
||||
if(not(yl_speak_up.do_mobs_on_rightclick)) then
|
||||
return false
|
||||
end
|
||||
return yl_speak_up.do_mobs_on_rightclick(self, clicker)
|
||||
end
|
||||
|
||||
yl_speak_up.mobs_after_activate = function(self, staticdata, def, dtime)
|
||||
if(not(yl_speak_up.do_mobs_after_activate)) then
|
||||
return false
|
||||
end
|
||||
return yl_speak_up.do_mobs_after_activate(self, staticdata, def, dtime)
|
||||
end
|
||||
|
||||
-- Some files may or may not exist on the server - they contain adjustments
|
||||
-- local to the server.
|
||||
-- Here you can override what you need for YOUR SERVER.
|
||||
|
@ -27,7 +27,7 @@ end
|
||||
-- * if none of the above applies: actually talk to the mob
|
||||
-- This is so often needed (but also mobs_redo specific!) that we provide
|
||||
-- an extra easy-to-call function here.
|
||||
function yl_speak_up.mobs_on_rightclick(self, clicker)
|
||||
function yl_speak_up.do_mobs_on_rightclick(self, clicker)
|
||||
--local item = clicker:get_wielded_item()
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
@ -51,7 +51,7 @@ function yl_speak_up.mobs_on_rightclick(self, clicker)
|
||||
end
|
||||
|
||||
|
||||
function yl_speak_up.mobs_after_activate(self, staticdata, def, dtime)
|
||||
function yl_speak_up.do_mobs_after_activate(self, staticdata, def, dtime)
|
||||
-- this scrolls far too much
|
||||
-- yl_speak_up.log_change("-", "n_"..self.yl_speak_up.id,
|
||||
-- "activated at "..minetest.pos_to_string(self.object:get_pos()), "action")
|
||||
|
@ -3,9 +3,6 @@
|
||||
-- Else ignore this file.
|
||||
--
|
||||
|
||||
-- do all the things that have to be done when yl_speak_up is initialized or reloaded
|
||||
yl_npc.add_textures()
|
||||
|
||||
-- Tribe Miocene (Obsidian Flans)
|
||||
yl_speak_up.mesh_data["zmobs_lava_flan.x"] = { texture_index = 1, }
|
||||
yl_speak_up.mob_skins["yl_events:tribe_miocene"] = {"mobs_obsidian_flan.png"}
|
||||
|
Loading…
Reference in New Issue
Block a user