Add /perlin_toggle_mapgen

This commit is contained in:
Wuzzy 2022-04-20 23:15:50 +02:00
parent 9b0f04df18
commit 78f73dfd65

View File

@ -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.