summaryrefslogtreecommitdiff
path: root/register.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-07 13:51:59 +0200
committerWuzzy <almikes@aol.com>2016-08-14 13:16:30 +0200
commitf8082a0e353b78609c71d1d25fa307aecc63b747 (patch)
tree6efe5c954a686b5ce393986e716817a2778fc77d /register.lua
parent5c57915159cd04b175811797aa70ae0ecb621d16 (diff)
Fix crafting guide grid button sizes for size>4
Diffstat (limited to 'register.lua')
-rw-r--r--register.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/register.lua b/register.lua
index 585ff45..36920c1 100644
--- a/register.lua
+++ b/register.lua
@@ -188,7 +188,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
selectitem = group_item.sole and displayitem or name
end
local label = show_is_group and "G" or ""
- return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]",
+ return string.format("item_image_button[%f,%f;%f,%f;%s;%s;%s]",
x, y, w, h,
minetest.formspec_escape(displayitem),
minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)),
@@ -288,10 +288,8 @@ unified_inventory.register_page("craftguide", {
-- Offset factor for crafting grids with side length > 4
local of = (3/math.max(3, math.max(display_size.width, display_size.height)))
-- Size modifier factor
- local sf = math.min(1, of * 1.5)
+ local sf = math.min(1, of * 1.05)
local bsize = 1.1 * sf
- -- Ugly hack because for some reason image_buttons don't have the same size as item_image_buttons ...
- local fakesize = bsize - 0.1
for y = 1, display_size.height do
for x = display_size.width,1,-1 do
local item
@@ -309,7 +307,7 @@ unified_inventory.register_page("craftguide", {
-- Fake buttons just to make grid
formspec = formspec.."image_button["
..tostring(xoffset - xof)..","..tostring(formspecy - 1 + yof)
- ..";"..fakesize..","..fakesize..";ui_blank_image.png;;]"
+ ..";"..bsize..","..bsize..";ui_blank_image.png;;]"
end
end
end