From ab695af45609b990ad9ba6a994feca386131d775 Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Sun, 15 Sep 2024 22:33:29 +0200 Subject: [PATCH] Add thread flexibility for cavegen --- init.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 862ca19..31c2451 100644 --- a/init.lua +++ b/init.lua @@ -63,9 +63,7 @@ function internal.init() internal.overworld_depth_to(WORLD_DEPTH) -- Add custom caves - minetest.register_mapgen_script( - minetest.get_modpath(minetest.get_current_modname()) .. "/mapgen.lua" - ) + internal.add_custom_caves("mapgen.lua") -- Remove massive v7 caves internal.stop_v7_caverns() @@ -111,7 +109,19 @@ function internal.init() internal.spawn_osmium_ore() -- Add more dripstone blocks - internal.register_dripstone_blocks() + -- internal.register_dripstone_blocks() +end + +-- Start the cave generator +function internal.add_custom_caves(filename) + local fullname = minetest.get_modpath(minetest.get_current_modname()) .. "/" .. filename + + if ns_cavegen_init and ns_cavegen_init.register_cavegen_script then + ns_cavegen_init.register_cavegen_script(fullname) + else + minetest.log("warning", "User uses deprecated version 1.0.0 of cave generator - please update soon.") + minetest.register_mapgen_script(fullname) + end end -- Create a deepcopy of a table