2020-04-14 21:11:54 +02:00
|
|
|
mapgen_rivers = {}
|
2020-04-09 21:13:38 +02:00
|
|
|
|
2020-04-14 21:11:54 +02:00
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. '/'
|
2021-06-03 19:21:45 +02:00
|
|
|
mapgen_rivers.modpath = modpath
|
2021-06-03 23:30:04 +02:00
|
|
|
mapgen_rivers.world_data_path = minetest.get_worldpath() .. '/river_data/'
|
2020-04-09 21:13:38 +02:00
|
|
|
|
2020-04-14 21:11:54 +02:00
|
|
|
dofile(modpath .. 'settings.lua')
|
2022-01-25 19:09:24 +01:00
|
|
|
dofile(modpath .. 'gridmanager.lua')
|
|
|
|
dofile(modpath .. 'gridio.lua')
|
2022-01-21 14:22:22 +01:00
|
|
|
dofile(modpath .. 'polygons.lua')
|
|
|
|
dofile(modpath .. 'heightmap.lua')
|
2022-01-25 19:09:24 +01:00
|
|
|
dofile(modpath .. 'mapgen.lua')
|
2020-04-09 21:13:38 +02:00
|
|
|
|
2022-01-25 19:09:24 +01:00
|
|
|
minetest.register_on_mods_loaded(function()
|
|
|
|
local exist = mapgen_rivers.try_load_grid()
|
2022-01-03 15:47:03 +01:00
|
|
|
|
2022-01-25 19:09:24 +01:00
|
|
|
if not exist then -- If grid does not exist yet, generate it
|
|
|
|
dofile(modpath .. 'pregenerate.lua')
|
2022-01-17 23:19:17 +01:00
|
|
|
|
2022-01-25 19:09:24 +01:00
|
|
|
local grid = mapgen_rivers.generate_grid()
|
|
|
|
mapgen_rivers.write_grid(grid)
|
|
|
|
mapgen_rivers.try_load_grid(grid) -- Reload if needed
|
2022-01-17 23:19:17 +01:00
|
|
|
end
|
2021-06-25 21:05:14 +02:00
|
|
|
end)
|