artichoke.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. local S = farming.intllib
  2. -- item definition
  3. minetest.register_craftitem("farming:artichoke", {
  4. description = S("Artichoke"),
  5. inventory_image = "farming_artichoke.png",
  6. groups = {seed = 2, food_artichoke = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1")
  9. end,
  10. on_use = minetest.item_eat(4)
  11. })
  12. -- crop definition
  13. local def = {
  14. drawtype = "plantlike",
  15. tiles = {"farming_artichoke_1.png"},
  16. paramtype = "light",
  17. sunlight_propagates = true,
  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:artichoke_1", table.copy(def))
  30. -- stage 2
  31. def.tiles = {"farming_artichoke_2.png"}
  32. minetest.register_node("farming:artichoke_2", table.copy(def))
  33. -- stage 3
  34. def.tiles = {"farming_artichoke_3.png"}
  35. minetest.register_node("farming:artichoke_3", table.copy(def))
  36. -- stage 4
  37. def.tiles = {"farming_artichoke_4.png"}
  38. minetest.register_node("farming:artichoke_4", table.copy(def))
  39. -- stage 5 (final)
  40. def.tiles = {"farming_artichoke_5.png"}
  41. def.groups.growing = nil
  42. def.drop = {
  43. items = {
  44. {items = {"farming:artichoke 2"}, rarity = 1},
  45. {items = {"farming:artichoke"}, rarity = 2}
  46. }
  47. }
  48. minetest.register_node("farming:artichoke_5", table.copy(def))
  49. -- add to registered_plants
  50. farming.registered_plants["farming:artichoke"] = {
  51. crop = "farming:artichoke",
  52. seed = "farming:artichoke",
  53. minlight = 13,
  54. maxlight = 15,
  55. steps = 5
  56. }