Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minetest.settings to CSM API and allow CSMs to provide settingtypes.txt #12131

Merged
merged 8 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow CSM to provide settingtypes.txt
  • Loading branch information
AFCMS committed May 5, 2022
commit cfeebf4541f055fb7d110ffc160b1f2394bae04b
30 changes: 30 additions & 0 deletions builtin/mainmenu/dlg_settings_advanced.lua
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,36 @@ local function parse_config_file(read_all, parse_mods)
file:close()
end
end

-- Parse client mods
local clientmods_category_initialized = false
local clientmods = {}
get_mods(core.get_clientmodpath(), "clientmods", clientmods)
for _, mod in ipairs(clientmods) do
local path = mod.path .. DIR_DELIM .. FILENAME
local file = io.open(path, "r")
if file then
if not clientmods_category_initialized then
fgettext_ne("Client Mods") -- not used, but needed for xgettext
table.insert(settings, {
name = "Client Mods",
level = 0,
type = "category",
})
clientmods_category_initialized = true
end

table.insert(settings, {
name = mod.name,
level = 1,
type = "category",
})

parse_single_file(file, path, read_all, settings, 2, false)

file:close()
end
end
end

return settings
Expand Down
3 changes: 3 additions & 0 deletions clientmods/preview/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ core.after(5, function()

print("[PREVIEW] Find node near: " .. dump(core.find_node_near({x=0, y=20, z=0}, 10,
{"group:tree", "default:dirt", "default:stone"})))

print("[PREVIEW] Settings: preview_csm_test_setting = " ..
tostring(core.settings:get_bool("preview_csm_test_setting", false)))
end)

core.register_on_dignode(function(pos, node)
Expand Down
1 change: 1 addition & 0 deletions clientmods/preview/settingtypes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preview_csm_test_setting (Test CSM setting) bool false