added swipe button to the tweaks

This commit is contained in:
Alexander Weber 2018-12-19 14:49:30 +01:00
parent 40caec2bd5
commit a6d4438683
2 changed files with 11 additions and 0 deletions

View File

@ -7,8 +7,15 @@ 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;]' ..
'tooltip[sfinv_tweaks_sweep;Sweep crafting area]'
smart_sfinv_api.register_enhancement({ smart_sfinv_api.register_enhancement({
make_formspec = function(handler, player, context, content, show_inv)
if context.page == "sfinv:crafting" then
handler.formspec_after_navfs = handler.formspec_after_navfs..crafting_enhance
end
end,
receive_fields = function(handler, player, context, fields) receive_fields = function(handler, player, context, fields)
if fields.sfinv_tweaks_compress then if fields.sfinv_tweaks_compress then
context.tweaks_inv = context.tweaks_inv or maininv.get(player) context.tweaks_inv = context.tweaks_inv or maininv.get(player)
@ -18,6 +25,10 @@ smart_sfinv_api.register_enhancement({
context.tweaks_inv = context.tweaks_inv or maininv.get(player) context.tweaks_inv = context.tweaks_inv or maininv.get(player)
context.tweaks_inv:rotate_rows() context.tweaks_inv:rotate_rows()
end end
if fields.sfinv_tweaks_sweep then
context.tweaks_inv = context.tweaks_inv or maininv.get(player)
context.tweaks_inv:sweep_crafting_inventory()
end
end end
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B