sunflower.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. local S = farming.translate
  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_node("farming:seed_sunflower", {
  10. description = S("Sunflower Seeds"),
  11. tiles = {"farming_sunflower_seeds.png"},
  12. inventory_image = "farming_sunflower_seeds.png",
  13. wield_image = "farming_sunflower_seeds.png",
  14. drawtype = "signlike",
  15. groups = {
  16. compostability = 48, seed = 1, snappy = 3, attached_node = 1, growing = 1,
  17. food_sunflower_seeds = 1, flammable = 2
  18. },
  19. paramtype = "light",
  20. paramtype2 = "wallmounted",
  21. walkable = false,
  22. sunlight_propagates = true,
  23. selection_box = farming.select,
  24. next_plant = "farming:sunflower_1",
  25. on_place = function(itemstack, placer, pointed_thing)
  26. return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_sunflower")
  27. end
  28. })
  29. minetest.register_alias("farming:sunflower_seeds", "farming:seed_sunflower")
  30. minetest.register_craft({
  31. output = "farming:seed_sunflower 5",
  32. recipe = {{"farming:sunflower"}}
  33. })
  34. -- sunflower seeds (toasted)
  35. minetest.register_craftitem("farming:sunflower_seeds_toasted", {
  36. description = S("Toasted Sunflower Seeds"),
  37. inventory_image = "farming_sunflower_seeds_toasted.png",
  38. groups = {compostability = 65, food_sunflower_seeds_toasted = 1, flammable = 2},
  39. on_use = minetest.item_eat(1)
  40. })
  41. minetest.register_craft({
  42. type = "cooking",
  43. cooktime = 10,
  44. output = "farming:sunflower_seeds_toasted",
  45. recipe = "farming:seed_sunflower"
  46. })
  47. -- sunflower oil
  48. minetest.register_node("farming:sunflower_oil", {
  49. description = S("Bottle of Sunflower Oil"),
  50. drawtype = "plantlike",
  51. tiles = {"farming_sunflower_oil.png"},
  52. inventory_image = "farming_sunflower_oil.png",
  53. wield_image = "farming_sunflower_oil.png",
  54. paramtype = "light",
  55. is_ground_content = false,
  56. walkable = false,
  57. selection_box = {
  58. type = "fixed",
  59. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  60. },
  61. groups = {
  62. compostability = 65, food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1,
  63. flammable = 2
  64. },
  65. sounds = farming.sounds.node_sound_glass_defaults()
  66. })
  67. minetest.register_craft( {
  68. output = "farming:sunflower_oil",
  69. recipe = {
  70. {"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
  71. {"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
  72. {"group:food_sunflower_seeds", "vessels:glass_bottle", "group:food_sunflower_seeds"}
  73. }
  74. })
  75. minetest.register_craft({
  76. type = "fuel",
  77. recipe = "farming:sunflower_oil",
  78. burntime = 30,
  79. replacements = {{"farming:sunflower_oil", "vessels:glass_bottle"}}
  80. })
  81. -- sunflower seed bread
  82. minetest.register_craftitem("farming:sunflower_bread", {
  83. description = S("Sunflower Seed Bread"),
  84. inventory_image = "farming_sunflower_bread.png",
  85. on_use = minetest.item_eat(8),
  86. groups = {compostability = 65, food_bread = 1, flammable = 2}
  87. })
  88. minetest.register_craft({
  89. output = "farming:sunflower_bread",
  90. recipe = {{"group:food_sunflower_seeds_toasted", "group:food_bread", "group:food_sunflower_seeds_toasted"}}
  91. })
  92. -- sunflower definition
  93. local def = {
  94. drawtype = "plantlike",
  95. tiles = {"farming_sunflower_1.png"},
  96. paramtype = "light",
  97. sunlight_propagates = true,
  98. walkable = false,
  99. buildable_to = true,
  100. drop = "",
  101. waving = 1,
  102. selection_box = farming.select,
  103. groups = {
  104. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  105. not_in_creative_inventory = 1, growing = 1
  106. },
  107. sounds = farming.sounds.node_sound_leaves_defaults()
  108. }
  109. -- stage 1
  110. minetest.register_node("farming:sunflower_1", table.copy(def))
  111. -- stage 2
  112. def.tiles = {"farming_sunflower_2.png"}
  113. minetest.register_node("farming:sunflower_2", table.copy(def))
  114. -- stage 3
  115. def.tiles = {"farming_sunflower_3.png"}
  116. minetest.register_node("farming:sunflower_3", table.copy(def))
  117. -- stage 4
  118. def.tiles = {"farming_sunflower_4.png"}
  119. minetest.register_node("farming:sunflower_4", table.copy(def))
  120. -- stage 5
  121. def.tiles = {"farming_sunflower_5.png"}
  122. minetest.register_node("farming:sunflower_5", table.copy(def))
  123. -- stage 6
  124. def.tiles = {"farming_sunflower_6.png"}
  125. def.visual_scale = 1.9
  126. minetest.register_node("farming:sunflower_6", table.copy(def))
  127. -- stage 7
  128. def.tiles = {"farming_sunflower_7.png"}
  129. minetest.register_node("farming:sunflower_7", table.copy(def))
  130. -- stage 8 (final)
  131. def.tiles = {"farming_sunflower_8.png"}
  132. def.groups.growing = nil
  133. def.selection_box = farming.select_final
  134. def.drop = {
  135. items = {
  136. {items = {"farming:sunflower"}, rarity = 1},
  137. {items = {"farming:sunflower"}, rarity = 6}
  138. }
  139. }
  140. minetest.register_node("farming:sunflower_8", table.copy(def))
  141. -- add to registered_plants
  142. farming.registered_plants["farming:sunflower"] = {
  143. crop = "farming:sunflower",
  144. seed = "farming:seed_sunflower",
  145. minlight = 14,
  146. maxlight = farming.max_light,
  147. steps = 8
  148. }
  149. -- mapgen
  150. minetest.register_decoration({
  151. deco_type = "simple",
  152. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  153. sidelen = 16,
  154. noise_params = {
  155. offset = 0,
  156. scale = farming.sunflower,
  157. spread = {x = 100, y = 100, z = 100},
  158. seed = 254,
  159. octaves = 3,
  160. persist = 0.6
  161. },
  162. y_min = 10,
  163. y_max = 40,
  164. decoration = "farming:sunflower_8"
  165. })