cabbage.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. local S = farming.translate
  2. -- cabbage
  3. minetest.register_craftitem("farming:cabbage", {
  4. description = S("Cabbage"),
  5. inventory_image = "farming_cabbage.png",
  6. groups = {compostability = 48, 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. 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: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.selection_box = farming.select_final
  46. def.drop = {
  47. max_items = 2, items = {
  48. {items = {"farming:cabbage 2"}, rarity = 1},
  49. {items = {"farming:cabbage 1"}, rarity = 2}
  50. }
  51. }
  52. minetest.register_node("farming:cabbage_6", table.copy(def))
  53. -- add to registered_plants
  54. farming.registered_plants["farming:cabbage"] = {
  55. crop = "farming:cabbage",
  56. seed = "farming:cabbage",
  57. minlight = farming.min_light,
  58. maxlight = farming.max_light,
  59. steps = 6
  60. }
  61. -- mapgen
  62. minetest.register_decoration({
  63. deco_type = "simple",
  64. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  65. sidelen = 16,
  66. noise_params = {
  67. offset = 0,
  68. scale = farming.cabbage,
  69. spread = {x = 100, y = 100, z = 100},
  70. seed = 789,
  71. octaves = 3,
  72. persist = 0.6
  73. },
  74. y_min = 2,
  75. y_max = 15,
  76. decoration = "farming:cabbage_6"
  77. })