From a6d4438683b338a0894d74d698f251c92fa0b889 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Wed, 19 Dec 2018 14:49:30 +0100 Subject: [PATCH] added swipe button to the tweaks --- smart_sfinv_tweaks/init.lua | 11 +++++++++++ .../textures/smart_sfinv_tweaks_sweep_button.png | Bin 0 -> 341 bytes 2 files changed, 11 insertions(+) create mode 100644 smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png diff --git a/smart_sfinv_tweaks/init.lua b/smart_sfinv_tweaks/init.lua index 74d1d0f..1f2387c 100644 --- a/smart_sfinv_tweaks/init.lua +++ b/smart_sfinv_tweaks/init.lua @@ -7,8 +7,15 @@ smart_sfinv_api.defaults.theme_inv = smart_sfinv_api.defaults.theme_inv .. '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({ + 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) if fields.sfinv_tweaks_compress then 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:rotate_rows() 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 }) diff --git a/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png b/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png new file mode 100644 index 0000000000000000000000000000000000000000..2f79fd0f817fde515a7c2cc1fa63f90e81c0499e GIT binary patch literal 341 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPtr-UFsdvB)wTA+|*iEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8f1EPZ!4!i_^(Hot;0=J1{0R8h$D+mi(xhqxI$I`LpK^1l-x! zISG@-HB&ed#A|rYhUvZZs=IRcq2#sBty+M;amp2+kr`q zGbX5?WNrD=cb%crJ+q{o7ypeda=I@9u|Zcc14`0trlbt#ppt;H;9< z9v%a!`Dr4|Dsod7KH(Hpj9av5I_EOUG~qL4Y;0^z+Ya-txTC=>UZHsXs7KG`#F?EF dFTLSmh^-8Hx_QFndZ0%bJYD@<);T3K0RTsSf}H>W literal 0 HcmV?d00001