barley.lua 3.0 KB

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