Actually set settings

This commit is contained in:
swagtoy 2024-06-27 01:33:26 -04:00
parent ebeb998e1b
commit a13cf23432
3 changed files with 19 additions and 3 deletions

@ -109,5 +109,5 @@ end
function core.show_settings()
load(true, false)
show_settings_client_formspec()
show_settings_client_formspec("MT_PAUSE_MENU_SETTINGS")
end

@ -756,6 +756,6 @@ function create_settings_dlg()
return dlg
end
function show_settings_client_formspec()
minetest.show_formspec("dlg_settings", get_formspec({}))
function show_settings_client_formspec(name)
minetest.show_formspec(name or "dlg_settings", get_formspec({}))
end

@ -189,6 +189,20 @@ struct LocalFormspecHandler : public TextDest
return;
}
if (m_formname == "MT_PAUSE_MENU_SETTINGS")
{
// Loop through settings
for (auto i : fields)
{
if (g_settings->existsLocal(i.first) && g_settings->get(i.first) != i.second)
{
g_settings->set(i.first, i.second);
//std::cout << "Setting " << i.first << " set!" << std::endl;
}
}
return;
}
if (m_formname == "MT_DEATH_SCREEN") {
assert(m_client != nullptr);
@ -1880,6 +1894,7 @@ inline bool Game::handleCallbacks()
(new GUIKeyChangeMenu(guienv, guiroot, -1,
&g_menumgr, texture_src))->drop();
g_gamecallback->keyconfig_requested = false;
m_is_paused = false;
}
if (g_gamecallback->unpause_requested) {
@ -1891,6 +1906,7 @@ inline bool Game::handleCallbacks()
if (client->modsLoaded())
{
client->getScript()->show_settings();
m_is_paused = false;
}
g_gamecallback->show_settings_requested = false;
}