lettuce.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. local S = farming.intllib
  2. -- lettuce
  3. minetest.register_craftitem("farming:lettuce", {
  4. description = S("Lettuce"),
  5. inventory_image = "farming_lettuce.png",
  6. groups = {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. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  23. not_in_creative_inventory = 1, growing = 1
  24. },
  25. sounds = default.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.drop = {
  42. items = {
  43. {items = {'farming:lettuce 2'}, rarity = 1},
  44. {items = {'farming:lettuce 1'}, rarity = 2},
  45. }
  46. }
  47. minetest.register_node("farming:lettuce_5", table.copy(def))
  48. -- add to registered_plants
  49. farming.registered_plants["farming:lettuce"] = {
  50. crop = "farming:lettuce",
  51. seed = "farming:lettuce",
  52. minlight = farming.min_light,
  53. maxlight = farming.max_light,
  54. steps = 5
  55. }