Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 83151cb

Browse files
committed
More interface fine-tuning
1 parent 337ac89 commit 83151cb

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

init.lua

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ local function get_recipe_fs(data)
415415
local fs = {}
416416
local recipe = data.recipes[data.rnum]
417417
local width = recipe.width
418-
local xoffset = sfinv_only and 4 or 4.92
418+
local xoffset = sfinv_only and 3.83 or 4.66
419+
local yoffset = sfinv_only and 6 or 6.6
419420
local cooktime, shapeless
420421

421422
if recipe.type == "cooking" then
@@ -434,8 +435,8 @@ local function get_recipe_fs(data)
434435
ESC(S("Recipe @1 of @2", data.rnum, #data.recipes))
435436

436437
fs[#fs + 1] = fmt(FMT.button,
437-
sfinv_only and 5.8 or 7.4,
438-
sfinv_only and 8 or 8.4,
438+
xoffset + (sfinv_only and 1.98 or 2.7),
439+
yoffset + (sfinv_only and 1.9 or 1.2),
439440
2.2,
440441
1,
441442
"alternate",
@@ -452,9 +453,8 @@ local function get_recipe_fs(data)
452453

453454
for i = 1, width * rows do
454455
local item = recipe.items[i] or ""
455-
local X = ceil((i - 1) % width - width) + xoffset -
456-
(sfinv_only and 0 or 0.2)
457-
local Y = ceil(i / width + (sfinv_only and 6 or 7) - min(2, rows))
456+
local X = ceil((i - 1) % width - width) + xoffset
457+
local Y = ceil(i / width) + yoffset - min(2, rows)
458458

459459
if width > 3 or rows > 3 then
460460
local xof = 1 - 4 / width
@@ -466,9 +466,9 @@ local function get_recipe_fs(data)
466466
s_btn_size = btn_size
467467

468468
X = (btn_size * ((i - 1) % width) + xoffset -
469-
(sfinv_only and 2.8 or 2.84)) * (0.83 - (x_y / 5))
469+
(sfinv_only and 2.83 or (xoffset - 2))) * (0.83 - (x_y / 5))
470470
Y = (btn_size * floor((i - 1) / width) +
471-
(5 + ((sfinv_only and 0.81 or 1.97) + x_y))) * (0.86 - (x_y / 5))
471+
(5 + ((sfinv_only and 0.81 or 1.5) + x_y))) * (0.86 - (x_y / 5))
472472
end
473473

474474
if X > rightest then
@@ -510,9 +510,11 @@ local function get_recipe_fs(data)
510510
icon = fmt("craftguide_%s.png^[resize:16x16", icon)
511511
end
512512

513+
local pos_y = yoffset + (sfinv_only and 0.25 or -0.45)
514+
513515
fs[#fs + 1] = fmt(FMT.image,
514516
min(3.9, rightest) + 1.2,
515-
sfinv_only and 6.2 or 6.55,
517+
pos_y,
516518
0.5,
517519
0.5,
518520
icon)
@@ -522,7 +524,7 @@ local function get_recipe_fs(data)
522524

523525
fs[#fs + 1] = fmt("tooltip[%f,%f;%f,%f;%s]",
524526
rightest + 1.2,
525-
sfinv_only and 6.2 or 6.55,
527+
pos_y,
526528
0.5,
527529
0.5,
528530
ESC(tooltip))
@@ -533,15 +535,15 @@ local function get_recipe_fs(data)
533535

534536
fs[#fs + 1] = fmt(FMT.image,
535537
arrow_X,
536-
sfinv_only and 6.85 or 7.2,
538+
yoffset + (sfinv_only and 0.9 or 0.2),
537539
0.9,
538540
0.7,
539541
"craftguide_arrow.png")
540542

541543
if recipe.type == "fuel" then
542544
fs[#fs + 1] = fmt(FMT.image,
543545
output_X,
544-
sfinv_only and 6.68 or 7,
546+
yoffset + (sfinv_only and 0.7 or 0),
545547
1.1,
546548
1.1,
547549
"craftguide_fire.png")
@@ -551,7 +553,7 @@ local function get_recipe_fs(data)
551553

552554
fs[#fs + 1] = fmt(FMT.item_image_button,
553555
output_X,
554-
sfinv_only and 6.7 or 7,
556+
yoffset + (sfinv_only and 0.7 or 0),
555557
1.1,
556558
1.1,
557559
recipe.output,
@@ -563,14 +565,14 @@ local function get_recipe_fs(data)
563565

564566
fs[#fs + 1] = fmt(FMT.image,
565567
output_X + 1,
566-
sfinv_only and 6.83 or 7.1,
568+
yoffset + (sfinv_only and 0.7 or 0.1),
567569
0.6,
568570
0.4,
569571
"craftguide_arrow.png")
570572

571573
fs[#fs + 1] = fmt(FMT.image,
572574
output_X + 1.6,
573-
sfinv_only and 6.68 or 6.95,
575+
yoffset + (sfinv_only and 0.55 or 0),
574576
0.6,
575577
0.6,
576578
"craftguide_fire.png")
@@ -587,38 +589,38 @@ local function make_formspec(name)
587589
local fs = {}
588590

589591
if not sfinv_only then
590-
fs[#fs + 1] = fmt("size[%f,%f;]", 9.62, 9)
592+
fs[#fs + 1] = fmt("size[%f,%f;]", 9.5, 8.4)
591593

592594
fs[#fs + 1] = [[
593595
no_prepend[]
594596
background[1,1;1,1;craftguide_bg.png;true]
595597
]]
596598
end
597599

598-
fs[#fs + 1] = fmt("field[0.3,0.33;%f,1;filter;;%s]",
599-
sfinv_only and 2.75 or 2.72,
600+
fs[#fs + 1] = fmt("field[0.25,0.2;%f,1;filter;;%s]",
601+
sfinv_only and 2.76 or 2.72,
600602
ESC(data.filter))
601603

602604
fs[#fs + 1] = fmt([[
603-
image_button[%f,0.09;0.85,0.85;craftguide_search_icon.png;search;]
604-
image_button[%f,0.09;0.85,0.85;craftguide_clear_icon.png;clear;]
605+
image_button[%f,-0.05;0.85,0.85;craftguide_search_icon.png;search;]
606+
image_button[%f,-0.05;0.85,0.85;craftguide_clear_icon.png;clear;]
605607
field_close_on_enter[filter;false]
606608
]],
607-
sfinv_only and 2.65 or 2.6,
608-
sfinv_only and 3.35 or 3.3)
609+
sfinv_only and 2.6 or 2.54,
610+
sfinv_only and 3.3 or 3.25)
609611

610612
fs[#fs + 1] = fmt("label[%f,%f;%s / %u]",
611-
sfinv_only and 6.3 or 7.8,
612-
0.22,
613+
sfinv_only and 6.35 or 7.85,
614+
0.06,
613615
colorize("yellow", data.pagenum),
614616
data.pagemax)
615617

616618
fs[#fs + 1] = fmt([[
617-
image_button[%f,0.12;0.8,0.8;craftguide_prev_icon.png;prev;]
618-
image_button[%f,0.12;0.8,0.8;craftguide_next_icon.png;next;]
619+
image_button[%f,-0.05;0.8,0.8;craftguide_prev_icon.png;prev;]
620+
image_button[%f,-0.05;0.8,0.8;craftguide_next_icon.png;next;]
619621
]],
620-
sfinv_only and 5.5 or 6.88,
621-
sfinv_only and 7.25 or 8.8)
622+
sfinv_only and 5.45 or 6.83,
623+
sfinv_only and 7.2 or 8.75)
622624

623625
if #data.items == 0 then
624626
local no_item = S("No item to show")
@@ -641,8 +643,8 @@ local function make_formspec(name)
641643
local Y = (i % IPP - X) / ROWS + 1
642644

643645
fs[#fs + 1] = fmt("item_image_button[%f,%f;%f,%f;%s;%s_inv;]",
644-
X - (X * (sfinv_only and 0.12 or 0.14)),
645-
Y - (Y * 0.1) + 0.1,
646+
X - (X * (sfinv_only and 0.12 or 0.14)) - 0.05,
647+
Y - (Y * 0.1) - 0.1,
646648
1,
647649
1,
648650
item,

0 commit comments

Comments
 (0)