rice.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. local S = farming.translate
  2. -- rice seed
  3. minetest.register_node("farming:seed_rice", {
  4. description = S("Rice Seed"),
  5. tiles = {"farming_rice_seed.png"},
  6. inventory_image = "farming_rice_seed.png",
  7. wield_image = "farming_rice_seed.png",
  8. drawtype = "signlike",
  9. groups = {
  10. compostability = 48, seed = 1, snappy = 3, attached_node = 1,
  11. flammable = 4, growing = 1
  12. },
  13. paramtype = "light",
  14. paramtype2 = "wallmounted",
  15. walkable = false,
  16. sunlight_propagates = true,
  17. selection_box = farming.select,
  18. next_plant = "farming:rice_1",
  19. on_place = function(itemstack, placer, pointed_thing)
  20. return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_rice")
  21. end
  22. })
  23. -- rice
  24. minetest.register_craftitem("farming:rice", {
  25. description = S("Rice"),
  26. inventory_image = "farming_rice.png",
  27. groups = {seed = 2, compostability = 65, food_rice = 1, flammable = 2},
  28. })
  29. -- dry rice seed to give edible rice
  30. minetest.register_craft({
  31. type = "cooking",
  32. cooktime = 1,
  33. output = "farming:rice",
  34. recipe = "farming:seed_rice"
  35. })
  36. -- rice flour and bread
  37. minetest.register_craftitem("farming:rice_bread", {
  38. description = S("Rice Bread"),
  39. inventory_image = "farming_rice_bread.png",
  40. on_use = minetest.item_eat(5),
  41. groups = {compostability = 65, food_rice_bread = 1, flammable = 2}
  42. })
  43. minetest.register_craftitem("farming:rice_flour", {
  44. description = S("Rice Flour"),
  45. inventory_image = "farming_rice_flour.png",
  46. groups = {compostability = 65, food_rice_flour = 1, flammable = 1}
  47. })
  48. local tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  49. minetest.register_craft({
  50. output = "farming:rice_flour",
  51. recipe = {
  52. {"farming:rice", "farming:rice", "farming:rice"},
  53. {"farming:rice", tmp, ""}
  54. },
  55. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  56. })
  57. minetest.register_craft({
  58. type = "cooking",
  59. cooktime = 15,
  60. output = "farming:rice_bread",
  61. recipe = "farming:rice_flour"
  62. })
  63. -- rice definition
  64. local def = {
  65. drawtype = "plantlike",
  66. tiles = {"farming_rice_1.png"},
  67. paramtype = "light",
  68. paramtype2 = "meshoptions",
  69. place_param2 = 3,
  70. sunlight_propagates = true,
  71. walkable = false,
  72. buildable_to = true,
  73. drop = "",
  74. waving = 1,
  75. selection_box = farming.select,
  76. groups = {
  77. handy = 1, snappy = 3, flammable = 4, plant = 1, attached_node = 1,
  78. not_in_creative_inventory = 1, growing = 1
  79. },
  80. sounds = farming.sounds.node_sound_leaves_defaults()
  81. }
  82. -- stage 1
  83. minetest.register_node("farming:rice_1", table.copy(def))
  84. -- stage 2
  85. def.tiles = {"farming_rice_2.png"}
  86. minetest.register_node("farming:rice_2", table.copy(def))
  87. -- stage 3
  88. def.tiles = {"farming_rice_3.png"}
  89. minetest.register_node("farming:rice_3", table.copy(def))
  90. -- stage 4
  91. def.tiles = {"farming_rice_4.png"}
  92. minetest.register_node("farming:rice_4", table.copy(def))
  93. -- stage 5
  94. def.tiles = {"farming_rice_5.png"}
  95. def.drop = {
  96. items = {
  97. {items = {"farming:rice"}, rarity = 2}
  98. }
  99. }
  100. minetest.register_node("farming:rice_5", table.copy(def))
  101. -- stage 6
  102. def.tiles = {"farming_rice_6.png"}
  103. def.drop = {
  104. items = {
  105. {items = {"farming:rice"}, rarity = 2}
  106. }
  107. }
  108. minetest.register_node("farming:rice_6", table.copy(def))
  109. -- stage 7
  110. def.tiles = {"farming_rice_7.png"}
  111. def.drop = {
  112. items = {
  113. {items = {"farming:seed_rice"}, rarity = 1},
  114. {items = {"farming:seed_rice"}, rarity = 2},
  115. {items = {"farming:seed_rice"}, rarity = 3}
  116. }
  117. }
  118. minetest.register_node("farming:rice_7", table.copy(def))
  119. -- stage 8 (final)
  120. def.tiles = {"farming_rice_8.png"}
  121. def.groups.growing = nil
  122. def.selection_box = farming.select_final
  123. def.drop = {
  124. items = {
  125. {items = {"farming:seed_rice 2"}, rarity = 1},
  126. {items = {"farming:seed_rice 2"}, rarity = 2},
  127. {items = {"farming:seed_rice"}, rarity = 3}
  128. }
  129. }
  130. minetest.register_node("farming:rice_8", table.copy(def))
  131. -- add to registered_plants
  132. farming.registered_plants["farming:rice"] = {
  133. crop = "farming:rice",
  134. seed = "farming:seed_rice",
  135. minlight = farming.min_light,
  136. maxlight = farming.max_light,
  137. steps = 8
  138. }
  139. -- fuels
  140. minetest.register_craft({
  141. type = "fuel",
  142. recipe = "farming:rice",
  143. burntime = 1
  144. })
  145. minetest.register_craft({
  146. type = "fuel",
  147. recipe = "farming:rice_bread",
  148. burntime = 1
  149. })