eggplant.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. local S = farming.translate
  2. -- eggplant
  3. minetest.register_craftitem("farming:eggplant", {
  4. description = S("Eggplant"),
  5. inventory_image = "farming_eggplant.png",
  6. groups = {compostability = 48, seed = 2, food_eggplant = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1")
  9. end,
  10. on_use = minetest.item_eat(3)
  11. })
  12. -- definition
  13. local def = {
  14. drawtype = "plantlike",
  15. tiles = {"farming_eggplant_1.png"},
  16. paramtype = "light",
  17. sunlight_propagates = true,
  18. waving = 1,
  19. walkable = false,
  20. buildable_to = true,
  21. drop = "",
  22. waving = 1,
  23. selection_box = farming.select,
  24. groups = {
  25. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  26. not_in_creative_inventory = 1, growing = 1
  27. },
  28. sounds = farming.sounds.node_sound_leaves_defaults()
  29. }
  30. -- stage 1
  31. minetest.register_node("farming:eggplant_1", table.copy(def))
  32. -- stage 2
  33. def.tiles = {"farming_eggplant_2.png"}
  34. minetest.register_node("farming:eggplant_2", table.copy(def))
  35. -- stage 3
  36. def.tiles = {"farming_eggplant_3.png"}
  37. def.drop = {
  38. items = {
  39. {items = {"farming:eggplant"}, rarity = 1},
  40. {items = {"farming:eggplant"}, rarity = 3}
  41. }
  42. }
  43. minetest.register_node("farming:eggplant_3", table.copy(def))
  44. -- stage 4
  45. def.tiles = {"farming_eggplant_4.png"}
  46. def.groups.growing = nil
  47. def.selection_box = farming.select_final
  48. def.drop = {
  49. items = {
  50. {items = {"farming:eggplant 2"}, rarity = 1},
  51. {items = {"farming:eggplant 2"}, rarity = 2}
  52. }
  53. }
  54. minetest.register_node("farming:eggplant_4", table.copy(def))
  55. -- add to registered_plants
  56. farming.registered_plants["farming:eggplant"] = {
  57. crop = "farming:eggplant",
  58. seed = "farming:eggplant",
  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.eggplant,
  71. spread = {x = 100, y = 100, z = 100},
  72. seed = 356,
  73. octaves = 3,
  74. persist = 0.6
  75. },
  76. biomes = {"deciduous_forest"},
  77. y_max = 31000,
  78. y_min = 1,
  79. decoration = "farming:eggplant_4",
  80. param2 = 3
  81. })