[Mod] Craft Guide [craft_guide] - Shows crafts for all loade

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Mon Dec 15, 2014 08:19

Can you post the whole file instead of the diff? That will be easier for me to apply.

Thanks.
 

User avatar
arcturian_vagabond
Member
 
Posts: 15
Joined: Thu Dec 11, 2014 01:58
In-game: posipil

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by arcturian_vagabond » Mon Dec 15, 2014 20:12

If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free.


I did and it will take some time for me to process. I asked by ingame partner to watch it, but she said it is too intense for her.
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Mon Dec 15, 2014 21:43

Hi,
good news, I'm finished with formatting my code and giving variables better names. xD
I tested my changes and finally don't find any problems with it.

I added a few new buttons and made changes, so you can add items to bookmarks now even if you are looking at the "you need:" list.
And it's possible to show a "you need" list for bookmarks now, because you can replace main inventory list with it if you use the small button pointing upwards.

So I'm quite happy with my modifications, maybe the only thing it would need to be a perfect guide would be if it knows recipes for machines from technic mod, like grinding for example.

Here's another screenshot:

Image

Notice that the numbers of items needed are a bit off when the recipes got to complex, like in the example of a HV Battery Box. This are rounding errors which sum up a bit.


Download: see attachment
Attachments
guide.zip
Craft guide - modified by Miner59, improved version
(17.66 KiB) Downloaded 595 times
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Don » Mon Dec 15, 2014 21:48

Excellent work!
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Mon Dec 15, 2014 21:56

Miner59 wrote:Notice that the numbers of items needed are a bit off when the recipes got to complex, like in the example of a HV Battery Box. This are rounding errors which sum up a bit.


Can you give a brief explanation about how it calculated 15.11 of an item?

You should run math.ceil on the number, just so it doesn't have a decimal.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Mon Dec 15, 2014 22:09

@Miner59

I pushed your changes:
https://github.com/cornernote/minetest- ... 0b2065bc3d

I also added you to the credits:
http://cornernote.github.io/minetest-craft_guide/

Thanks for your hard work and awesome code!
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Mon Dec 15, 2014 22:18

arcturian_vagabond wrote:
If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free.


I did and it will take some time for me to process. I asked by ingame partner to watch it, but she said it is too intense for her.


Thanks for taking the time to watch it.
 

User avatar
arcturian_vagabond
Member
 
Posts: 15
Joined: Thu Dec 11, 2014 01:58
In-game: posipil

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by arcturian_vagabond » Tue Dec 16, 2014 03:49

Thanks for taking the time to watch it.


I don't mind being challenged with difficult material, but I don't pretend to have all the answers.
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Tue Dec 16, 2014 03:53

Miner59 wrote:Notice that the numbers of items needed are a bit off when the recipes got to complex, […]. This are rounding errors which sum up a bit.

Then don’t round while calculating and only round as last step right before displaying? :)
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Tue Dec 16, 2014 20:10

Can you give a brief explanation about how it calculated 15.11 of an item?

You should run math.ceil on the number, just so it doesn't have a decimal.


You actually need 14 raw latex, so it's 1,11 off.
The explanation is, that all items of the recipe are added to inventory slots first, then they are counted.
If there are too many items they wouldn't fit inside the inventory.., so I divide them by 50 if numbers get to big.
So I get rounding errors when restoring them later. That's why I said this is a bit hacky...
And you can't just round everything to integers, because if you need a cable and you get 6 cables from 3 copper you only need 0,5 copper in the end.

But I wrote a new version which saves the items in a table, and now it should always calculate correct amount of items. Although I finally found a way to make a for loop which checks if any of the buttons is pressed and this makes huge amount of copy&paste code unnecessary.
I saw that I had added a small image in my texture folder, which isn't needed. I forgot it was there, so you can remove it again.

Here's a diff. I hope it is enough, otherwise i will post whole file again.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

@@ -21,6 +21,8 @@
 -- define api variables
 craft_guide.crafts = {}
 
+craft_guide.you_need_list = {}
+
 -- here you can disable "you need" feature if you don't want it
 craft_guide.you_need=true
 
@@ -126,7 +127,7 @@
       meta:set_string("saved_pages","1")
       meta:set_string("switch","bookmarks")
       meta:set_string("poslist","down")
-      meta:set_string("amounts","")
+      meta:set_string("globalcount","1")
    end   
    if page == nil then
       page = craft_guide.get_current_page(meta)
@@ -144,132 +145,14 @@
    if crafts ~= nil then
       alternates = #crafts
    end
