diff options
author | Wuzzy <almikes@aol.com> | 2016-08-07 16:01:53 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-14 13:17:41 +0200 |
commit | 067805671686ecdf155b02bba03dec7472cd8d21 (patch) | |
tree | 3fba50ac37d2568490bf86f0d653fb5bbdddaa2f | |
parent | 5d67d36396fd3a5b03474396509c48b510664c15 (diff) |
Fix horizontally flipped crafting recipes in guide
-rw-r--r-- | register.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/register.lua b/register.lua index 8c1c4fe..55bbdb0 100644 --- a/register.lua +++ b/register.lua @@ -296,6 +296,7 @@ unified_inventory.register_page("craftguide", { end -- Size modifier factor local sf = math.min(1, of * (1.05 + 0.05*od)) + -- Button size local bsize_h = 1.1 * sf local bsize_w = bsize_h if display_size.width >= mini_craft_size then @@ -303,12 +304,15 @@ unified_inventory.register_page("craftguide", { end if (bsize_h > 0.35 and display_size.width) then for y = 1, display_size.height do - for x = display_size.width,1,-1 do + for x = 1, display_size.width do local item if craft and x <= craft_width then item = craft.items[(y-1) * craft_width + x] end - local xof = (x-1) * of + of + -- Flipped x, used to build formspec buttons from right to left + local fx = display_size.width - (x-1) + -- x offset, y offset + local xof = (fx-1) * of + of local yof = (y-1) * of + 1 if item then formspec = formspec..stack_image_button( |