get mt-0.5 ready

This commit is contained in:
Alexander Weber 2018-12-19 18:43:09 +01:00
parent a6d4438683
commit dd298406ea
3 changed files with 19 additions and 4 deletions

View File

@ -88,7 +88,16 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
handler:run_enhancements("make_formspec", player, context, content, show_inv) handler:run_enhancements("make_formspec", player, context, content, show_inv)
local tmp = { local tmp = enh_handler_class.patch_2275 and {
handler.formspec_size,
handler.theme_main,
handler.formspec_before_navfs,
nav_fs,
handler.formspec_after_navfs,
show_inv and handler.theme_inv or "",
content,
handler.formspec_after_content
} or { -- can be removed if patch_2275 merged to upstream
handler.formspec_size, handler.formspec_size,
handler.theme_main, handler.theme_main,
handler.formspec_before_navfs, handler.formspec_before_navfs,
@ -98,6 +107,7 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
show_inv and handler.theme_inv or "", show_inv and handler.theme_inv or "",
handler.formspec_after_content handler.formspec_after_content
} }
return table.concat(tmp, "") return table.concat(tmp, "")
end end
@ -126,4 +136,9 @@ end)
-- Initialization: hacky access to some default variables -- Initialization: hacky access to some default variables
---------------------------------------------- ----------------------------------------------
local _dummy_page = orig_make_formspec(nil, {}, "|", true, nil) local _dummy_page = orig_make_formspec(nil, {}, "|", true, nil)
enh_handler_class.formspec_size, enh_handler_class.theme_main, enh_handler_class.theme_inv = _dummy_page:match("(size%[[%d.,]+%]+)([^|]+)|([^|]+)") enh_handler_class.formspec_size, enh_handler_class.theme_main, enh_handler_class.theme_inv = _dummy_page:match("(size%[[%d.,]+%]*)([^|]*)|([^|]*)")
if enh_handler_class.theme_inv == "" then -- Support for https://github.com/minetest/minetest_game/pull/2275
enh_handler_class.patch_2275 = true
enh_handler_class.theme_inv = enh_handler_class.theme_main
enh_handler_class.theme_main = ""
end

View File

@ -38,7 +38,7 @@ smart_sfinv_api.register_enhancement({
if current_idx_above == -1 then if current_idx_above == -1 then
current_idx_above = 2 -- Creative current_idx_above = 2 -- Creative
handler.formspec_before_navfs = "textlist[0,0;2.8,8.6;smart_sfinv_nav_site;" .. table.concat(nav_titles_site, ",") .. handler.formspec_before_navfs = "textlist[0,0;2.8,8.6;smart_sfinv_nav_site;" .. table.concat(nav_titles_site, ",") ..
";" .. context.current_idx_site .. ";true]container[3.5,0]"..handler.formspec_before_navfs ";" .. context.current_idx_site .. ";true]container[3,0]"..handler.formspec_before_navfs
handler.formspec_after_content = handler.formspec_after_content.."container_end[]" handler.formspec_after_content = handler.formspec_after_content.."container_end[]"
handler.formspec_size = 'size[11,8.6]' handler.formspec_size = 'size[11,8.6]'
elseif current_idx_above >= 2 then elseif current_idx_above >= 2 then

View File

@ -7,7 +7,7 @@ smart_sfinv_api.defaults.theme_inv = smart_sfinv_api.defaults.theme_inv ..
'tooltip[sfinv_tweaks_rotate;Rotate rows]' 'tooltip[sfinv_tweaks_rotate;Rotate rows]'
local crafting_enhance = 'image_button[0.5,1.6;0.8,0.8;smart_sfinv_tweaks_sweep_button.png;sfinv_tweaks_sweep;]' .. local crafting_enhance = 'image_button[0.5,1.6;0.8,0.8;smart_sfinv_tweaks_sweep_button.png;sfinv_tweaks_sweep;]' ..
'tooltip[sfinv_tweaks_sweep;Sweep crafting area]' 'tooltip[sfinv_tweaks_sweep;Sweep crafting area]'
smart_sfinv_api.register_enhancement({ smart_sfinv_api.register_enhancement({