init.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. if not minetest.global_exists("stoneworld") then stoneworld = {} end
  2. stoneworld.modpath = minetest.get_modpath("stoneworld")
  3. -- These match values in the realm-control mod.
  4. -- Note: duplicated in the mapgen script, they MUST match!
  5. stoneworld.REALM_START = 5150
  6. stoneworld.REALM_END = 8150
  7. function stoneworld.on_generated(minp, maxp, blockseed)
  8. local mapgen = minetest.get_mapgen_object("gennotify")
  9. local data = (mapgen.custom and mapgen.custom["stoneworld:fortress_spawn_location"])
  10. if not data then return end
  11. minetest.after(0, function()
  12. --minetest.chat_send_all('generating fortress at ' .. minetest.pos_to_string(data.pos))
  13. fortress.generate(data.pos, "default")
  14. end)
  15. end
  16. function stoneworld.get_ground_y(pos3d)
  17. return 6500
  18. end
  19. --------------------------------------------------------------------------------
  20. if not stoneworld.registered then
  21. dofile(stoneworld.modpath .. "/nodes.lua")
  22. dofile(stoneworld.modpath .. "/ores.lua")
  23. dofile(stoneworld.modpath .. "/items.lua")
  24. minetest.set_gen_notify("custom", nil, {"stoneworld:fortress_spawn_location"})
  25. minetest.register_on_generated(function() stoneworld.on_generated() end)
  26. minetest.register_mapgen_script(stoneworld.modpath .. "/mapgen.lua")
  27. local c = "stoneworld:core"
  28. local f = stoneworld.modpath .. "/init.lua"
  29. reload.register_file(c, f, false)
  30. stoneworld.registered = true
  31. end