-   local build=""
-   for ii=1,9,1 do
-      local build_old=build
-      local build_stack = inv:get_stack("build",ii)
-      if build_stack~=nil then
-         local build_name=build_stack:get_name()
-         if string.sub(build_name,1,6)=="group:" then
-            local groups=string.sub(build_name,7)
-            local saved=""
-            for name,def in pairs(minetest.registered_items) do
-               local hasgroup=1
-               for group in string.gmatch(groups,"([^,]+)") do
-                  if minetest.get_item_group(name, group)==0 then
-                     hasgroup=0
-                  end
-               end
-               if hasgroup==1 then
-                                                --prefer items from default mod
-                  if string.sub(name,1,8)=="default:" then
-                     build=build.."item_image_button["..tostring(2+((ii-1)%3))..","
-                     ..tostring(7+math.floor((ii-1)/3))..";1,1;"
-                     ..name..";t_758s"..tostring(ii)..";group]"
-                     .."tooltip[t_758s"..tostring(ii)..";"
-                     ..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-
-                     saved=""
-                     break
-                  elseif saved=="" then
-                     saved=name
-                  end
-               end
-            end
-            if saved~="" then
-               build=build.."item_image_button["..tostring(2+((ii-1)%3))..","
-               ..tostring(7+math.floor((ii-1)/3))..";1,1;"..saved..";t_758s"..tostring(ii)..";group]"
-               .."tooltip[t_758s"..tostring(ii)..";"
-               ..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-            end
-         end
-      end
-      if build_old==build then
-         build=build.."list[current_name;build;"..tostring(2+((ii-1)%3))..","..tostring(7+math.floor((ii-1)/3))
-            ..";1,1;"..tostring(ii-1).."]"
-      end
-   end
-   local cook=""
-   local cook_stack = inv:get_stack("cook",1)
-   if cook_stack~=nil then
-      local cook_name=cook_stack:get_name()
-      if string.sub(cook_name,1,6)=="group:" then
-         local groups=string.sub(cook_name,7)
-         local saved=""
-         for name,def in pairs(minetest.registered_items) do
-            local hasgroup=1
-            for group in string.gmatch(groups,"([^,]+)") do
-               if minetest.get_item_group(name, group)==0 then
-                  hasgroup=0
-               end
-            end
-            if hasgroup==1 then
-               if string.sub(name,1,8)=="default:" then
-                  cook="item_image_button[6,7;1,1;"..name..";c_758s1;group]"
-                  .."tooltip[c_758s1;"..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-   
-                  saved=""
-                  break
-               elseif saved=="" then
-                  saved=name
-               end
-            end
-         end
-         if saved~="" then
-            cook="item_image_button[6,7;1,1;"..saved..";c_758s1;group]"
-            .."tooltip[c_758s1;"..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-         end
-      end
-      if cook=="" then
-         cook="list[current_name;cook;6,7;1,1;]"
-      end
-   end
-
-   local fuel=""
-   local fuel_stack = inv:get_stack("fuel",1)
-   if fuel_stack~=nil then
-      local fuel_name=fuel_stack:get_name()
-      if string.sub(fuel_name,1,6)=="group:" then
-         local groups=string.sub(fuel_name,7)
-         local saved=""
-         for name,def in pairs(minetest.registered_items) do
-            local hasgroup=1
-            for group in string.gmatch(groups,"([^,]+)") do
-               if minetest.get_item_group(name, group)==0 then
-                  hasgroup=0
-               end
-            end
-            if hasgroup==1 then
-               if string.sub(name,1,8)=="default:" then
-                  fuel="item_image_button[6,9;1,1;"..name..";f_758s1;group]"
-                  .."tooltip[f_758s1;"..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-   
-                  saved=""
-                  break
-               elseif saved=="" then
-                  saved=name
-               end
-            end
-         end
-         if saved~="" then
-            fuel="item_image_button[6,9;1,1;"..saved..";f_758s1;group]"
-            .."tooltip[f_758s1;"..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-         end
-      end
-      if fuel=="" then
-         fuel="list[current_name;fuel;6,9;1,1;]"
-      end
-   end
-   bk=""
+   backbutton=""
    if meta:get_string("saved_search")~="|" then
-      bk="button[6,5.8;2.7,1;back_button;<--- Back]"
+      backbutton="button[6,5.8;2.7,1;back_button;<--- Back]"
    end
-
    local changeable_part=""
    if meta:get_string("switch")=="youneed" and craft_guide.you_need then
       changeable_part="button[9.7,6.35;0.8,0.7;switch_to_bookmarks;>>]"
             .."tooltip[switch_to_bookmarks;Show your saved bookmarks]"
-
       if meta:get_string("poslist")=="down" then
          changeable_part= changeable_part.."label[8,6.5;You need:]"
             .."button[10.42,6.35;0.5,0.7;move_up;^]"
@@ -278,67 +161,15 @@
             .."label[11.2,6.35;bookmarks]"
             .."label[12.6,6.05;->]"
             .."list[current_name;add;13,6;1,1;]"
+            ..craft_guide.build_button_list(meta,inv,"youneed",12,29,8,7,6)
+
       else
          changeable_part= changeable_part.."button[10.42,6.35;0.5,0.7;move_down;v]"
             .."tooltip[move_down;Move the list of needed items downwards]"
+            ..craft_guide.build_button_list(meta,inv,"youneed",12,29,0,1,14,0)
       end
+      changeable_part= changeable_part..craft_guide.get_amounts(meta,inv,"youneed")
 
-      local itemlist=""
-      local x=8
-      local y=7
-      local widht=6
-      if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
-         x=0
-         y=1
-         widht=14
-      end
-      for ii=1,18,1 do
-         local itemlist_old=itemlist
-         local itemlist_stack = inv:get_stack("youneed",ii)
-         if itemlist_stack~=nil then
-            local itemlist_name=itemlist_stack:get_name()
-            if string.sub(itemlist_name,1,6)=="group:" then
-               local groups=string.sub(itemlist_name,7)
-               local saved=""
-               for name,def in pairs(minetest.registered_items) do
-                  local hasgroup=1
-                  for group in string.gmatch(groups,"([^,]+)") do
-                     if minetest.get_item_group(name, group)==0 then
-                        hasgroup=0
-                     end
-                  end
-                  if hasgroup==1 then
-                                                   --prefer items from default mod
-                     if string.sub(name,1,8)=="default:" then
-                        itemlist=itemlist.."item_image_button["..tostring(x+((ii-1)%widht))..","
-                        ..tostring(y+math.floor((ii-1)/widht))..";1,1;"
-                        ..name..";u_758s"..tostring(ii)..";group]"
-                        .."tooltip[u_758s"..tostring(ii)..";"
-                        ..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-   
-                        saved=""
-                        break
-                     elseif saved=="" then
-                        saved=name
-                     end
-                  end
-               end
-               if saved~="" then
-                  itemlist=itemlist.."item_image_button["..tostring(x+((ii-1)%widht))..","
-                  ..tostring(y+math.floor((ii-1)/widht))..";1,1;"..saved..";u_758s"..tostring(ii)..";group]"
-                  .."tooltip[u_758s"..tostring(ii)..";"..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
-               end
-            end
-         end
-         if itemlist_old==itemlist
-            and (meta:get_string("poslist")=="down"
-            or (inv:get_stack("youneed",ii)~= nil and inv:get_stack("youneed",ii):get_name()~=""))
-            then
-            itemlist=itemlist.."list[current_name;youneed;"..tostring(x+((ii-1)%widht))..","
-               ..tostring(y+math.floor((ii-1)/widht))..";1,1;"..tostring(ii-1).."]"
-         end
-      end
-      changeable_part= changeable_part..itemlist..meta:get_string("amounts")
    end
     if meta:get_string("switch")=="bookmarks" or (not craft_guide.you_need) or meta:get_string("poslist")=="up" then
 
@@ -365,8 +196,7 @@
 
       .."field[6,5.4;2,1;craft_guide_search_box;;"..tostring(search).."]"
       .."button[7.5,5.1;1.2,1;craft_guide_search_button;Search]"
-      ..bk
-
+      ..backbutton
       .."label[9,5.2;page "..tostring(page).." of "..tostring(pages).."]"
       .."button[11,5;1.5,1;craft_guide_prev;<<]"
       .."button[12.5,5;1.5,1;craft_guide_next;>>]"
@@ -375,11 +205,11 @@
       .."list[current_name;output;0,7;1,1;]"
 
       .."label[2,6.5;Inventory Craft]"
