Merge pull request #584 from Xertis/patch-12

Qol settings.controls update
This commit is contained in:
MihailRis 2025-08-04 21:46:08 +03:00 committed by GitHub
commit 1e4a7c8ea8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 63 additions and 3 deletions

View File

@ -1,3 +1,12 @@
local WARNING_COLORS = {
{208, 104, 107, 255},
{250, 75, 139, 255},
{250, 151, 75, 255},
{246, 233, 44, 255},
{252, 200, 149, 255}
}
local GENERAL_WARNING_COLOR = {208, 138, 0, 255}
function refresh_search()
local search_text = document.search_textbox.text
@ -40,6 +49,49 @@ function change_sensitivity(val)
refresh_sensitivity()
end
function refresh_binding_marks()
local prev_bindings = {}
local conflicts_colors = {}
local available_colors = table.copy(WARNING_COLORS)
local bindings = input.get_bindings()
table.sort(bindings, function(a, b) return a > b end)
for _, bind_name in ipairs(bindings) do
local key = input.get_binding_text(bind_name)
local prev = prev_bindings[key]
if prev then
local color = GENERAL_WARNING_COLOR
local conflict_color = conflicts_colors[key]
local available_colors_len = #available_colors
if conflict_color then
color = conflict_color
elseif available_colors_len > 0 then
color = available_colors[available_colors_len]
conflicts_colors[key] = color
table.remove(available_colors, available_colors_len)
end
local tooltip = gui.str("settings.Conflict", "settings")
local prev_bindmark = "bindmark_" .. prev
local cur_bindmark = "bindmark_" .. bind_name
document[prev_bindmark].visible = true
document[cur_bindmark].visible = true
document[prev_bindmark].color = color
document[cur_bindmark].color = color
document["bind_" .. prev].tooltip = tooltip
document["bind_" .. bind_name].tooltip = tooltip
else
document["bindmark_" .. bind_name].visible = false
document["bind_" .. bind_name].tooltip = ''
prev_bindings[key] = bind_name
end
end
end
function on_open()
document.sensitivity_track.value = core.get_setting("camera.sensitivity")
refresh_sensitivity()
@ -52,4 +104,8 @@ function on_open()
id=name, name=gui.str(name)
}))
end
document.bindings_panel:setInterval(100, function ()
refresh_binding_marks()
end)
end

View File

@ -1,4 +1,5 @@
<panel size='400,40' padding='4' color='0' orientation='horizontal'>
<panel id='bind_%{id}' size='400,40' padding='4' color='0' orientation='horizontal'>
<bindbox binding='%{id}'/>
<label margin='6'>%{name}</label>
<image id="bindmark_%{id}"src='gui/left_half_block' size='4,28' visible="false"/>
<label id='bindlabel_%{id}' color="#ffffffff" margin='6'>%{name}</label>
</panel>

View File

@ -47,7 +47,8 @@
"gui/info",
"gui/world",
"gui/hud",
"gui/entity"
"gui/entity",
"gui/half_block"
],
"fonts": [
{

View File

@ -22,6 +22,7 @@ graphics.dense-render.tooltip=Enables transparency in blocks like leaves
# settings
settings.Controls Search Mode=Search by attached button name
settings.Conflict=Possible conflicts found
# Bindings
chunks.reload=Reload Chunks

View File

@ -100,6 +100,7 @@ settings.Controls Search Mode=Поиск по привязанной кнопк
settings.Limit Background FPS=Ограничить фоновую частоту кадров
settings.Advanced render=Продвинутый рендер
settings.Shadows quality=Качество теней
settings.Conflict=Найдены возможные конфликты
# Управление
chunks.reload=Перезагрузить Чанки

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B