brewing.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. function lottinventory.get_brewing_formspec(player, page)
  2. if page=="brews" then
  3. return "size[8,5.5]"
  4. .."background[5,5;1,1;craft_formbg.png;true]"
  5. .."label[0,0;Book of Brewing]"
  6. .."button_exit[6,0;2,0.5;quit;Exit]"
  7. .."image_button[7,1;1,1;zcg_next.png;brews2;;false;false;zcg_next_press.png]"
  8. .."image[6,1;1,1;zcg_previous_inactive.png]"
  9. --First
  10. .."label[1,2.2; Wine]"
  11. .."item_image_button[4,2;1,1;lottpotion:drinking_glass_water;zcg:vessels:glass_water;]"
  12. .."item_image_button[5,2;1,1;lottfarming:berries;zcg:berries;5]"
  13. .."image[6,1;1,1;zcg_craft_arrow.png]"
  14. .."item_image_button[7,2;1,1;lottpotion:wine;zcg:wine;]"
  15. --Second
  16. .."label[1,3.2; Beer]"
  17. .."item_image_button[4,3;1,1;lottpotion:drinking_glass_water;zcg:drinking_glass_water;]"
  18. .."item_image_button[5,3;1,1;farming:wheat;zcg:wheat;3]"
  19. .."image[6,3;1,1;zcg_craft_arrow.png]"
  20. .."item_image_button[7,3;1,1;lottpotion:beer;zcg:beer;]"
  21. --Third
  22. .."label[1,4.2; Mead]"
  23. .."item_image_button[4,4;1,1;lottpotion:drinking_glass_water;zcg:drinking_glass_water;]"
  24. .."item_image_button[5,4;1,1;lottplants:honey;zcg:honey;6]"
  25. .."image[6,4;1,1;zcg_craft_arrow.png]"
  26. .."item_image_button[7,4;1,1;lottpotion:mead;zcg:mead;]"
  27. end
  28. if page=="brews2" then
  29. return "size[8,5.5]"
  30. .."background[5,5;1,1;craft_formbg.png;true]"
  31. .."label[0,0;Book of Brewing]"
  32. .."button_exit[6,0;2,0.5;quit;Exit]"
  33. .."image[7,1;1,1;zcg_next_inactive.png]"
  34. .."image_button[6,1;1,1;zcg_previous.png;brews;;false;false;zcg_previous_press.png]"
  35. --First
  36. .."label[1,2.2; Cider]"
  37. .."item_image_button[4,2;1,1;lottpotion:drinking_glass_water;zcg:drinking_glass_water;]"
  38. .."item_image_button[5,2;1,1;default:apple;zcg:apple; 5]"
  39. .."image[6,2;1,1;zcg_craft_arrow.png]"
  40. .."item_image_button[7,2;1,1;lottpotion:cider;zcg:cider;]"
  41. --Second
  42. .."label[1,3.2; Ale]"
  43. .."item_image_button[4,3;1,1;lottpotion:drinking_glass_water;zcg:drinking_glass_water;]"
  44. .."item_image_button[5,3;1,1;lottfarming:barley;zcg:barley;6]"
  45. .."image[6,3;1,1;zcg_craft_arrow.png]"
  46. .."item_image_button[7,3;1,1;lottpotion:ale;zcg:ale;]"
  47. --Third
  48. --.."label[1,3.2; Name (Method:Method)]"
  49. --.."item_image_button[4,3;1,1;modname:itemname;zcg:itemname;]"
  50. --.."item_image_button[5,3;1,1;modname:itemname;zcg:itemname;number]"
  51. --.."image[6,3;1,1;zcg_craft_arrow.png]"
  52. --.."item_image_button[7,3;1,1;modname:output;zcg:output;]"
  53. end
  54. end
  55. minetest.register_on_player_receive_fields(function(player, formname, fields)
  56. local pn = player:get_player_name()
  57. if fields.brews then
  58. minetest.show_formspec(pn, "brews",
  59. lottinventory.get_brewing_formspec(player, "brews"))
  60. end
  61. if fields.brews2 then
  62. minetest.show_formspec(pn, "brews",
  63. lottinventory.get_brewing_formspec(player, "brews2"))
  64. end
  65. end)
  66. minetest.register_tool("lottinventory:brewing_book",{
  67. description = "Book of Brewing",
  68. inventory_image = "lottinventory_brewing_book.png",
  69. wield_image = "",
  70. wield_scale = {x=1,y=1,z=1},
  71. stack_max = 1,
  72. groups = {cook_crafts=1, book=1},
  73. tool_capabilities = {
  74. full_punch_interval = 1.0,
  75. max_drop_level=0,
  76. groupcaps={
  77. fleshy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  78. snappy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  79. choppy={times={[3]=0.90}, maxlevel=0}
  80. }
  81. },
  82. on_place = function(itemstack, player, pointed_thing)
  83. minetest.show_formspec(player:get_player_name(), "brews",
  84. lottinventory.get_brewing_formspec(player, "brews"))
  85. end,
  86. on_use = function(itemstack, player, pointed_thing)
  87. minetest.show_formspec(player:get_player_name(), "brews",
  88. lottinventory.get_brewing_formspec(player, "brews"))
  89. end,
  90. })