-      ..build
+      ..craft_guide.build_button_list(meta,inv,"build",3,11,2,7,3)
       .."label[6,6.5;Cook]"
-      ..cook
+      ..craft_guide.build_button_list(meta,inv,"cook",1,1,6,7,1)
       .."label[6,8.5;Fuel]"
-      ..fuel
+      ..craft_guide.build_button_list(meta,inv,"fuel",2,2,6,9,1)
       ..changeable_part
       .."button_exit[0,9.2;1,0.8;close_mm;ESC]"
 
@@ -406,8 +236,6 @@
    inv:set_size("fuel", 1)
    inv:set_size("bookmark", 6*3)
    inv:set_size("youneed", 6*15)
-   inv:set_size("trylist", 6*10)
-   inv:set_size("overflow", 6*6)
    inv:set_size("bin", 1)
    inv:set_size("add", 1)
    craft_guide.create_inventory(inv)
@@ -447,7 +275,6 @@
    if fields.craft_guide_search_button then
       if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
          meta:set_string("switch","bookmarks")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end      
       meta:set_string("saved_search", "|")
       page = 1
@@ -461,7 +288,6 @@
       end
       if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
          meta:set_string("switch","bookmarks")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end
    end
 
@@ -472,7 +298,6 @@
       end
       if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
          meta:set_string("switch","bookmarks")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end
    end
 
@@ -487,7 +312,6 @@
    if fields.back_button then
       if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
          meta:set_string("switch","bookmarks")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end      
       local saved_search = meta:get_string("saved_search")
       if saved_search~="|" then
@@ -514,14 +338,12 @@
    if fields.move_up then   
       if meta:get_string("switch")=="youneed" then
          meta:set_string("poslist","up")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end
    end
 
    if fields.move_down then   
       if meta:get_string("switch")=="youneed" then
          meta:set_string("poslist","down")
-         craft_guide.update_recipe(meta, player, stack, alternate)
       end
    end
 
@@ -535,458 +357,130 @@
       alternate = 1
    end
 
-   --group buttons
-
-   --button in cook list
+   --group buttons, finally a solution with a for loop
    local starts=""
    local ends=""
    local xx=""
    local formspec = meta:get_string("formspec")
