cabbage.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. local S = farming.intllib
  2. -- cabbage
  3. minetest.register_craftitem("farming:cabbage", {
  4. description = S("Cabbage"),
  5. inventory_image = "farming_cabbage.png",
  6. groups = {seed = 2, food_cabbage = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. local def = {
  13. drawtype = "plantlike",
  14. tiles = {"farming_cabbage_1.png"},
  15. paramtype = "light",
  16. sunlight_propagates = true,
  17. waving = 1,
  18. walkable = false,
  19. buildable_to = true,
  20. drop = "",
  21. selection_box = farming.select,
  22. groups = {
  23. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  24. not_in_creative_inventory = 1, growing = 1
  25. },
  26. sounds = default.node_sound_leaves_defaults()
  27. }
  28. -- stage 1
  29. minetest.register_node("farming:cabbage_1", table.copy(def))
  30. -- stage 2
  31. def.tiles = {"farming_cabbage_2.png"}
  32. minetest.register_node("farming:cabbage_2", table.copy(def))
  33. -- stage 3
  34. def.tiles = {"farming_cabbage_3.png"}
  35. minetest.register_node("farming:cabbage_3", table.copy(def))
  36. -- stage 4
  37. def.tiles = {"farming_cabbage_4.png"}
  38. minetest.register_node("farming:cabbage_4", table.copy(def))
  39. -- stage 5
  40. def.tiles = {"farming_cabbage_5.png"}
  41. minetest.register_node("farming:cabbage_5", table.copy(def))
  42. -- stage 6
  43. def.tiles = {"farming_cabbage_6.png"}
  44. def.groups.growing = nil
  45. def.drop = {
  46. max_items = 2, items = {
  47. {items = {"farming:cabbage 2"}, rarity = 1},
  48. {items = {"farming:cabbage 1"}, rarity = 2}
  49. }
  50. }
  51. minetest.register_node("farming:cabbage_6", table.copy(def))
  52. -- add to registered_plants
  53. farming.registered_plants["farming:cabbage"] = {
  54. crop = "farming:cabbage",
  55. seed = "farming:cabbage",
  56. minlight = farming.min_light,
  57. maxlight = farming.max_light,
  58. steps = 6
  59. }