sunflower.lua 4.3 KB

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