-   if fields.c_758s1 then
-      xx,starts=string.find(formspec,"tooltip%[c_758s1;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   --button in fuel list
-   if fields.f_758s1 then
-      xx,starts=string.find(formspec,"tooltip%[f_758s1;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   --buttons in Inventory Craft
-   if fields.t_758s1 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s1;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s2 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s2;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s3 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s3;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s4 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s4;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s5 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s5;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s6 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s6;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s7 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s7;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.t_758s8 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s8;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
+   for button_number=1,29,1 do
+      if fields[("t_758s"..tostring(button_number))] then
+         xx,starts=string.find(formspec,"tooltip%[t_758s"..tostring(button_number)..";")
+         if starts~=nil then
+            ends,xx=string.find(formspec,"%]",starts+1)
+            local group=string.lower(string.sub(formspec,starts+1,ends-2))
+            meta:set_string("search", "group:"..group)
+            if meta:get_string("saved_search")=="|" then
+               meta:set_string("saved_search", search)
+               meta:set_string("saved_page", tostring(page))
+               meta:set_string("saved_pages", tostring(pages))
+            end
+            page = 1
+            search="group:"..group
          end
-         page = 1
-         search="group:"..group
+      break
       end
    end
-   if fields.t_758s9 then
-      xx,starts=string.find(formspec,"tooltip%[t_758s9;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
+   if starts~="" and meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then --button pressed, need to move back to bookmarks
+      meta:set_string("switch","bookmarks")
    end
+   -- update the formspec
+   craft_guide.create_inventory(inv, search)
+   meta:set_string("formspec",craft_guide.get_craft_guide_formspec(meta, search, page, alternate))
+end
 
-   --buttons in You Need
-   if fields.u_758s1 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s1;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s2 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s2;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s3 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s3;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s4 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s4;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s5 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s5;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s6 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s6;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s7 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s7;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s8 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s8;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s9 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s9;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s11 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s11;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s12 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s12;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s13 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s13;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
-   end
-   if fields.u_758s14 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s14;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
+
+-- returns formspec string of a inventory list with buttons for group items
+craft_guide.build_button_list = function(meta,inv,list,start_index,end_index,x,y,w,show_empty)
+   if show_empty~=0 then
+      show_empty=1
+   end
+   local string=""
+   for i=1,end_index-start_index+1,1 do
+      local string_old=string
+      local stack = inv:get_stack(list,i)
+      if stack~=nil then
+         local name=stack:get_name()
+         if string.sub(name,1,6)=="group:" then
+            local groups=string.sub(name,7)
+            local saved=""
+            for name,def in pairs(minetest.registered_items) do
+               local hasgroup=1
+               for group in string.gmatch(groups,"([^,]+)") do
+                  if minetest.get_item_group(name, group)==0 then
+                     hasgroup=0
+                  end
+               end
+               if hasgroup==1 then
+                                                --prefer items from default mod
+                  if string.sub(name,1,8)=="default:" then
+                     string=string.."item_image_button["..tostring(x+((i-1)%w))..","
+                     ..tostring(y+math.floor((i-1)/w))..";1,1;"
+                     ..name..";t_758s"..tostring(i+start_index-1)..";group]"
+                     .."tooltip[t_758s"..tostring(i+start_index-1)..";"
+                     ..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
+
+                     saved=""
+                     break
+                  elseif saved=="" then
+                     saved=name
+                  end
+               end
+            end
+            if saved~="" then
+               string=string.."item_image_button["..tostring(x+((i-1)%w))..","
+               ..tostring(y+math.floor((i-1)/w))..";1,1;"..saved..";t_758s"..tostring(i+start_index-1)..";group]"
+               .."tooltip[t_758s"..tostring(i+start_index-1)..";"
+               ..string.upper(string.sub(groups,1,1))..string.sub(groups.." ",2).."]"
+            end
          end
-         page = 1
-         search="group:"..group
       end
-   end
-   if fields.u_758s15 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s15;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
+      if string_old==string and ((stack~=nil and stack:get_name()~="") or show_empty==1) then
+         string=string.."list[current_name;"..list..";"..tostring(x+((i-1)%w))..","..tostring(y+math.floor((i-1)/w))
+            ..";1,1;"..tostring(i-1).."]"
       end
    end
-   if fields.u_758s16 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s16;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
-      end
+   return string
+end
+
+
+-- returns a formspec string with item amounts
+craft_guide.get_amounts = function(meta,inv,list)
+   local amounts=""
+   local xx=8.1
+   local yy=7.45
+   local w=6
+   local size=18
+   if meta:get_string("poslist")=="up" then
+      xx=0.1
+      yy=1.45
+      w=14
+      size=70
    end
-   if fields.u_758s17 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s17;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
+   for jj=1,size,1 do
+      local item=string.lower(inv:get_stack(list,jj):get_name())
+      local cnt=1
+      if item==nil or item=="" then
+         break
       end
-   end
-   if fields.u_758s18 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s18;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
+      local count=craft_guide.you_need_list[item]
+      if count~=nil then
+         cnt=math.floor(((count)/tonumber(meta:get_string("globalcount")))*1000+0.49)/1000
+         if cnt>1000 then
+            cnt=math.floor(cnt+0.49)
+         elseif cnt>100 then
+            cnt=math.floor(cnt*10+0.49)/10
+         elseif cnt>10 then
+            cnt=math.floor(cnt*100+0.49)/100
          end
-         page = 1
-         search="group:"..group
+         amounts=amounts.."label["..tostring(xx+((jj-1)%w))..","..tostring(yy+math.floor((jj-1)/w))..";"..tostring(cnt).."]"
       end
-   end
-   if fields.u_758s10 then
-      xx,starts=string.find(formspec,"tooltip%[u_758s10;")
-      if starts~=nil then
-         ends,xx=string.find(formspec,"%]",starts+1)
-         local group=string.lower(string.sub(formspec,starts+1,ends-2))
-         meta:set_string("search", "group:"..group)
-         if meta:get_string("saved_search")=="|" then
-            meta:set_string("saved_search", search)
-            meta:set_string("saved_page", tostring(page))
-            meta:set_string("saved_pages", tostring(pages))
-         end
-         page = 1
-         search="group:"..group
+      jj=jj+1
+      if jj > size then
+         break
       end
+
    end
-   if starts~="" and meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then --button pressed, need to move back to bookmarks
-      meta:set_string("switch","bookmarks")
-   end
-   -- update the formspec
-   craft_guide.create_inventory(inv, search)
-   meta:set_string("formspec",craft_guide.get_craft_guide_formspec(meta, search, page, alternate))
+   return amounts
 end
 
 
@@ -1010,11 +504,11 @@
 
 -- update_recipe
 craft_guide.update_recipe = function(meta, player, stack, alternate)
-   meta:set_string("amounts","")
-   local count={}
    local globalcount=1
-   local m="tq7k" --random modifier to turn unstackable items in stackable items
-
+   local list={}
+   local list2={}
+   local test={}
+   local forlist={}
    local inv = meta:get_inventory()
    if meta:get_string("out")~="" then
       inv:set_stack("output", 1, ItemStack(meta:get_string("out")))
@@ -1026,12 +520,6 @@
    for i=0,inv:get_size("youneed"),1 do
       inv:set_stack("youneed", i, nil)
    end
-   for i=0,inv:get_size("trylist"),1 do
-      inv:set_stack("trylist", i, nil)
-   end
-   for i=0,inv:get_size("overflow"),1 do
-      inv:set_stack("overflow", i, nil)
-   end
 
    inv:set_stack("cook", 1, nil)
    inv:set_stack("fuel", 1, nil)
@@ -1154,18 +642,21 @@
       end
    end
    if meta:get_string("switch")=="youneed" and craft_guide.you_need then
-      count[1]=1
-      inv:set_stack("youneed", 1,ItemStack(stack:get_name()))
-      for j=1,5,1 do
+      craft_guide.you_need_list=nil
+      craft_guide.you_need_list={}
+      list[stack:get_name()] = {}
+      list[stack:get_name()] = 1
+      for j=1,10,1 do   --main iteration loop
          local finished=1
          local limit=inv:get_size("youneed")
-         for k=1,limit,1 do
-            local name=string.lower(inv:get_stack("youneed", k):get_name())
-            if string.len(name)>4 and string.sub(name,string.len(name)-3)==m then
-               name=string.sub(name,1,string.len(name)-4)
+         local k=0
+         for name,count in pairs(list) do
+            if k>limit then
+               break
             end
+            k=k+1
             local isbase=0
-            if name==nil or name=="" or string.sub(name,1,6)=="group:" then
+            if name==nil or name=="" or count==0 or string.sub(name,1,6)=="group:" then
                isbase=1
             elseif j>1 or k>1 then
                for ii=1,999,1 do
@@ -1221,256 +712,257 @@
                         craftnumber=#crafts+1
                      end
                      local index=craftnumber
-                     local list="trylist"
                      if j>1 then
                         if #crafts==1 and index<=#crafts then
                            bestvalue=0
                            istest=0
-                           list="youneed"
                         elseif index>#crafts or bestvalue==0 then
                            index=bestcraft
                            bestvalue=0
                            istest=0
-                           list="youneed"
                         end
                      else
                         bestvalue=0
                         index=alternate
                         istest=0
-                        list="youneed"
                      end
                      local craft = crafts[index]
                      if craft~=nil and craft.type~="fuel" then
-                        local amount=count[k]
+                        local amount=count
                         if istest==0 then
-                           inv:set_stack("youneed", k,nil)
-                           count[k]=0
+                           list[name]=0
                            local output_count=ItemStack(craft.output):get_count()
                            if output_count~=1 and (j>1 or k>1) then
                               if amount/output_count==math.floor(amount/output_count) then
                                  amount=amount/output_count
                               else
                                  globalcount=globalcount*output_count
-                                 for ii=1,100,1 do
-                                    if count[ii]==nil then
-                                       ii=111
-                                    else
-                                       count[ii]=count[ii]*output_count
+                                 for _name,_amount in pairs(list) do
+                                    if tonumber(amount)>0 then
+                                       list[_name]=tonumber(_amount)*output_count
                                     end
                                  end
                               end
                            end
                         end
-                        if(amount>50) then
-                           amount=math.floor(amount/50+0.49)
-                           if list=="youneed" then
-                              list="overflow"
-                           end
+                        if istest==1 then
+                           list2=list
+                           list=nil
+                           list={}
+                           list=test
                         end
                         if craft.type == "cooking" then
-                           for ci=1,amount,1 do
-                              inv:add_item(list,ItemStack(craft.recipe))
+                           if list[craft.recipe]==nil then
+                              list[(craft.recipe)]={}
+                              list[(craft.recipe)]=amount
+                           else
+                              local add=amount+tonumber(list[(craft.recipe)])
+                              list[(craft.recipe)]=add
                            end
                         else
                            if craft.recipe[1] then
                               if (type(craft.recipe[1]) == "string") then
-                                 local item=ItemStack(craft.recipe[1])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[craft.recipe[1]]==nil then
+                                    list[(craft.recipe[1])]={}
+                                    list[(craft.recipe[1])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[1])])
+                                    list[(craft.recipe[1])]=add
                                  end
                               else
                                  if craft.recipe[1][1] then
-                                    local item=ItemStack(craft.recipe[1][1])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[1][1])]==nil then
+                                       list[(craft.recipe[1][1])]={}
+                                       list[(craft.recipe[1][1])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[1][1])])
+                                       list[(craft.recipe[1][1])]=add
                                     end
                                  end
                                  if craft.recipe[1][2] then
