mirror of
https://gitlab.com/gaelysam/mapgen_rivers.git
synced 2024-12-28 20:00:41 +01:00
25 lines
773 B
Lua
25 lines
773 B
Lua
-- Main file, calls the other files and triggers main functions
|
|
|
|
mapgen_rivers = {}
|
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. '/'
|
|
mapgen_rivers.modpath = modpath
|
|
mapgen_rivers.world_data_path = minetest.get_worldpath() .. '/river_data/'
|
|
|
|
dofile(modpath .. 'settings.lua')
|
|
dofile(modpath .. 'gridmanager.lua')
|
|
dofile(modpath .. 'gridio.lua')
|
|
dofile(modpath .. 'polygons.lua')
|
|
dofile(modpath .. 'heightmap.lua')
|
|
dofile(modpath .. 'mapgen.lua')
|
|
|
|
minetest.register_on_mods_loaded(function()
|
|
local exist = mapgen_rivers.try_load_grid()
|
|
|
|
if not exist then -- If grid does not exist yet, generate it
|
|
local grid = dofile(modpath .. 'pregenerate.lua')
|
|
mapgen_rivers.write_grid(grid)
|
|
mapgen_rivers.try_load_grid() -- Reload if needed
|
|
end
|
|
end)
|