ns_cavegen/init.lua

28 lines
1002 B
Lua

ns_cavegen_init = {}
-- Depending on the Minetest version, mapgen can be executed on the main thread
-- or on the separate thread.
-- Optionally, you can override this value.
local execute_in_mapgen_environment = false
function ns_cavegen_init.register_cavegen_script(file_name)
-- As of Minetest 5.9.0, a Minetest server can crash without notice when
-- a script is executed in the mapgen environment. This is likely related
-- to a memory leak error:
--
-- If you would like to override this setting, you can adjust the
-- "ns_cavegen_mapgen_environment" variable in your `minetest.conf` settings
-- file.
local use_mapgen_env = minetest.settings:get_bool("ns_cavegen_mapgen_environment", false)
if execute_in_mapgen_environment or use_mapgen_env then
minetest.register_mapgen_script(file_name)
else
dofile(file_name)
end
end
minetest.register_mapgen_script(
minetest.get_modpath(minetest.get_current_modname()) .. "/script.lua"
)