forked from your-land-mirror/yl_speak_up
added npc_talk_reload command
This commit is contained in:
parent
d23335e6db
commit
ab9745ee01
28
init.lua
28
init.lua
@ -29,6 +29,9 @@ yl_speak_up.fs_version = {}
|
||||
yl_speak_up.custom_server_functions = {}
|
||||
|
||||
|
||||
-- the functions in here can be reloaded without restarting the server
|
||||
-- log_entry: what to write in the logfile
|
||||
yl_speak_up.reload = function(modpath, log_entry)
|
||||
-- the server-specific configuration
|
||||
dofile(modpath .. "config.lua")
|
||||
-- logging and showing the log
|
||||
@ -107,6 +110,23 @@ dofile(modpath .. "fs_fashion.lua")
|
||||
dofile(modpath .. "fs_properties.lua")
|
||||
-- the main functionality of the mod
|
||||
dofile(modpath .. "functions.lua")
|
||||
|
||||
-- initialize and load all registered generic dialogs
|
||||
yl_speak_up.load_generic_dialogs()
|
||||
|
||||
if(log_entry) then
|
||||
minetest.log("action","[MOD] yl_speak_up "..tostring(log_entry))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- load all those files that can also be reloaded without a server restart
|
||||
-- load here for the first time:
|
||||
yl_speak_up.reload(modpath, "loaded re-loadable part for the first time")
|
||||
|
||||
-- these functions here mostly cannot be reloaded without a server restart
|
||||
-- because they register tools and entities
|
||||
--
|
||||
-- the staffs (requires npc_master priv)
|
||||
if(yl_speak_up.enable_staff_based_editing) then
|
||||
-- editing the npc with the staff:
|
||||
@ -121,7 +141,10 @@ if(yl_speak_up.enable_yl_mobs) then
|
||||
-- the actual mobs, using mobs_redo
|
||||
dofile(modpath .. "mobs.lua")
|
||||
end
|
||||
--dofile(modpath .. "debug.lua")
|
||||
|
||||
-- register all the necessary things; this ought to be done only once
|
||||
-- (although most might work without a server restart as well; but we
|
||||
-- better want to be on the safe side here)
|
||||
dofile(modpath .. "register_once.lua")
|
||||
|
||||
minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.path)
|
||||
@ -131,8 +154,5 @@ minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.log_path)
|
||||
|
||||
yl_speak_up.mob_table = yl_speak_up.init_mob_table() or {}
|
||||
|
||||
-- initialize and load all registered generic dialogs
|
||||
yl_speak_up.load_generic_dialogs()
|
||||
|
||||
minetest.log("action","[MOD] yl_speak_up loaded")
|
||||
|
||||
|
@ -136,6 +136,20 @@ minetest.register_chatcommand( 'npc_talk_style', {
|
||||
})
|
||||
|
||||
|
||||
-- most of the files of this mod can be reloaded without the server having to
|
||||
-- be restarted;
|
||||
-- handled in init.lua
|
||||
minetest.register_chatcommand( 'npc_talk_reload', {
|
||||
description = "Reloads most of the files of this mod so that you can update their code "..
|
||||
"without having to restart the server. Requires the privs priv.",
|
||||
privs = {privs = true},
|
||||
func = function(pname, param)
|
||||
minetest.chat_send_player(pname, "Reloading most files from mod yl_speak_up...")
|
||||
yl_speak_up.reload(yl_speak_up.modpath, "reloaded by "..tostring(pname))
|
||||
minetest.chat_send_player(pname, "Reloaded successfully.")
|
||||
end
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- some node positions can be set by punching a node
|
||||
-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user