init.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- real lanterns?
  2. -- 2023-01-17 Adding medium light level.
  3. if not minetest.global_exists("lantern") then
  4. lantern = {}
  5. lantern.author = "boxface"
  6. lantern.version = 0.1
  7. lantern.date = "2022-07-07"
  8. lantern.modname = minetest.get_current_modname()
  9. lantern.modpath = minetest.get_modpath(lantern.modname)
  10. -- load register.lua only the first time
  11. dofile(lantern.modpath .. "/register.lua")
  12. else
  13. if not lantern.author == "boxface" then
  14. local err = "[lantern] another mod registered my global variable"
  15. minetest.log("error", err)
  16. return false
  17. end
  18. end
  19. -- load other files
  20. dofile(lantern.modpath .. "/lantern.lua")
  21. function lantern.chat_debug(pname, message)
  22. if not debug then
  23. return
  24. end
  25. local msg = minetest.colorize("gold", message)
  26. minetest.chat_send_player(pname, msg)
  27. end
  28. if not lantern.registered then
  29. lantern.register()
  30. lantern.fix()
  31. lantern.registered = true
  32. end
  33. -- check for musttest_game reload mod
  34. if minetest.get_modpath("reload") and not lantern.runonce then
  35. reload.register_file("lantern:init", lantern.modpath .. "/init.lua", false)
  36. reload.register_file("lantern:lantern", lantern.modpath ..
  37. "/lantern.lua", false)
  38. lantern.runonce = true
  39. end