]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - builtin/mainmenu/generate_from_settingtypes.lua
Fix games not updating on deletion
[dragonfireclient.git] / builtin / mainmenu / generate_from_settingtypes.lua
index 6c9ba27fbcf272acce1705ebec11ca3d895494ff..25cc446064b7c50f20dbaf42a689530db5ba45ad 100644 (file)
@@ -22,6 +22,20 @@ local minetest_example_header = [[
 
 ]]
 
+local group_format_template = [[
+# %s = {
+#    offset      = %s,
+#    scale       = %s,
+#    spread      = (%s, %s, %s),
+#    seed        = %s,
+#    octaves     = %s,
+#    persistence = %s,
+#    lacunarity  = %s,
+#    flags       = %s
+# }
+
+]]
+
 local function create_minetest_conf_example()
        local result = { minetest_example_header }
        for _, entry in ipairs(settings) do
@@ -33,6 +47,12 @@ local function create_minetest_conf_example()
                                insert(result, "# " .. entry.name .. "\n\n")
                        end
                else
+                       local group_format = false
+                       if entry.noise_params and entry.values then
+                               if entry.type == "noise_params_2d" or entry.type == "noise_params_3d" then
+                                       group_format = true
+                               end
+                       end
                        if entry.comment ~= "" then
                                for _, comment_line in ipairs(entry.comment:split("\n", true)) do
                                        insert(result, "#    " .. comment_line .. "\n")
@@ -45,18 +65,25 @@ local function create_minetest_conf_example()
                        if entry.max then
                                insert(result, " max: " .. entry.max)
                        end
-                       if entry.values then
+                       if entry.values and entry.noise_params == nil then
                                insert(result, " values: " .. concat(entry.values, ", "))
                        end
                        if entry.possible then
-                               insert(result, " possible values: " .. entry.possible:gsub(",", ", "))
+                               insert(result, " possible values: " .. concat(entry.possible, ", "))
                        end
                        insert(result, "\n")
-                       local append
-                       if entry.default ~= "" then
-                               append = " " .. entry.default
+                       if group_format == true then
+                               insert(result, sprintf(group_format_template, entry.name, entry.values[1],
+                                               entry.values[2], entry.values[3], entry.values[4], entry.values[5],
+                                               entry.values[6], entry.values[7], entry.values[8], entry.values[9],
+                                               entry.values[10]))
+                       else
+                               local append
+                               if entry.default ~= "" then
+                                       append = " " .. entry.default
+                               end
+                               insert(result, sprintf("# %s =%s\n\n", entry.name, append or ""))
                        end
-                       insert(result, sprintf("# %s =%s\n\n", entry.name, append or ""))
                end
        end
        return concat(result)