init.lua 718 B

1234567891011121314151617181920212223242526
  1. static_spawnpoint = static_spawnpoint or {}
  2. static_spawnpoint.modpath = minetest.get_modpath("static_spawnpoint")
  3. -- Note: builtin includes this functionality, so we have to override it somehow.
  4. local spawn = {x=-9223, y=4169, z=5861}
  5. function static_spawnpoint.put_player_in_spawn(pref)
  6. pref:set_pos(spawn)
  7. return true
  8. end
  9. if not static_spawnpoint.registered then
  10. -- This depends on us being called *after* the builtin function is called!
  11. minetest.register_on_newplayer(function(...)
  12. return static_spawnpoint.put_player_in_spawn(...)
  13. end)
  14. local c = "static_spawnpoint:core"
  15. local f = static_spawnpoint.modpath .. "/init.lua"
  16. reload.register_file(c, f, false)
  17. static_spawnpoint.registered = true
  18. end