rhubarb.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. local S = farming.translate
  2. -- rhubarb
  3. minetest.register_craftitem("farming:rhubarb", {
  4. description = S("Rhubarb"),
  5. inventory_image = "farming_rhubarb.png",
  6. groups = {compostability = 48, seed = 2, food_rhubarb = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. -- rhubarb pie
  13. minetest.register_craftitem("farming:rhubarb_pie", {
  14. description = S("Rhubarb Pie"),
  15. inventory_image = "farming_rhubarb_pie.png",
  16. on_use = minetest.item_eat(6),
  17. groups = {compostability = 65}
  18. })
  19. local tmp = farming.use_utensils and "farming:baking_tray" or ""
  20. minetest.register_craft({
  21. output = "farming:rhubarb_pie",
  22. recipe = {
  23. {tmp, "group:food_sugar", ""},
  24. {"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"},
  25. {"group:food_wheat", "group:food_wheat", "group:food_wheat"}
  26. },
  27. replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
  28. })
  29. -- rhubarb definition
  30. local def = {
  31. drawtype = "plantlike",
  32. tiles = {"farming_rhubarb_1.png"},
  33. paramtype = "light",
  34. sunlight_propagates = true,
  35. walkable = false,
  36. buildable_to = true,
  37. drop = "",
  38. waving = 1,
  39. selection_box = farming.select,
  40. groups = {
  41. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  42. not_in_creative_inventory = 1, growing = 1
  43. },
  44. sounds = farming.sounds.node_sound_leaves_defaults(),
  45. minlight = 10,
  46. maxlight = 12
  47. }
  48. -- stage 1
  49. minetest.register_node("farming:rhubarb_1", table.copy(def))
  50. -- stage2
  51. def.tiles = {"farming_rhubarb_2.png"}
  52. minetest.register_node("farming:rhubarb_2", table.copy(def))
  53. -- stage3
  54. def.tiles = {"farming_rhubarb_3.png"}
  55. def.drop = {
  56. items = {
  57. {items = {"farming:rhubarb"}, rarity = 1},
  58. }
  59. }
  60. minetest.register_node("farming:rhubarb_3", table.copy(def))
  61. -- stage 4 (final)
  62. def.tiles = {"farming_rhubarb_4.png"}
  63. def.groups.growing = nil
  64. def.selection_box = farming.select_final
  65. def.drop = {
  66. items = {
  67. {items = {"farming:rhubarb 2"}, rarity = 1},
  68. {items = {"farming:rhubarb"}, rarity = 2},
  69. {items = {"farming:rhubarb"}, rarity = 3}
  70. }
  71. }
  72. minetest.register_node("farming:rhubarb_4", table.copy(def))
  73. -- add to registered_plants
  74. farming.registered_plants["farming:rhubarb"] = {
  75. crop = "farming:rhubarb",
  76. seed = "farming:rhubarb",
  77. minlight = 10,
  78. maxlight = 12,
  79. steps = 4
  80. }
  81. -- mapgen
  82. minetest.register_decoration({
  83. deco_type = "simple",
  84. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  85. sidelen = 16,
  86. noise_params = {
  87. offset = 0,
  88. scale = farming.rhubarb,
  89. spread = {x = 100, y = 100, z = 100},
  90. seed = 798,
  91. octaves = 3,
  92. persist = 0.6
  93. },
  94. y_min = 3,
  95. y_max = 20,
  96. decoration = "farming:rhubarb_3"
  97. })