init.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. serveressentials = serveressentials or {}
  2. serveressentials.modpath = minetest.get_modpath("serveressentials")
  3. -- Outback's reset timeout in realtime days.
  4. serveressentials.reset_timeout = 30
  5. -- Can be gotten once only, at load time.
  6. if not serveressentials.modstorage then
  7. serveressentials.modstorage = minetest.get_mod_storage()
  8. end
  9. dofile(serveressentials.modpath .. "/outback.lua")
  10. dofile(serveressentials.modpath .. "/rebuild.lua")
  11. dofile(serveressentials.modpath .. "/acacia.lua")
  12. dofile(serveressentials.modpath .. "/utility.lua")
  13. dofile(serveressentials.modpath .. "/whereis.lua")
  14. dofile(serveressentials.modpath .. "/teleport.lua")
  15. if not serveressentials.registered then
  16. -- Overriding the teleport chat-command is necessary in order to let admins
  17. -- use realm-relative coordinates. It also prevents admins from accidentally
  18. -- teleporting into "unallocated" parts of the world, which can damage* the
  19. -- map and possibly require use of WorldEdit to fix.
  20. --
  21. -- *I.e. cause to be generated chunks that shouldn't be generated, which can
  22. -- cause a cascade of lighting issues that ruin any terrain below. Note that
  23. -- this works in concert with the 'rc' (RealmControl) code.
  24. assert(minetest.registered_chatcommands["teleport"])
  25. minetest.override_chatcommand("teleport", {
  26. func = function(name, param)
  27. wield3d.on_teleport()
  28. local result, str = serveressentials.do_teleport(name, param)
  29. minetest.chat_send_player(name, "# Server: " .. str)
  30. end,
  31. })
  32. minetest.register_privilege("whereis", {
  33. description = "Player may use the /whereis command to locate other players.",
  34. give_to_singleplayer = false,
  35. })
  36. minetest.register_chatcommand("whereis", {
  37. params = "[<player>]",
  38. description = "Locate a player or the caller.",
  39. privs = {whereis=true},
  40. func = function(...)
  41. return serveressentials.whereis(...)
  42. end
  43. })
  44. local c = "serveressentials:core"
  45. local f = serveressentials.modpath .. "/init.lua"
  46. reload.register_file(c, f, false)
  47. dofile(serveressentials.modpath .. "/defenestrate.lua")
  48. serveressentials.registered = true
  49. end