mirror of
https://gitlab.com/gaelysam/mapgen_rivers.git
synced 2024-12-29 12:20:41 +01:00
Globalize modpath and worldpath
This commit is contained in:
parent
0427b42d17
commit
19efeaaff6
@ -1,4 +1,4 @@
|
|||||||
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. '/'
|
local modpath = mapgen_rivers.modpath
|
||||||
|
|
||||||
local make_polygons = dofile(modpath .. 'polygons.lua')
|
local make_polygons = dofile(modpath .. 'polygons.lua')
|
||||||
local transform_quadri = dofile(modpath .. 'geometry.lua')
|
local transform_quadri = dofile(modpath .. 'geometry.lua')
|
||||||
|
2
init.lua
2
init.lua
@ -1,6 +1,8 @@
|
|||||||
mapgen_rivers = {}
|
mapgen_rivers = {}
|
||||||
|
|
||||||
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. '/'
|
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 .. 'settings.lua')
|
||||||
|
|
||||||
|
2
load.lua
2
load.lua
@ -1,4 +1,4 @@
|
|||||||
local worldpath = minetest.get_worldpath() .. "/river_data/"
|
local worldpath = minetest.world_data_path
|
||||||
|
|
||||||
local function load_map(filename, bytes, signed, size)
|
local function load_map(filename, bytes, signed, size)
|
||||||
local file = io.open(worldpath .. filename, 'rb')
|
local file = io.open(worldpath .. filename, 'rb')
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. '/'
|
local modpath = mapgen_rivers.modpath
|
||||||
local mod_data_path = modpath .. 'river_data/'
|
local mod_data_path = modpath .. 'river_data/'
|
||||||
if not io.open(mod_data_path .. 'size', 'r') then
|
if not io.open(mod_data_path .. 'size', 'r') then
|
||||||
mod_data_path = modpath .. 'demo_data/'
|
mod_data_path = modpath .. 'demo_data/'
|
||||||
end
|
end
|
||||||
|
|
||||||
local world_data_path = minetest.get_worldpath() .. '/river_data/'
|
local world_data_path = minetest.world_data_path
|
||||||
minetest.mkdir(world_data_path)
|
minetest.mkdir(world_data_path)
|
||||||
|
|
||||||
local load_map = dofile(modpath .. 'load.lua')
|
local load_map = dofile(modpath .. 'load.lua')
|
||||||
|
@ -108,15 +108,18 @@ local function diffuse(model, time)
|
|||||||
-- TODO Test this
|
-- TODO Test this
|
||||||
end
|
end
|
||||||
|
|
||||||
local rivermapper, gaussian
|
local modpath = ""
|
||||||
if minetest then
|
if minetest then
|
||||||
rivermapper = dofile(minetest.get_modpath(minetest.get_current_modname()) .. '/terrainlib_lua/rivermapper.lua')
|
if minetest.global_exists(mapgen_rivers) then
|
||||||
gaussian = dofile(minetest.get_modpath(minetest.get_current_modname()) .. '/terrainlib_lua/gaussian.lua')
|
modpath = mapgen_rivers.modpath .. "terrainlib_lua/"
|
||||||
else
|
else
|
||||||
rivermapper = dofile('rivermapper.lua')
|
modpath = minetest.get_modpath(minetest.get_current_modname()) .. "terrainlib_lua/"
|
||||||
gaussian = dofile('gaussian.lua')
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local rivermapper = dofile(modpath .. "rivermapper.lua")
|
||||||
|
local gaussian = dofile(modpath .. "gaussian.lua")
|
||||||
|
|
||||||
local function flow(model)
|
local function flow(model)
|
||||||
model.dirs, model.lakes = rivermapper.flow_routing(model.dem, model.dirs, model.lakes, 'semirandom')
|
model.dirs, model.lakes = rivermapper.flow_routing(model.dem, model.dirs, model.lakes, 'semirandom')
|
||||||
model.rivers = rivermapper.accumulate(model.dirs, model.rivers)
|
model.rivers = rivermapper.accumulate(model.dirs, model.rivers)
|
||||||
|
Loading…
Reference in New Issue
Block a user