sunflower.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. local S = farming.intllib
  2. -- sunflower
  3. minetest.register_craftitem("farming:sunflower", {
  4. description = S("Sunflower"),
  5. inventory_image = "farming_sunflower.png",
  6. groups = {flammable = 2}
  7. })
  8. -- sunflower seeds
  9. minetest.register_craftitem("farming:sunflower_seeds", {
  10. description = S("Sunflower Seeds"),
  11. inventory_image = "farming_sunflower_seeds.png",
  12. groups = {seed = 2, food_sunflower_seeds = 1, flammable = 2},
  13. on_place = function(itemstack, placer, pointed_thing)
  14. return farming.place_seed(itemstack, placer, pointed_thing, "farming:sunflower_1")
  15. end
  16. })
  17. minetest.register_craft({
  18. output = "farming:sunflower_seeds 5",
  19. recipe = {{"farming:sunflower"}}
  20. })
  21. -- sunflower seeds (toasted)
  22. minetest.register_craftitem("farming:sunflower_seeds_toasted", {
  23. description = S("Toasted Sunflower Seeds"),
  24. inventory_image = "farming_sunflower_seeds_toasted.png",
  25. groups = {food_sunflower_seeds_toasted = 1, flammable = 2},
  26. on_use = minetest.item_eat(1)
  27. })
  28. minetest.register_craft({
  29. type = "cooking",
  30. cooktime = 10,
  31. output = "farming:sunflower_seeds_toasted",
  32. recipe = "farming:sunflower_seeds"
  33. })
  34. -- sunflower oil
  35. minetest.register_node("farming:sunflower_oil", {
  36. description = S("Bottle of Sunflower Oil"),
  37. drawtype = "plantlike",
  38. tiles = {"farming_sunflower_oil.png"},
  39. inventory_image = "farming_sunflower_oil.png",
  40. wield_image = "farming_sunflower_oil.png",
  41. paramtype = "light",
  42. is_ground_content = false,
  43. walkable = false,
  44. selection_box = {
  45. type = "fixed",
  46. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  47. },
  48. groups = {
  49. food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1,
  50. flammable = 2
  51. },
  52. sounds = default.node_sound_glass_defaults()
  53. })
  54. minetest.register_craft( {
  55. output = "farming:sunflower_oil",
  56. recipe = {
  57. {"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
  58. {"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
  59. {"group:food_sunflower_seeds", "vessels:glass_bottle", "group:food_sunflower_seeds"}
  60. }
  61. })
  62. minetest.register_craft({
  63. type = "fuel",
  64. recipe = "farming:sunflower_oil",
  65. burntime = 30,
  66. replacements = {{"farming:sunflower_oil", "vessels:glass_bottle"}}
  67. })
  68. -- sunflower seed bread
  69. minetest.register_craftitem("farming:sunflower_bread", {
  70. description = S("Sunflower Seed Bread"),
  71. inventory_image = "farming_sunflower_bread.png",
  72. on_use = minetest.item_eat(8),
  73. groups = {food_bread = 1, flammable = 2}
  74. })
  75. minetest.register_craftitem("farming:sunflower_bread", {
  76. description = S("Sunflower Bread"),
  77. inventory_image = "farming_sunflower_bread.png"
  78. })
  79. minetest.register_craft({
  80. output = "farming:sunflower_bread",
  81. recipe = {{"group:food_sunflower_seeds_toasted", "group:food_bread", "group:food_sunflower_seeds_toasted"}}
  82. })
  83. -- sunflower definition
  84. local def = {
  85. drawtype = "plantlike",
  86. tiles = {"farming_sunflower_1.png"},
  87. paramtype = "light",
  88. sunlight_propagates = true,
  89. walkable = false,
  90. buildable_to = true,
  91. drop = "",
  92. selection_box = farming.select,
  93. groups = {
  94. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  95. not_in_creative_inventory = 1, growing = 1
  96. },
  97. sounds = default.node_sound_leaves_defaults()
  98. }
  99. -- stage 1
  100. minetest.register_node("farming:sunflower_1", table.copy(def))
  101. -- stage 2
  102. def.tiles = {"farming_sunflower_2.png"}
  103. minetest.register_node("farming:sunflower_2", table.copy(def))
  104. -- stage 3
  105. def.tiles = {"farming_sunflower_3.png"}
  106. minetest.register_node("farming:sunflower_3", table.copy(def))
  107. -- stage 4
  108. def.tiles = {"farming_sunflower_4.png"}
  109. minetest.register_node("farming:sunflower_4", table.copy(def))
  110. -- stage 5
  111. def.tiles = {"farming_sunflower_5.png"}
  112. minetest.register_node("farming:sunflower_5", table.copy(def))
  113. -- stage 6
  114. def.tiles = {"farming_sunflower_6.png"}
  115. def.visual_scale = 1.9
  116. minetest.register_node("farming:sunflower_6", table.copy(def))
  117. -- stage 7
  118. def.tiles = {"farming_sunflower_7.png"}
  119. minetest.register_node("farming:sunflower_7", table.copy(def))
  120. -- stage 8 (final)
  121. def.tiles = {"farming_sunflower_8.png"}
  122. def.groups.growing = nil
  123. def.drop = {
  124. items = {
  125. {items = {"farming:sunflower"}, rarity = 1},
  126. {items = {"farming:sunflower"}, rarity = 6}
  127. }
  128. }
  129. minetest.register_node("farming:sunflower_8", table.copy(def))
  130. -- add to registered_plants
  131. farming.registered_plants["farming:sunflower"] = {
  132. crop = "farming:sunflower",
  133. seed = "farming:sunflower_seeds",
  134. minlight = 14,
  135. maxlight = farming.max_light,
  136. steps = 8
  137. }