-                                    local item=ItemStack(craft.recipe[1][2])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[1][2])]==nil then
+                                       list[(craft.recipe[1][2])]={}
+                                       list[(craft.recipe[1][2])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[1][2])])
+                                       list[(craft.recipe[1][2])]=add
                                     end
                                  end
                                  if craft.recipe[1][3] then
-                                    local item=ItemStack(craft.recipe[1][3])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[1][3])]==nil then
+                                       list[(craft.recipe[1][3])]={}
+                                       list[(craft.recipe[1][3])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[1][3])])
+                                       list[(craft.recipe[1][3])]=add
                                     end
                                  end
                               end
                            end
                            if craft.recipe[2] then
                               if (type(craft.recipe[2]) == "string") then
-                                 local item=ItemStack(craft.recipe[2])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[2])]==nil then
+                                    list[(craft.recipe[2])]={}
+                                    list[(craft.recipe[2])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[2])])
+                                    list[(craft.recipe[2])]=add
                                  end
                               else
                                  if craft.recipe[2][1] then
-                                    local item=ItemStack(craft.recipe[2][1])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[2][1])]==nil then
+                                       list[(craft.recipe[2][1])]={}
+                                       list[(craft.recipe[2][1])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[2][1])])
+                                       list[(craft.recipe[2][1])]=add
                                     end
                                  end
                                  if craft.recipe[2][2] then
-                                    local item=ItemStack(craft.recipe[2][2])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[2][2])]==nil then
+                                       list[(craft.recipe[2][2])]={}
+                                       list[(craft.recipe[2][2])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[2][2])])
+                                       list[(craft.recipe[2][2])]=add
                                     end
                                  end
                                  if craft.recipe[2][3] then
-                                    local item=ItemStack(craft.recipe[2][3])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[2][3])]==nil then
+                                       list[(craft.recipe[2][3])]={}
+                                       list[(craft.recipe[2][3])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[2][3])])
+                                       list[(craft.recipe[2][3])]=add
                                     end
                                  end
                               end
                            end
                            if craft.recipe[3] then
                               if (type(craft.recipe[3]) == "string") then
-                                 local item=ItemStack(craft.recipe[3])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[3])]==nil then
+                                    list[(craft.recipe[3])]={}
+                                    list[(craft.recipe[3])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[3])])
+                                    list[(craft.recipe[3])]=add
                                  end
                               else
                                  if craft.recipe[3][1] then
-                                    local item=ItemStack(craft.recipe[3][1])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[3][1])]==nil then
+                                       list[(craft.recipe[3][1])]={}
+                                       list[(craft.recipe[3][1])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[3][1])])
+                                       list[(craft.recipe[3][1])]=add
                                     end
                                  end
                                  if craft.recipe[3][2] then
-                                    local item=ItemStack(craft.recipe[3][2])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[3][2])]==nil then
+                                       list[(craft.recipe[3][2])]={}
+                                       list[(craft.recipe[3][2])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[3][2])])
+                                       list[(craft.recipe[3][2])]=add
                                     end
                                  end
                                  if craft.recipe[3][3] then
-                                    local item=ItemStack(craft.recipe[3][3])
-                                    if item:get_stack_max()<10 then
-                                       item=ItemStack(item:get_name()..m)
-                                    end
-                                    for ci=1,amount,1 do
-                                       inv:add_item(list,item)
+                                    if list[(craft.recipe[3][3])]==nil then
+                                       list[(craft.recipe[3][3])]={}
+                                       list[(craft.recipe[3][3])]=amount
+                                    else
+                                       local add =amount+tonumber(list[(craft.recipe[3][3])])
+                                       list[(craft.recipe[3][3])]=add
                                     end
                                  end
                               end
                            end
                            if craft.recipe[4] then
                               if (type(craft.recipe[4]) == "string") then
-                                 local item=ItemStack(craft.recipe[4])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[4])]==nil then
+                                    list[(craft.recipe[4])]={}
+                                    list[(craft.recipe[4])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[4])])
+                                    list[(craft.recipe[4])]=add
                                  end
                               end
                            end
                            if craft.recipe[5] then
                               if (type(craft.recipe[5]) == "string") then
-                                 local item=ItemStack(craft.recipe[5])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[5])]==nil then
+                                    list[(craft.recipe[5])]={}
+                                    list[(craft.recipe[5])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[5])])
+                                    list[(craft.recipe[5])]=add
                                  end
                               end
                            end
                            if craft.recipe[6] then
                               if (type(craft.recipe[6]) == "string") then
-                                 local item=ItemStack(craft.recipe[6])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[6])]==nil then
+                                    list[(craft.recipe[6])]={}
+                                    list[(craft.recipe[6])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[6])])
+                                    list[(craft.recipe[6])]=add
                                  end
                               end
                            end
                            if craft.recipe[7] then
                               if (type(craft.recipe[7]) == "string") then
-                                 local item=ItemStack(craft.recipe[7])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[7])]==nil then
+                                    list[(craft.recipe[7])]={}
+                                    list[(craft.recipe[7])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[7])])
+                                    list[(craft.recipe[7])]=add
                                  end
                               end
                            end
                            if craft.recipe[8] then
                               if (type(craft.recipe[8]) == "string") then
-                                 local item=ItemStack(craft.recipe[8])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[8])]==nil then
+                                    list[(craft.recipe[8])]={}
+                                    list[(craft.recipe[8])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[8])])
+                                    list[(craft.recipe[8])]=add
                                  end
                               end
                            end
                            if craft.recipe[9] then
                               if (type(craft.recipe[9]) == "string") then
