barley.lua 3.0 KB

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