spinach.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. local S = farming.translate
  2. -- spinach
  3. minetest.register_craftitem("farming:spinach", {
  4. description = S("Spinach"),
  5. inventory_image = "farming_spinach.png",
  6. groups = {compostability = 48, seed = 2, food_spinach = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. -- definition
  13. local def = {
  14. drawtype = "plantlike",
  15. tiles = {"farming_spinach_1.png"},
  16. paramtype = "light",
  17. sunlight_propagates = true,
  18. waving = 1,
  19. walkable = false,
  20. buildable_to = true,
  21. drop = "",
  22. selection_box = farming.select,
  23. groups = {
  24. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  25. not_in_creative_inventory = 1, growing = 1
  26. },
  27. sounds = farming.sounds.node_sound_leaves_defaults()
  28. }
  29. -- stage 1
  30. minetest.register_node("farming:spinach_1", table.copy(def))
  31. -- stage 2
  32. def.tiles = {"farming_spinach_2.png"}
  33. minetest.register_node("farming:spinach_2", table.copy(def))
  34. -- stage 3
  35. def.tiles = {"farming_spinach_3.png"}
  36. def.drop = {
  37. items = {
  38. {items = {"farming:spinach"}, rarity = 1},
  39. {items = {"farming:spinach"}, rarity = 3}
  40. }
  41. }
  42. minetest.register_node("farming:spinach_3", table.copy(def))
  43. -- stage 4
  44. def.tiles = {"farming_spinach_4.png"}
  45. def.groups.growing = nil
  46. def.selection_box = farming.select_final
  47. def.drop = {
  48. items = {
  49. {items = {"farming:spinach 2"}, rarity = 1},
  50. {items = {"farming:spinach 2"}, rarity = 2},
  51. {items = {"farming:spinach 2"}, rarity = 3}
  52. }
  53. }
  54. minetest.register_node("farming:spinach_4", table.copy(def))
  55. -- add to registered_plants
  56. farming.registered_plants["farming:spinach"] = {
  57. crop = "farming:spinach",
  58. seed = "farming:spinach",
  59. minlight = 7,
  60. maxlight = farming.max_light,
  61. steps = 4
  62. }
  63. -- mapgen
  64. minetest.register_decoration({
  65. deco_type = "simple",
  66. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  67. sidelen = 16,
  68. noise_params = {
  69. offset = -0.1,
  70. scale = farming.spinach,
  71. spread = {x = 100, y = 100, z = 100},
  72. seed = 910,
  73. octaves = 3,
  74. persist = 0.6
  75. },
  76. biomes = {"deciduous_forest"},
  77. y_max = 31000,
  78. y_min = 1,
  79. decoration = "farming:spinach_4",
  80. param2 = 3
  81. })