-                                 local item=ItemStack(craft.recipe[9])
-                                 if item:get_stack_max()<10 then
-                                    item=ItemStack(item:get_name()..m)
-                                 end
-                                 for ci=1,amount,1 do
-                                    inv:add_item(list,item)
+                                 if list[(craft.recipe[9])]==nil then
+                                    list[(craft.recipe[9])]={}
+                                    list[(craft.recipe[9])]=amount
+                                 else
+                                    local add =amount+tonumber(list[(craft.recipe[9])])
+                                    list[(craft.recipe[9])]=add
                                  end
                               end
                            end
                         end
+                        if istest==1 then
+                           test=list
+                           list=nil
+                           list={}
+                           list=list2
+                        end
+
                      end
    
+
                      if istest==1 then
-                        for jj=1,inv:get_size("trylist"),1 do
-                           local item=inv:get_stack("trylist", jj):get_name()
-                           inv:set_stack("trylist", jj, ItemStack(nil))
-                           if string.len(item)>4 and string.sub(item,string.len(item)-3)==m then
-                              item=string.sub(item,1,string.len(item)-4)
-                           end
-                           inv:set_stack("trylist", jj, ItemStack(item))
-                        end
                         local value=0
-                        for h=1,inv:get_size("trylist"),1 do
-                           if inv:get_stack("trylist", h)~=nil then
-                              local name=string.lower(inv:get_stack("trylist", h):get_name())
+                        local h=0
+                        for name,testcount in pairs(test) do
+                           h=h+1
+                           if h>888 then
+                           break
+                           end
+                           if testcount>0 then
                               if name.def==nil or (craft_guide.crafts[name]==nil
                                  and string.sub(name,1,8)=="technic:")
                                  then
@@ -1549,52 +1041,12 @@
                                  end
                               end
                            end
-                           inv:set_stack("trylist", h,ItemStack(nil))
                         end
                         if value<bestvalue then
                            bestcraft=index
                            bestvalue=value
                         end
                      else
-                        local overflow_index=1
-                        for h=1,inv:get_size("youneed"),1 do
-                           if inv:get_stack("youneed", h)~=nil and inv:get_stack("youneed", h):get_name()~=nil
-                              and inv:get_stack("youneed", h):get_name()~="" then
-                              if count[h]==nil or count[h]==0 then
-                                 count[h]=inv:get_stack("youneed", h):get_count()
-                              else
-                                 count[h]=count[h]+(inv:get_stack("youneed", h):get_count()-1)
-                              end
-                              inv:set_stack("youneed", h,ItemStack(inv:get_stack("youneed", h):get_name()))
-                           else
-                              if overflow_index==0 or inv:get_stack("overflow", overflow_index)==nil
-                                 or inv:get_stack("overflow", overflow_index):get_name()==nil
-                                 or inv:get_stack("overflow", overflow_index):get_name()==""
-                                 then
-                                    overflow_index=0
-                              else
-                                 local additem=inv:get_stack("overflow",overflow_index):get_name()
-                                 count[h]=inv:get_stack("overflow", overflow_index):get_count()*50
-                                 inv:set_stack("youneed", h, ItemStack(additem))
-                                 inv:set_stack("overflow", overflow_index,ItemStack(nil))
-                                 overflow_index=overflow_index+1
-                              end
-                           end
-                        end
-                        local size=inv:get_size("youneed")
-                        for jjj=1,size,1 do
-                           local item1=inv:get_stack("youneed", jjj):get_name()
-                           if item1~=nil then
-                              for jj=jjj+1,size,1 do
-                                 local item2=inv:get_stack("youneed", jj):get_name()
-                                 if item1==item2 and count[jjj]~=nil and count[jj]~=nil then
-                                    count[jjj]=count[jjj]+count[jj]
-                                    count[jj]=0
-                                    inv:set_stack("youneed", jj,ItemStack(nil))
-                                 end
-                              end
-                           end
-                        end
                         craftnumber=999
                         break
                      end
@@ -1607,69 +1059,54 @@
          end
       end
    end
-   local itemlist=""
-   local size=inv:get_size("youneed")
-   for jjj=1,size,1 do
-      local item1=inv:get_stack("youneed", jjj):get_name()
-      if item1~=nil then
-         for jj=jjj+1,size,1 do
-            local item2=inv:get_stack("youneed", jj):get_name()
-            if item1==item2 and count[jjj]~=nil and count[jj]~=nil then
-               count[jjj]=count[jjj]+count[jj]
-               count[jj]=0
-               inv:set_stack("youneed", jj,ItemStack(nil))
-            end
-         end
-      end
-   end
-   for jj=1,inv:get_size("youneed"),1 do
-      local item=inv:get_stack("youneed", jj):get_name()
-      inv:set_stack("youneed", jj, ItemStack(nil))
-      if string.len(item)>4 and string.sub(item,string.len(item)-3)==m then
-         item=string.sub(item,1,string.len(item)-4)
-      end
-      inv:add_item("youneed", ItemStack(item))
-   end
-   for jjj=1,55,1 do
-      if count[jjj]~=nil then
-         if count[jjj]==0 then
-            for jj=jjj+1,55,1 do
-               if count[jj]~=nil and count[jj]~=0 then
-                  count[jjj]=count[jj]
-                  count[jj]=0
-                  break
+   local jj=1
+   local duplicate=0
+   for name,amount in pairs(list) do
+      local count=tonumber(amount)
+      if name~=nil and count>0 and string.lower(name)~=string.upper(name) then
+         local lower=string.lower(name)
+         if craft_guide.you_need_list[lower]~=nil and craft_guide.you_need_list[lower]>0 then
+            craft_guide.you_need_list[lower]=count+craft_guide.you_need_list[lower]
+         else
+            inv:add_item("youneed", lower)
+            if inv:get_stack("youneed",jj)==nil or inv:get_stack("youneed",jj):get_name()=="" then
+               for jjj=1,jj,1 do
+                  if inv:get_stack("youneed",jjj):get_count()>1 then
+                     local alias=string.lower(inv:get_stack("youneed",jjj):get_name())
+                     craft_guide.you_need_list[alias]=craft_guide.you_need_list[alias]+count
+                     inv:set_stack("youneed",jjj,alias)
+
+                  end
+               end
+                     inv:set_stack("youneed",jj,ItemStack(nil))
+                     duplicate=1
+                     list[lower]=0
+
+            elseif string.lower(inv:get_stack("youneed",jj):get_name())~=lower then
+               local alias=string.lower(inv:get_stack("youneed",jj):get_name())
+               if list[alias]==nil then
+                  craft_guide.you_need_list[alias]={}
+                  craft_guide.you_need_list[alias]=count
+               else
+                  list[alias]=list[alias]+count
                end
