barley.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. local S = farming.translate
  2. -- barley seeds
  3. minetest.register_node("farming:seed_barley", {
  4. description = S("Barley Seed"),
  5. tiles = {"farming_barley_seed.png"},
  6. inventory_image = "farming_barley_seed.png",
  7. wield_image = "farming_barley_seed.png",
  8. drawtype = "signlike",
  9. groups = {compostability = 48, seed = 1, snappy = 3, attached_node = 1, growing = 1},
  10. paramtype = "light",
  11. paramtype2 = "wallmounted",
  12. walkable = false,
  13. sunlight_propagates = true,
  14. next_plant = "farming:barley_1",
  15. selection_box = farming.select,
  16. on_place = function(itemstack, placer, pointed_thing)
  17. return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_barley")
  18. end
  19. })
  20. -- harvested barley
  21. minetest.register_craftitem("farming:barley", {
  22. description = S("Barley"),
  23. inventory_image = "farming_barley.png",
  24. groups = {compostability = 65, food_barley = 1, flammable = 2}
  25. })
  26. local tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  27. -- flour
  28. minetest.register_craft({
  29. output = "farming:flour",
  30. recipe = {
  31. {"farming:barley", "farming:barley", "farming:barley"},
  32. {"farming:barley", tmp, ""}
  33. },
  34. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  35. })
  36. -- barley definition
  37. local def = {
  38. drawtype = "plantlike",
  39. tiles = {"farming_barley_1.png"},
  40. paramtype = "light",
  41. paramtype2 = "meshoptions",
  42. place_param2 = 3,
  43. sunlight_propagates = true,
  44. walkable = false,
  45. buildable_to = true,
  46. drop = "",
  47. waving = 1,
  48. selection_box = farming.select,
  49. groups = {
  50. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  51. not_in_creative_inventory = 1, growing = 1
  52. },
  53. sounds = farming.sounds.node_sound_leaves_defaults()
  54. }
  55. -- stage 1
  56. minetest.register_node("farming:barley_1", table.copy(def))
  57. -- stage 2
  58. def.tiles = {"farming_barley_2.png"}
  59. minetest.register_node("farming:barley_2", table.copy(def))
  60. -- stage 3
  61. def.tiles = {"farming_barley_3.png"}
  62. minetest.register_node("farming:barley_3", table.copy(def))
  63. -- stage 4
  64. def.tiles = {"farming_barley_4.png"}
  65. minetest.register_node("farming:barley_4", table.copy(def))
  66. -- stage 5
  67. def.tiles = {"farming_barley_5.png"}
  68. minetest.register_node("farming:barley_5", table.copy(def))
  69. -- stage 6
  70. def.tiles = {"farming_barley_6.png"}
  71. def.drop = {
  72. items = {
  73. {items = {"farming:barley"}, rarity = 2},
  74. {items = {"farming:seed_barley"}, rarity = 2}
  75. }
  76. }
  77. minetest.register_node("farming:barley_6", table.copy(def))
  78. -- stage 7
  79. def.tiles = {"farming_barley_7.png"}
  80. def.drop = {
  81. items = {
  82. {items = {"farming:barley"}, rarity = 2},
  83. {items = {"farming:seed_barley"}, rarity = 1}
  84. }
  85. }
  86. minetest.register_node("farming:barley_7", table.copy(def))
  87. -- stage 8 (final)
  88. def.tiles = {"farming_barley_8.png"}
  89. def.groups.growing = nil
  90. def.selection_box = farming.select_final
  91. def.drop = {
  92. items = {
  93. {items = {"farming:barley"}, rarity = 1},
  94. {items = {"farming:barley"}, rarity = 3},
  95. {items = {"farming:seed_barley"}, rarity = 1},
  96. {items = {"farming:seed_barley"}, rarity = 3}
  97. }
  98. }
  99. minetest.register_node("farming:barley_8", table.copy(def))
  100. -- add to registered_plants
  101. farming.registered_plants["farming:barley"] = {
  102. crop = "farming:barley",
  103. seed = "farming:seed_barley",
  104. minlight = farming.min_light,
  105. maxlight = farming.max_light,
  106. steps = 8
  107. }
  108. -- Fuel
  109. minetest.register_craft({
  110. type = "fuel",
  111. recipe = "farming:barley",
  112. burntime = 1
  113. })