parsley.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. local S = farming.translate
  2. -- item definition
  3. minetest.register_craftitem("farming:parsley", {
  4. description = S("Parsley"),
  5. inventory_image = "farming_parsley.png",
  6. groups = {compostability = 48, seed = 2, food_parsley = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1")
  9. end
  10. })
  11. -- crop definition
  12. local def = {
  13. drawtype = "plantlike",
  14. tiles = {"farming_parsley_1.png"},
  15. paramtype = "light",
  16. sunlight_propagates = true,
  17. walkable = false,
  18. buildable_to = true,
  19. drop = "",
  20. waving = 1,
  21. selection_box = farming.select,
  22. groups = {
  23. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  24. not_in_creative_inventory = 1, growing = 1
  25. },
  26. sounds = farming.sounds.node_sound_leaves_defaults()
  27. }
  28. -- stage 1
  29. minetest.register_node("farming:parsley_1", table.copy(def))
  30. -- stage 2
  31. def.tiles = {"farming_parsley_2.png"}
  32. minetest.register_node("farming:parsley_2", table.copy(def))
  33. -- stage 3 (final)
  34. def.tiles = {"farming_parsley_3.png"}
  35. def.groups.growing = nil
  36. def.selection_box = farming.select_final
  37. def.drop = {
  38. items = {
  39. {items = {"farming:parsley 2"}, rarity = 1},
  40. {items = {"farming:parsley"}, rarity = 2},
  41. {items = {"farming:parsley"}, rarity = 3}
  42. }
  43. }
  44. minetest.register_node("farming:parsley_3", table.copy(def))
  45. -- add to registered_plants
  46. farming.registered_plants["farming:parsley"] = {
  47. crop = "farming:parsley",
  48. seed = "farming:parsley",
  49. minlight = 13,
  50. maxlight = 15,
  51. steps = 3
  52. }
  53. -- mapgen
  54. minetest.register_decoration({
  55. deco_type = "simple",
  56. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  57. sidelen = 16,
  58. noise_params = {
  59. offset = 0,
  60. scale = farming.parsley,
  61. spread = {x = 100, y = 100, z = 100},
  62. seed = 23,
  63. octaves = 3,
  64. persist = 0.6
  65. },
  66. y_min = 10,
  67. y_max = 40,
  68. decoration = "farming:parsley_3"
  69. })