lettuce.lua 2.0 KB

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