rice.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. local S = farming.intllib
  2. -- rice
  3. minetest.register_craftitem("farming:rice", {
  4. description = S("Rice"),
  5. inventory_image = "farming_rice.png",
  6. groups = {seed = 2, food_rice = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:rice_1")
  9. end
  10. })
  11. -- replacement for rice seeds that was removed
  12. minetest.register_alias("farming:seed_rice", "farming:rice")
  13. minetest.register_craftitem("farming:rice_bread", {
  14. description = S("Rice Bread"),
  15. inventory_image = "farming_rice_bread.png",
  16. on_use = minetest.item_eat(5),
  17. groups = {food_rice_bread = 1, flammable = 2}
  18. })
  19. minetest.register_craftitem("farming:rice_flour", {
  20. description = S("Rice Flour"),
  21. inventory_image = "farming_rice_flour.png",
  22. groups = {food_rice_flour = 1, flammable = 1}
  23. })
  24. minetest.register_craft({
  25. output = "farming:rice_flour",
  26. recipe = {
  27. {"farming:rice", "farming:rice", "farming:rice"},
  28. {"farming:rice", "farming:mortar_pestle", ""}
  29. },
  30. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  31. })
  32. minetest.register_craft({
  33. type = "cooking",
  34. cooktime = 15,
  35. output = "farming:rice_bread",
  36. recipe = "farming:rice_flour"
  37. })
  38. -- rice definition
  39. local def = {
  40. drawtype = "plantlike",
  41. tiles = {"farming_rice_1.png"},
  42. paramtype = "light",
  43. paramtype2 = "meshoptions",
  44. place_param2 = 3,
  45. sunlight_propagates = true,
  46. walkable = false,
  47. buildable_to = true,
  48. drop = "",
  49. selection_box = farming.select,
  50. groups = {
  51. snappy = 3, flammable = 4, plant = 1, attached_node = 1,
  52. not_in_creative_inventory = 1, growing = 1
  53. },
  54. sounds = default.node_sound_leaves_defaults()
  55. }
  56. -- stage 1
  57. minetest.register_node("farming:rice_1", table.copy(def))
  58. -- stage 2
  59. def.tiles = {"farming_rice_2.png"}
  60. minetest.register_node("farming:rice_2", table.copy(def))
  61. -- stage 3
  62. def.tiles = {"farming_rice_3.png"}
  63. minetest.register_node("farming:rice_3", table.copy(def))
  64. -- stage 4
  65. def.tiles = {"farming_rice_4.png"}
  66. minetest.register_node("farming:rice_4", table.copy(def))
  67. -- stage 5
  68. def.tiles = {"farming_rice_5.png"}
  69. def.drop = {
  70. items = {
  71. {items = {"farming:rice"}, rarity = 2}
  72. }
  73. }
  74. minetest.register_node("farming:rice_5", table.copy(def))
  75. -- stage 6
  76. def.tiles = {"farming_rice_6.png"}
  77. def.drop = {
  78. items = {
  79. {items = {"farming:rice"}, rarity = 2}
  80. }
  81. }
  82. minetest.register_node("farming:rice_6", table.copy(def))
  83. -- stage 7
  84. def.tiles = {"farming_rice_7.png"}
  85. def.drop = {
  86. items = {
  87. {items = {"farming:rice"}, rarity = 1},
  88. {items = {"farming:rice"}, rarity = 3}
  89. }
  90. }
  91. minetest.register_node("farming:rice_7", table.copy(def))
  92. -- stage 8 (final)
  93. def.tiles = {"farming_rice_8.png"}
  94. def.groups.growing = nil
  95. def.drop = {
  96. items = {
  97. {items = {"farming:rice 2"}, rarity = 1},
  98. {items = {"farming:rice"}, rarity = 2}
  99. }
  100. }
  101. minetest.register_node("farming:rice_8", table.copy(def))
  102. -- add to registered_plants
  103. farming.registered_plants["farming:rice"] = {
  104. crop = "farming:rice",
  105. seed = "farming:rice",
  106. minlight = farming.min_light,
  107. maxlight = farming.max_light,
  108. steps = 8
  109. }
  110. -- fuels
  111. minetest.register_craft({
  112. type = "fuel",
  113. recipe = "farming:rice",
  114. burntime = 1
  115. })
  116. minetest.register_craft({
  117. type = "fuel",
  118. recipe = "farming:rice_bread",
  119. burntime = 1
  120. })