remove settings-related functions from core

This commit is contained in:
MihailRis 2026-01-07 02:39:29 +03:00
parent 5260062181
commit a6301c8837
14 changed files with 119 additions and 120 deletions

View file

@ -1,7 +1,7 @@
function on_open()
document.langs_btn.text = string.format(
"%s: %s", gui.str("Language", "settings"),
gui.get_locales_info()[core.get_setting("ui.language")].name
gui.get_locales_info()[app.get_setting("ui.language")].name
)
sections = RadioGroup({
audio=document.s_aud,

View file

@ -1,25 +1,25 @@
function create_setting(id, name, step, postfix)
local info = core.get_setting_info(id)
local info = app.get_setting_info(id)
postfix = postfix or ""
document.root:add(gui.template("track_setting", {
id=id,
name=gui.str(name, "settings"),
value=core.get_setting(id),
value=app.get_setting(id),
min=info.min,
max=info.max,
step=step,
postfix=postfix
}))
update_setting(core.get_setting(id), id, name, postfix)
update_setting(app.get_setting(id), id, name, postfix)
end
function update_setting(x, id, name, postfix)
core.set_setting(id, x)
app.set_setting(id, x)
-- updating label
document[id..".L"].text = string.format(
"%s: %s%s",
gui.str(name, "settings"),
core.str_setting(id),
app.str_setting(id),
postfix
)
end
@ -54,7 +54,7 @@ function on_open()
create_setting("audio.volume-music", "Music", 0.01)
document.root:add("<label context='settings'>@Microphone</label>")
document.root:add("<select id='input_device_select' "..
"onselect='function(opt) core.set_setting(\"audio.input-device\", opt) end'/>")
"onselect='function(opt) app.set_setting(\"audio.input-device\", opt) end'/>")
document.root:add("<container id='input_volume_outer' color='#000000' size='4'>"
.."<container id='input_volume_inner' color='#00FF00FF' pos='1' size='2'/>"
.."</container>")

View file

@ -40,12 +40,12 @@ function refresh_sensitivity()
document.sensitivity_label.text = string.format(
"%s: %s",
gui.str("Mouse Sensitivity", "settings"),
core.str_setting("camera.sensitivity")
app.str_setting("camera.sensitivity")
)
end
function change_sensitivity(val)
core.set_setting("camera.sensitivity", val)
app.set_setting("camera.sensitivity", val)
refresh_sensitivity()
end
@ -93,7 +93,7 @@ function refresh_binding_marks()
end
function on_open()
document.sensitivity_track.value = core.get_setting("camera.sensitivity")
document.sensitivity_track.value = app.get_setting("camera.sensitivity")
refresh_sensitivity()
local panel = document.bindings_panel

View file

@ -10,14 +10,14 @@ tostring_overrides["display.framerate"] = function(x)
end
function create_setting(id, name, step, postfix, tooltip, changeonrelease)
local info = core.get_setting_info(id)
local info = app.get_setting_info(id)
postfix = postfix or ""
tooltip = tooltip or ""
changeonrelease = changeonrelease or ""
document.root:add(gui.template("track_setting", {
id=id,
name=gui.str(name, "settings"),
value=core.get_setting(id),
value=app.get_setting(id),
min=info.min,
max=info.max,
step=step,
@ -25,7 +25,7 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
tooltip=tooltip,
changeonrelease=changeonrelease
}))
update_setting(core.get_setting(id), id, name, postfix)
update_setting(app.get_setting(id), id, name, postfix)
end
function update_setting(x, id, name, postfix)
@ -34,13 +34,13 @@ function update_setting(x, id, name, postfix)
if func then
str = func(x)
else
str = core.str_setting(id)
str = app.str_setting(id)
end
-- updating label
document[id..".L"].text = string.format(
"%s: %s%s",
gui.str(name, "settings"),
str,
"%s: %s%s",
gui.str(name, "settings"),
str,
postfix
)
end
@ -48,8 +48,8 @@ end
function create_checkbox(id, name, tooltip)
tooltip = tooltip or ''
document.root:add(string.format(
"<checkbox consumer='function(x) core.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
id, core.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
"<checkbox consumer='function(x) app.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
id, app.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
))
end
@ -59,11 +59,11 @@ function on_open()
create_setting("display.framerate", "Framerate", 1, "", "", true)
document.root:add(string.format(
"<select context='settings' onselect='function(opt) core.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..
"<select context='settings' onselect='function(opt) app.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..
"<option value='0'>@Windowed</option>"..
"<option value='1'>@Fullscreen</option>"..
"<option value='2'>@Borderless</option>"..
"</select>", core.get_setting("display.window-mode"))
"</select>", app.get_setting("display.window-mode"))
)
create_checkbox("camera.shaking", "Camera Shaking")

View file

@ -1,12 +1,12 @@
function create_setting(id, name, step, postfix, tooltip, changeonrelease)
local info = core.get_setting_info(id)
local info = app.get_setting_info(id)
postfix = postfix or ""
tooltip = tooltip or ""
changeonrelease = changeonrelease or ""
document.root:add(gui.template("track_setting", {
id=id,
name=gui.str(name, "settings"),
value=core.get_setting(id),
value=app.get_setting(id),
min=info.min,
max=info.max,
step=step,
@ -14,15 +14,15 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
tooltip=tooltip,
changeonrelease=changeonrelease
}))
update_setting(core.get_setting(id), id, name, postfix)
update_setting(app.get_setting(id), id, name, postfix)
end
function update_setting(x, id, name, postfix)
-- updating label
document[id..".L"].text = string.format(
"%s: %s%s",
gui.str(name, "settings"),
core.str_setting(id),
"%s: %s%s",
gui.str(name, "settings"),
app.str_setting(id),
postfix
)
end
@ -30,8 +30,8 @@ end
function create_checkbox(id, name, tooltip)
tooltip = tooltip or ''
document.root:add(string.format(
"<checkbox consumer='function(x) core.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
id, core.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
"<checkbox consumer='function(x) app.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
id, app.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
))
end

View file

@ -11,7 +11,7 @@ function reset(category)
end
function reset_setting(name)
core.set_setting(name, core.get_setting_info(name).def)
app.set_setting(name, app.get_setting_info(name).def)
end
function reset_audio()

View file

@ -1,7 +1,7 @@
function on_open()
local worlds = world.get_list()
for _, info in ipairs(worlds) do
local major, minor = core.get_version()
local major, minor = app.get_version()
if info.version[1] > major or info.version[2] > minor then
info.versionColor = "#A02010"
else

View file

@ -1,4 +1,4 @@
<button
onclick='core.set_setting("ui.language", "%{id}") menu:back()'>
onclick='app.set_setting("ui.language", "%{id}") menu:back()'>
%{name}
</button>

View file

@ -2,6 +2,6 @@
<label id='%{id}.L' margin='0,3,0,0'>%{name}: %{value}%{postfix}</label>
<trackbar
value='%{value}' min='%{min}' max='%{max}' step='%{step}' tooltip='%{tooltip}'
consumer='function(x) core.set_setting("%{id}", x) end' change-on-release='%{changeonrelease}'
consumer='function(x) app.set_setting("%{id}", x) end' change-on-release='%{changeonrelease}'
sub-consumer='function(x) update_setting(x, "%{id}", "%{name}", "%{postfix}") end'/>
</panel>