+               list[lower]=0
+            else
+               craft_guide.you_need_list[lower]={}
+               craft_guide.you_need_list[lower]=count
             end
-         end
-      end
-   end
-   local xx=8.1
-   local yy=7.45
-   local widht=6
-   if meta:get_string("switch")=="youneed" and meta:get_string("poslist")=="up" then
-      xx=0.1
-      yy=1.45
-      widht=14
-   end
-   for jj=1,inv:get_size("youneed"),1 do
-      if count[jj]==nil then
-         jj=111
-         break
-      else
-         if count[jj]>0 then
-            local cnt=math.floor(((count[jj])/globalcount)*1000+0.49)/1000
-            if cnt>1000 then
-               cnt=math.floor(cnt+0.49)
-            elseif cnt>100 then
-               cnt=math.floor(cnt*10+0.49)/10
-            elseif cnt>10 then
-               cnt=math.floor(cnt*100+0.49)/100
+            if duplicate==0 then
+               jj=jj+1
+            else
+               duplicate=0
+            end
+            if jj>inv:get_size("youneed") then
+               break
             end
-            itemlist=itemlist.."label["..tostring(xx+((jj-1)%widht))..","..tostring(yy+math.floor((jj-1)/widht))..";"..tostring(cnt).."]"
          end
       end
    end
-   meta:set_string("amounts",itemlist)
+   meta:set_string("globalcount",tostring(globalcount))
    meta:set_string("formspec",craft_guide.get_craft_guide_formspec(meta))
 end
 


Thanks for your hard work and awesome code!


Thanks, it was really nice to hear that you like my modifications.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Tue Dec 16, 2014 23:20

Hi Miner59,

It would be a lot easier if you sign up to github. It's really easy to create pull requests. Much easier than making zipballs and much easier than me applying diffs then committing.
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Wed Dec 24, 2014 16:44

Hi cornernote,
finally I made my pull request.
I added support for recipes for the machines from technic mod now.

Is it ok that I made one pull request with all my changes?
I can split if you want but I think this only make problems and much work.
Maybe I will test myself a bit more over christmas, and then you can make a new version of craft guide with my changes. Would be my suggestion...

Ok, I don't want to waste more time with minetest today, Happy Christmas and bye.
Attachments
guide.zip
my newest version
(18.9 KiB) Downloaded 600 times
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Thu Dec 25, 2014 11:49

Ok, cornernote merged my changes in craft guide now.

I think I write a summary what is new:

- imagebuttons for items which represent a group of items in craft recipes instead of "unknown item"

- "you need" list, shows a summary of all items needed to craft an item. Should always return exact numbers now.
You can switch between "you need" and bookmarks" with " >> " button. "^"-button moves "you need" list up, and it
replaces the main list where you can select the item from. Please test yourself ingame.

- now you can switch directly from last page to first page and reverse

- it shows now when you can use an item as fuel and shows the burntime. Items with no other craft recipe other then
the one of type "fuel" aren't shown. (because this would include things like tree trunks or saplings)

- it shows the registered craft recipes for Grinder, Compressor, Extractor, Alloy Furnace and Centrifuge from technic mod


And a tip for searching a special item:
The items in the main list are sorted alphabetically, including the prefix. So items of one mod are usually together because they have the same prefix. So you should better be able to find a special item
Also there is a search function, you can use this if you know how the item is called which you search.
If you know that the item is in a group, you can search for "group:wood", or other groups like "group:soil" or "group:cracky".
Additionally if you enter "*" in search field it shows items without craft recipe, too.

Download: on github, see first post


Edit: here are some screenshots:


Image


Image
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Topywo » Thu Dec 25, 2014 16:16

Thanks for all the work!
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Thu Dec 25, 2014 17:47

This mod gets more and more awesome!

A big “thumbs up” to all contributors!
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Krock » Thu Dec 25, 2014 21:42

Interesting copper amount in image 1, bottom right.

I already missed those features - thank you!
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Fri Dec 26, 2014 00:19

Linuxdirk wrote:Hooray for using Vim. g, g, =, G … And BAM, everything is indented properly :)


I did that, gg=G ... it did a very poor job. seems it doesn't see "end" as a reason to un-indent.

Is there a plugin or something I have to use to get vim to know lua?
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Nathan.S » Fri Dec 26, 2014 02:10

Excellent work guys, very glad to have a craft guide that works with groups and everything.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Fri Dec 26, 2014 14:06

cornernote wrote:I did that, gg=G ... it did a very poor job. seems it doesn't see "end" as a reason to un-indent.

Works properly here.

cornernote wrote:Is there a plugin or something I have to use to get vim to know lua?

Check your .vimrc for filetype plugin indent on being set and you have the Lua stuff installed.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
$ pacman -Ql vim-runtime | grep lua
vim-runtime /usr/share/vim/vim74/doc/if_lua.txt
vim-runtime /usr/share/vim/vim74/ftplugin/lua.vim
vim-runtime /usr/share/vim/vim74/indent/lua.vim
vim-runtime /usr/share/vim/vim74/syntax/lua.vim

Check your distribution’s documentation on how to list all files provided by a defined package and check if your distribution uses vim-runtime for providing the “base stuff” for vim.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Sat Dec 27, 2014 00:40

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
$ pacman -Ql vim-runtime | grep lua

no output

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
$ sudo apt-get install vim-runtime
vim-runtime is already the newest version.


Im using vim on ubuntu 14.04 lts.

I also found a Notepad++ plugin called "Indent by Fold", which seems to do the trick, although it doesnt correctly indent elseif.
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Sat Dec 27, 2014 11:44

cornernote wrote:Im using vim on ubuntu 14.04 lts.

I have no idea how that works on Ubuntu. Maybe search for Vim plugins in the repository. The plugins are very common and should be installed by default when installing vim-common imho. Maybe there is an additional package providing the filetype plugins.

Is apt-get capable of listing all files provided by a defined package, like pacman -Ql does on Arch Linux?

Maybe manually search for the files. Since Debian alters almost all packages and Ubuntu takes most packages from Debian and alters them, too (at least they did the last time I checked) I can’t help you here, sorry :)
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Sokomine » Mon Dec 29, 2014 05:48

Miner59 wrote:- "you need" list

