init.lua 2.3 KB

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