ginger.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. local S = farming.translate
  2. -- ginger
  3. minetest.register_craftitem("farming:ginger", {
  4. description = S("Ginger"),
  5. inventory_image = "farming_ginger.png",
  6. groups = {compostability = 48, seed = 2, food_ginger = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. -- ginger definition
  13. local def = {
  14. drawtype = "plantlike",
  15. tiles = {"farming_ginger_1.png"},
  16. paramtype = "light",
  17. sunlight_propagates = true,
  18. walkable = false,
  19. buildable_to = true,
  20. drop = "",
  21. waving = 1,
  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:ginger_1", table.copy(def))
  31. -- stage 2
  32. def.tiles = {"farming_ginger_2.png"}
  33. minetest.register_node("farming:ginger_2", table.copy(def))
  34. -- stage 3
  35. def.tiles = {"farming_ginger_3.png"}
  36. def.drop = {
  37. items = {
  38. {items = {"farming:ginger"}, rarity = 1},
  39. {items = {"farming:ginger"}, rarity = 3}
  40. }
  41. }
  42. minetest.register_node("farming:ginger_3", table.copy(def))
  43. -- stage 4 (final)
  44. def.tiles = {"farming_ginger_4.png"}
  45. def.groups.growing = nil
  46. def.selection_box = farming.select_final
  47. def.drop = {
  48. items = {
  49. {items = {"farming:ginger 2"}, rarity = 1},
  50. {items = {"farming:ginger 2"}, rarity = 2}
  51. }
  52. }
  53. minetest.register_node("farming:ginger_4", table.copy(def))
  54. -- add to registered_plants
  55. farming.registered_plants["farming:ginger"] = {
  56. crop = "farming:ginger",
  57. seed = "farming:ginger",
  58. minlight = 5,
  59. maxlight = minetest.LIGHT_MAX,
  60. steps = 4
  61. }
  62. -- mapgen
  63. minetest.register_decoration({
  64. name = "farming:ginger_4",
  65. deco_type = "simple",
  66. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_rainforest_litter"},
  67. sidelen = 16,
  68. noise_params = {
  69. offset = 0,
  70. scale = farming.ginger,
  71. spread = {x = 100, y = 100, z = 100},
  72. seed = 999,
  73. octaves = 3,
  74. persist = 0.6
  75. },
  76. y_max = 80,
  77. y_min = 1,
  78. decoration = "farming:ginger_3",
  79. param2 = 3
  80. })