forked from your-land-mirror/yl_speak_up
added npc_talk_reload command
This commit is contained in:
parent
d23335e6db
commit
ab9745ee01
184
init.lua
184
init.lua
@ -29,84 +29,104 @@ yl_speak_up.fs_version = {}
|
|||||||
yl_speak_up.custom_server_functions = {}
|
yl_speak_up.custom_server_functions = {}
|
||||||
|
|
||||||
|
|
||||||
-- the server-specific configuration
|
-- the functions in here can be reloaded without restarting the server
|
||||||
dofile(modpath .. "config.lua")
|
-- log_entry: what to write in the logfile
|
||||||
-- logging and showing the log
|
yl_speak_up.reload = function(modpath, log_entry)
|
||||||
dofile(modpath .. "fs_show_log.lua")
|
-- the server-specific configuration
|
||||||
-- players *and* npc need privs for certain things; this here handles the NPC side of things
|
dofile(modpath .. "config.lua")
|
||||||
dofile(modpath .. "npc_privs.lua")
|
-- logging and showing the log
|
||||||
-- add generic dialogs
|
dofile(modpath .. "fs_show_log.lua")
|
||||||
dofile(modpath .. "add_generic_dialogs.lua")
|
-- players *and* npc need privs for certain things; this here handles the NPC side of things
|
||||||
-- handle on_player_receive_fields and showing of formspecs
|
dofile(modpath .. "npc_privs.lua")
|
||||||
dofile(modpath .. "show_fs.lua")
|
-- add generic dialogs
|
||||||
-- general decoration part for main formspec, trade window etc.
|
dofile(modpath .. "add_generic_dialogs.lua")
|
||||||
dofile(modpath .. "fs_decorated.lua")
|
-- handle on_player_receive_fields and showing of formspecs
|
||||||
-- the formspec and input handling for the main dialog
|
dofile(modpath .. "show_fs.lua")
|
||||||
dofile(modpath .. "fs_talkdialog.lua")
|
-- general decoration part for main formspec, trade window etc.
|
||||||
-- ask if the player wants to save, discard or go back in edit mode
|
dofile(modpath .. "fs_decorated.lua")
|
||||||
dofile(modpath .. "fs_save_or_discard_or_back.lua")
|
-- the formspec and input handling for the main dialog
|
||||||
-- the player wants to change something regarding the dialog
|
dofile(modpath .. "fs_talkdialog.lua")
|
||||||
dofile(modpath .. "edit_mode_apply_changes.lua")
|
-- ask if the player wants to save, discard or go back in edit mode
|
||||||
-- as the name says: a collection of custom functions that you can
|
dofile(modpath .. "fs_save_or_discard_or_back.lua")
|
||||||
-- override on your server or in your game to suit your needs;
|
-- the player wants to change something regarding the dialog
|
||||||
-- Note: No special privs are needed to call custom functions. But...
|
dofile(modpath .. "edit_mode_apply_changes.lua")
|
||||||
-- of course you can change them only if you have access to
|
-- as the name says: a collection of custom functions that you can
|
||||||
-- the server's file system or can execute lua code.
|
-- override on your server or in your game to suit your needs;
|
||||||
dofile(modpath .. "custom_functions_you_can_override.lua")
|
-- Note: No special privs are needed to call custom functions. But...
|
||||||
-- execute preconditions, actions and effects
|
-- of course you can change them only if you have access to
|
||||||
dofile(modpath .. "exec_eval_preconditions.lua")
|
-- the server's file system or can execute lua code.
|
||||||
dofile(modpath .. "exec_actions.lua")
|
dofile(modpath .. "custom_functions_you_can_override.lua")
|
||||||
dofile(modpath .. "exec_apply_effects.lua")
|
-- execute preconditions, actions and effects
|
||||||
-- some helper functions for formatting text for a formspec talbe
|
dofile(modpath .. "exec_eval_preconditions.lua")
|
||||||
dofile(modpath .. "print_as_table.lua")
|
dofile(modpath .. "exec_actions.lua")
|
||||||
-- create i.e. a dropdown list of player names
|
dofile(modpath .. "exec_apply_effects.lua")
|
||||||
dofile(modpath .. "formspec_helpers.lua")
|
-- some helper functions for formatting text for a formspec talbe
|
||||||
-- handle alternate text for dialogs
|
dofile(modpath .. "print_as_table.lua")
|
||||||
dofile(modpath .. "fs_alternate_text.lua")
|
-- create i.e. a dropdown list of player names
|
||||||
-- debugging - extended information about what (your own) NPC does
|
dofile(modpath .. "formspec_helpers.lua")
|
||||||
dofile(modpath .. "npc_talk_debug.lua")
|
-- handle alternate text for dialogs
|
||||||
-- execute lua code directly (preconditions and effects) - requires priv
|
dofile(modpath .. "fs_alternate_text.lua")
|
||||||
dofile(modpath .. "eval_and_execute_function.lua")
|
-- debugging - extended information about what (your own) NPC does
|
||||||
-- common functions for editing preconditions and effects
|
dofile(modpath .. "npc_talk_debug.lua")
|
||||||
dofile(modpath .. "fs_edit_general.lua")
|
-- execute lua code directly (preconditions and effects) - requires priv
|
||||||
-- edit preconditions (can be reached through edit options dialog)
|
dofile(modpath .. "eval_and_execute_function.lua")
|
||||||
dofile(modpath .. "fs_edit_preconditions.lua")
|
-- common functions for editing preconditions and effects
|
||||||
-- edit actions (can be reached through edit options dialog)
|
dofile(modpath .. "fs_edit_general.lua")
|
||||||
dofile(modpath .. "fs_edit_actions.lua")
|
-- edit preconditions (can be reached through edit options dialog)
|
||||||
-- edit effects (can be reached through edit options dialog)
|
dofile(modpath .. "fs_edit_preconditions.lua")
|
||||||
dofile(modpath .. "fs_edit_effects.lua")
|
-- edit actions (can be reached through edit options dialog)
|
||||||
-- edit options dialog (detailed configuration of options in edit mode)
|
dofile(modpath .. "fs_edit_actions.lua")
|
||||||
dofile(modpath .. "fs_edit_options_dialog.lua")
|
-- edit effects (can be reached through edit options dialog)
|
||||||
-- set name, description and owner (owner only with npc_talk_master priv)
|
dofile(modpath .. "fs_edit_effects.lua")
|
||||||
dofile(modpath .. "fs_initial_config.lua")
|
-- edit options dialog (detailed configuration of options in edit mode)
|
||||||
-- inspect and accept items the player gave to the NPC
|
dofile(modpath .. "fs_edit_options_dialog.lua")
|
||||||
dofile(modpath .. "fs_player_offers_item.lua")
|
-- set name, description and owner (owner only with npc_talk_master priv)
|
||||||
-- inventory management, trading and handling of quest items:
|
dofile(modpath .. "fs_initial_config.lua")
|
||||||
dofile(modpath .. "inventory.lua")
|
-- inspect and accept items the player gave to the NPC
|
||||||
-- limit how much the NPC shall buy and sell
|
dofile(modpath .. "fs_player_offers_item.lua")
|
||||||
dofile(modpath .. "fs_trade_limit.lua")
|
-- inventory management, trading and handling of quest items:
|
||||||
dofile(modpath .. "fs_edit_trade_limit.lua")
|
dofile(modpath .. "inventory.lua")
|
||||||
-- trade one item(stack) against one other item(stack)
|
-- limit how much the NPC shall buy and sell
|
||||||
dofile(modpath .. "trade_simple.lua")
|
dofile(modpath .. "fs_trade_limit.lua")
|
||||||
-- just click on a button to buy items from the trade list
|
dofile(modpath .. "fs_edit_trade_limit.lua")
|
||||||
dofile(modpath .. "fs_trade_via_buy_button.lua")
|
-- trade one item(stack) against one other item(stack)
|
||||||
-- easily accessible list of all trades the NPC offers
|
dofile(modpath .. "trade_simple.lua")
|
||||||
dofile(modpath .. "fs_trade_list.lua")
|
-- just click on a button to buy items from the trade list
|
||||||
-- as the name says: list which npc acesses a variable how and in which context
|
dofile(modpath .. "fs_trade_via_buy_button.lua")
|
||||||
dofile(modpath .. "fs_get_list_of_usage_of_variable.lua")
|
-- easily accessible list of all trades the NPC offers
|
||||||
-- show which values are stored for which player in a quest variable
|
dofile(modpath .. "fs_trade_list.lua")
|
||||||
dofile(modpath .. "fs_show_all_var_values.lua")
|
-- as the name says: list which npc acesses a variable how and in which context
|
||||||
-- manage quest variables: add, delete, manage access rights etc.
|
dofile(modpath .. "fs_get_list_of_usage_of_variable.lua")
|
||||||
dofile(modpath .. "fs_manage_variables.lua")
|
-- show which values are stored for which player in a quest variable
|
||||||
-- handle variables for quests for player-owned NPC
|
dofile(modpath .. "fs_show_all_var_values.lua")
|
||||||
dofile(modpath .. "quest_api.lua")
|
-- manage quest variables: add, delete, manage access rights etc.
|
||||||
-- setting skin, wielded item etc.
|
dofile(modpath .. "fs_manage_variables.lua")
|
||||||
dofile(modpath .. "fs_fashion.lua")
|
-- handle variables for quests for player-owned NPC
|
||||||
-- properties for NPC without specific dialogs that want to make use of
|
dofile(modpath .. "quest_api.lua")
|
||||||
-- some generic dialogs
|
-- setting skin, wielded item etc.
|
||||||
dofile(modpath .. "fs_properties.lua")
|
dofile(modpath .. "fs_fashion.lua")
|
||||||
-- the main functionality of the mod
|
-- properties for NPC without specific dialogs that want to make use of
|
||||||
dofile(modpath .. "functions.lua")
|
-- some generic dialogs
|
||||||
|
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)
|
-- the staffs (requires npc_master priv)
|
||||||
if(yl_speak_up.enable_staff_based_editing) then
|
if(yl_speak_up.enable_staff_based_editing) then
|
||||||
-- editing the npc with the staff:
|
-- editing the npc with the staff:
|
||||||
@ -121,7 +141,10 @@ if(yl_speak_up.enable_yl_mobs) then
|
|||||||
-- the actual mobs, using mobs_redo
|
-- the actual mobs, using mobs_redo
|
||||||
dofile(modpath .. "mobs.lua")
|
dofile(modpath .. "mobs.lua")
|
||||||
end
|
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")
|
dofile(modpath .. "register_once.lua")
|
||||||
|
|
||||||
minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.path)
|
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 {}
|
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")
|
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
|
-- some node positions can be set by punching a node
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user