mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Merge dc813bd651
into 2d36d32da8
This commit is contained in:
commit
b9ab192600
5 changed files with 54 additions and 8 deletions
|
@ -438,11 +438,41 @@ function make.key(setting)
|
|||
if value == "" then
|
||||
return height
|
||||
end
|
||||
|
||||
local critical_keys = {
|
||||
keymap_chat = true,
|
||||
keymap_drop = true,
|
||||
keymap_inventory = true,
|
||||
keymap_cmd = true,
|
||||
keymap_cmd_local = true,
|
||||
keymap_dig = true,
|
||||
keymap_place = true,
|
||||
}
|
||||
|
||||
for _, o in ipairs(core.full_settingtypes) do
|
||||
if o.type == "key" and o.name ~= setting.name and core.are_keycodes_equal(core.settings:get(o.name), value) then
|
||||
table.insert(fs, ("label[0,%f;%s]"):format(height + 0.3,
|
||||
core.colorize(mt_color_orange, fgettext([[Conflicts with "$1"]], fgettext(o.readable_name)))))
|
||||
height = height + 0.6
|
||||
if o.type == "key" and o.name ~= setting.name and
|
||||
core.are_keycodes_equal(core.settings:get(o.name), value) then
|
||||
|
||||
local is_current_close_world = setting.name == "keymap_close_world"
|
||||
local is_other_close_world = o.name == "keymap_close_world"
|
||||
|
||||
-- Current means current key you've messed with, other means the other key it conflicts with.
|
||||
local is_current_critical = critical_keys[setting.name]
|
||||
local is_other_critical = critical_keys[o.name]
|
||||
|
||||
local show_warning_current = false
|
||||
|
||||
if (is_current_close_world and is_other_critical)
|
||||
or (is_other_close_world and is_current_critical)
|
||||
or (not is_current_close_world and not is_other_close_world) then
|
||||
show_warning_current = true
|
||||
end
|
||||
|
||||
if show_warning_current then
|
||||
table.insert(fs, ("label[0,%f;%s]"):format(height + 0.3,
|
||||
core.colorize(mt_color_orange, fgettext([[Conflicts with "$1"]], fgettext(o.readable_name)))))
|
||||
height = height + 0.6
|
||||
end
|
||||
end
|
||||
end
|
||||
return height
|
||||
|
@ -454,12 +484,12 @@ function make.key(setting)
|
|||
|
||||
get_formspec = function(self, avail_w)
|
||||
self.resettable = core.settings:has(setting.name)
|
||||
local btn_bind_width = math.max(2.5, avail_w/2)
|
||||
local btn_bind_width = math.max(2.5, avail_w / 2)
|
||||
local value = core.settings:get(setting.name)
|
||||
local fs = {
|
||||
("label[0,0.4;%s]"):format(get_label(setting)),
|
||||
("button_key[%f,0;%f,0.8;%s;%s]"):format(
|
||||
btn_bind_width, btn_bind_width-0.8,
|
||||
btn_bind_width, btn_bind_width - 0.8,
|
||||
btn_bind, core.formspec_escape(value)),
|
||||
("image_button[%f,0;0.8,0.8;%s;%s;]"):format(avail_w - 0.8,
|
||||
core.formspec_escape(defaulttexturedir .. "clear.png"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue