potato.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. --[[
  2. Original textures from DocFarming mod
  3. https://forum.minetest.net/viewtopic.php?id=3948
  4. ]]
  5. local S = farming.intllib
  6. -- potato
  7. minetest.register_craftitem("farming:potato", {
  8. description = S("Potato"),
  9. inventory_image = "farming_potato.png",
  10. groups = {food_potato = 1, flammable = 2},
  11. on_place = function(itemstack, placer, pointed_thing)
  12. return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
  13. end,
  14. on_use = minetest.item_eat(1),
  15. })
  16. -- baked potato
  17. minetest.register_craftitem("farming:baked_potato", {
  18. description = S("Baked Potato"),
  19. inventory_image = "farming_baked_potato.png",
  20. on_use = minetest.item_eat(6),
  21. })
  22. minetest.register_craft({
  23. type = "cooking",
  24. cooktime = 10,
  25. output = "farming:baked_potato",
  26. recipe = "group:food_potato"
  27. })
  28. -- Potato and cucumber Salad
  29. minetest.register_craftitem("farming:potato_salad", {
  30. description = S("Cucumber and Potato Salad"),
  31. inventory_image = "farming_potato_salad.png",
  32. on_use = minetest.item_eat(10, "farming:bowl"),
  33. })
  34. minetest.register_craft({
  35. output = "farming:potato_salad",
  36. recipe = {
  37. {"group:food_cucumber"},
  38. {"farming:baked_potato"},
  39. {"group:food_bowl"},
  40. }
  41. })
  42. -- potato definition
  43. local crop_def = {
  44. drawtype = "plantlike",
  45. tiles = {"farming_potato_1.png"},
  46. paramtype = "light",
  47. sunlight_propagates = true,
  48. waving = 1,
  49. walkable = false,
  50. buildable_to = true,
  51. drop = "",
  52. selection_box = farming.select,
  53. groups = {
  54. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  55. not_in_creative_inventory = 1, growing = 1
  56. },
  57. sounds = default.node_sound_leaves_defaults()
  58. }
  59. -- stage 1
  60. minetest.register_node("farming:potato_1", table.copy(crop_def))
  61. -- stage 2
  62. crop_def.tiles = {"farming_potato_2.png"}
  63. minetest.register_node("farming:potato_2", table.copy(crop_def))
  64. -- stage 3
  65. crop_def.tiles = {"farming_potato_3.png"}
  66. crop_def.drop = {
  67. items = {
  68. {items = {'farming:potato'}, rarity = 1},
  69. {items = {'farming:potato'}, rarity = 3},
  70. }
  71. }
  72. minetest.register_node("farming:potato_3", table.copy(crop_def))
  73. -- stage 4
  74. crop_def.tiles = {"farming_potato_4.png"}
  75. crop_def.groups.growing = 0
  76. crop_def.drop = {
  77. items = {
  78. {items = {'farming:potato 2'}, rarity = 1},
  79. {items = {'farming:potato 3'}, rarity = 2},
  80. }
  81. }
  82. minetest.register_node("farming:potato_4", table.copy(crop_def))
  83. -- add to registered_plants
  84. farming.registered_plants["farming:potato"] = {
  85. crop = "farming:potato",
  86. seed = "farming:potato",
  87. minlight = 13,
  88. maxlight = 15,
  89. steps = 4
  90. }