init.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ------------------------------------------------------------------------------
  2. -- This file is registered as reloadable.
  3. ------------------------------------------------------------------------------
  4. -- Everything in the mod lives here.
  5. --
  6. -- Note this unusual syntax: if this file is reloaded, the previous contents of
  7. -- the table are not erased. They may be overwritten. You can use this technique
  8. -- in your own mods as part of making them reloadable.
  9. reload = reload or {}
  10. reload.modpath = minetest.get_modpath("reload")
  11. dofile(reload.modpath .. "/config.lua")
  12. dofile(reload.modpath .. "/api.lua")
  13. dofile(reload.modpath .. "/chatcommands.lua")
  14. -- Allow chat messages sent by this mod to be customized.
  15. -- Usefull if you want to add coloring to the messages, etc.
  16. -- Prefer overriding this function in your own mod, instead of changing this one.
  17. -- Chat is only sent when a player uses a chatcommand.
  18. reload.chat_send_player = function(name, message)
  19. minetest.chat_send_player(name, message)
  20. end
  21. -- Allow log messages from this mod to be customized.
  22. -- Prefer overriding this function in your own mod, instead of changing this one.
  23. -- Note that log messages are only emitted when chatcommands are used.
  24. reload.log = function(level, message)
  25. minetest.log(level, message)
  26. end
  27. -- Register this mod itself as reloadable.
  28. -- This is the prototype for all registrations using this mod.
  29. -- Registrations should look something like this.
  30. if not reload.file_registered('reload:init') then
  31. reload.register_file('reload:init', reload.modpath .. '/init.lua', false)
  32. reload.register_file('reload:api', reload.modpath .. '/api.lua', false)
  33. reload.register_file('reload:chat', reload.modpath .. '/chatcommands.lua', false)
  34. reload.register_file('reload:config', reload.modpath .. '/config.lua', false)
  35. end