That's something I've been missing for some time, especially when dealing with complex technic receipes and trying to determine a suitable price for them in a shop.

This nice new feature might also be extremly intresting for a new machine. It'd list the indigrents, and when everything has been inserted, the machine would start crafting. Surplus intermediate products could be put into the output slots as well.

It would also be great if this new feature could be available for unified_inventory and other craft-guide mods out there.
A list of my mods can be found here.
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Wed Dec 31, 2014 10:27

Hi Sokomine,

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

This nice new feature might also be extremly intresting for a new machine. It'd list the indigrents, and when everything has been inserted, the machine would start crafting. Surplus intermediate products could be put into the output slots as well.



Ok, a new powerful machine will always be good.
But I thought better about it and don't found a good item where it could be really useful to craft it directly from basic items. If you tell this machine for example to make glass panes directly, and you later need glass blocks you don't have any. And machines like a battery box for example I build maybe one, not many of it.
Maybe it is useful for factory-like autocrafting, but I don't have experience with this kind of playing minetest.xD

And there are always open questions, like what to do when a item has alternate recipes or what to do if an item needs to be cooked first, you need add the fuel needed, too, I think.


I thought maybe a better machine is a kind of slot machine for selling items, which calculates automatically a good price. You just put the items you want to sell in the machine. The machine then knows that this item needs for example 10 copper and 5 wood to craft. When a copper costs 20 coins and a wood 1 coin, the item will be selled for
205 coins, for example. Maybe make it 5% expensiver for every crafting step needed.
You maybe can then set a option, if prices should be normal, cheap or expensive.
So a machine which makes selling things a bit easier.


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
It would also be great if this new feature could be available for unified_inventory and other craft-guide mods out there.


Yeah if a author of one of the other craft-guide mods is interested, they can use the code. I think cornernote will not be against it, too.
If they ask, I will help them when needed.
 

Nomis
Member
 
Posts: 26
Joined: Tue Dec 02, 2014 23:30

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Nomis » Tue Mar 03, 2015 03:03

Could do with this on Clip
 

wappo
New member
 
Posts: 5
Joined: Sun Mar 22, 2015 02:29

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by wappo » Tue Mar 24, 2015 05:58

Minetest 4.12
Do not show all items.
No work, Next Page button.
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Mon May 18, 2015 17:25

Hi,
I added new features to craft guide:

1. Prepare to craft:
You can copy the craft recipe directly in your crafting grid, if you have enough items for it.
You can choose to craft 1, 10 or 99 items. If you don't have enough items as you want to craft, maximum amount is moved to crafting grid.
I don't think it is a too big help for players, it just saves you from moving every item to craft grid yourself, and then most time you forgot the exact crafting recipe and have to look in craft guide again. But if you don't want it in craft guide please say your opinion.

2. Locked craft guide+locked craft pc:
This look exactly the same like a normal craft guide or craft pc, except they have a button to lock the craft guide in the current state. I think it is very useful on server, because you can inform player about crafting recipes of items and other players can't mess it up again when they show craft recipes of other items.
But players can still look other craft recipes, the craft guide just restores to the locked state when they exit the formspec again. Locked craft guide still need a protection from a protection mod, where it gets placed. It isn't protected from digging it by itself.
It is crafted with a craft guide or a craft pc and an iron ingot.

I think I will make a pull request for feature 1 and I'm unsure with feature 2 because it seems only useful for server owners. If you interested I added a download to this post with all 2 features added.


Screenshot:

Image


Edit: removed download
Last edited by Miner59 on Sat May 23, 2015 11:55, edited 1 time in total.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Sokomine » Thu May 21, 2015 14:40

Miner59 wrote:1. Prepare to craft:
You can copy the craft recipe directly in your crafting grid, if you have enough items for it.

It's good to see that that feature of unified_inventory is supported by this mod as well. It's very practical and helps a lot..

Miner59 wrote:2. Locked craft guide+locked craft pc:

Such a feature would be needed on servers that *don't* have a craft guide installed. But then, this one won't be installed either. It could still be useful in some situations.
A list of my mods can be found here.
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Sat May 23, 2015 12:30

Hi,
I completely forgot to handle tool wear and item metadata. So everytime you copy a crafting recipe all your tools get repaired. Should be fixed soon, pull request is waiting.

Such a feature would be needed on servers that *don't* have a craft guide installed. But then, this one won't be installed either. It could still be useful in some situations.


I think it is very well needed on servers with a normal crafting guide available sometimes.
I wrote the code to lock craft guides not especially because I want to make a pull request with it, but because I wanted to build a information house where players can look what mods and items are available on the server.
I placed the item I want to show, and above it a locked craft guide, where I searched for the recipe for this item.
Without a locked version this would not have been possible, because the next player who came would have choosen to show a different recipe.

Another usage could be in your house, which is protected but other people can look around inside.
If you have a craft guide in your house then other people often switch to other pages and add or delete bookmarks.
For me this is no real problem, I often have to laugh a bit because most time people (especially noobs) lock for diamonds, diamond sword and you have it added to your bookmarks.


Here is a download with a fixed version with copy- craft recipe buttons and locked craft guides and craft PCs:
Attachments
minetest-craft_guide-master.zip
craft_guide.zip
(22.74 KiB) Downloaded 588 times
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Sokomine » Sat May 23, 2015 14:44

Miner59 wrote:I wrote the code to lock craft guides not especially because I want to make a pull request with it, but because I wanted to build a information house where players can look what mods and items are available on the server.
I placed the item I want to show, and above it a locked craft guide, where I searched for the recipe for this item.

Yes, that's certainly a valid application. I've built crafting schools on more than one server (Redcrab, VE-Realtest). Most servers by now do have too many diffrent blocks for showing them all in one place.
A list of my mods can be found here.
 

amadin
Member
 
Posts: 471
Joined: Tue Jun 16, 2015 16:23
GitHub: Amadin

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by amadin » Fri Jul 03, 2015 20:21

I not see any items in "Craft guide" but they present in game and i can craft they. No errors in log, name of directory is /mods/minetest-craft_guide-master/, downloaded here https://github.com/cornernote/minetest-craft_guide, 0.4.12. What I did wrong?
Image
I found an answer for my question - if crafts are not loading then it is probably because craft_guide is loaded after the other crafts. To fix this simply create a depends.txt in the module in question, and add the contents craft_guide. EG: crafts from default mod are not available - create games/minetest_game/default/depends.txt with the contents: craft_guide
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 42 guests

cron