From d2ac96253d40b55c8d4f3a498acff6da94f263d0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 15 Dec 2016 12:24:40 +0100 Subject: Make category buttons wider --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 72a1ed5..b239609 100644 --- a/init.lua +++ b/init.lua @@ -701,10 +701,11 @@ function doc.formspec_main(playername) for c=1,#doc.data.category_order do local id = doc.data.category_order[c] local data = doc.data.categories[id] + local bw = doc.FORMSPEC.WIDTH / math.floor(((doc.data.category_count-1) / CATEGORYFIELDSIZE.HEIGHT)+1) -- Skip categories which do not exist if data ~= nil then -- Category buton - local button = "button["..((x-1)*3)..","..y..";3,1;doc_button_category_"..id..";"..minetest.formspec_escape(data.def.name).."]" + local button = "button["..((x-1)*bw)..","..y..";"..bw..",1;doc_button_category_"..id..";"..minetest.formspec_escape(data.def.name).."]" local tooltip = "" -- Optional description if data.def.description ~= nil then -- cgit v1.2.3