diff --git a/init.lua b/init.lua index 33815cd..b68dfe1 100644 --- a/init.lua +++ b/init.lua @@ -1117,6 +1117,29 @@ minetest.register_chatcommand("perlin_generate", { end, }) +minetest.register_chatcommand("perlin_toggle_mapgen", { + privs = { server = true }, + description = S("Toggle the automatic Perlin noise map generator"), + params = "", + func = function(name, param) + if not current_perlin.noise then + return false, S("No active Perlin noise set. Set one first!") + end + current_options.autogen = not current_options.autogen + if current_options.autogen then + loaded_areas = {} + end + minetest.log("action", "[perlin_explorer] Autogen state is now: "..tostring(current_options.autogen)) + local msg + if current_options.autogen then + msg = S("Mapgen enabled!") + else + msg = S("Mapgen disabled!") + end + return true, msg + end, +}) + -- Show an error window to player with the given message. -- Set analyze_button to true to add a button "Analyze now" -- to open the analyze window.