potato.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 = {seed = 2, 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. -- 1 in 3 chance of being poisoned
  15. on_use = function(itemstack, user, pointed_thing)
  16. if user then
  17. if math.random(3) == 1 then
  18. return minetest.do_item_eat(-1, nil, itemstack, user, pointed_thing)
  19. else
  20. return minetest.do_item_eat(1, nil, itemstack, user, pointed_thing)
  21. end
  22. end
  23. end
  24. })
  25. -- baked potato
  26. minetest.register_craftitem("farming:baked_potato", {
  27. description = S("Baked Potato"),
  28. inventory_image = "farming_baked_potato.png",
  29. on_use = minetest.item_eat(6)
  30. })
  31. minetest.register_craft({
  32. type = "cooking",
  33. cooktime = 10,
  34. output = "farming:baked_potato",
  35. recipe = "group:food_potato"
  36. })
  37. -- Potato and cucumber Salad
  38. minetest.register_craftitem("farming:potato_salad", {
  39. description = S("Cucumber and Potato Salad"),
  40. inventory_image = "farming_potato_salad.png",
  41. on_use = minetest.item_eat(10, "farming:bowl")
  42. })
  43. minetest.register_craft({
  44. output = "farming:potato_salad",
  45. recipe = {
  46. {"group:food_cucumber"},
  47. {"farming:baked_potato"},
  48. {"group:food_bowl"}
  49. }
  50. })
  51. -- potato definition
  52. local def = {
  53. drawtype = "plantlike",
  54. tiles = {"farming_potato_1.png"},
  55. paramtype = "light",
  56. sunlight_propagates = true,
  57. waving = 1,
  58. walkable = false,
  59. buildable_to = true,
  60. drop = "",
  61. selection_box = farming.select,
  62. groups = {
  63. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  64. not_in_creative_inventory = 1, growing = 1
  65. },
  66. sounds = default.node_sound_leaves_defaults()
  67. }
  68. -- stage 1
  69. minetest.register_node("farming:potato_1", table.copy(def))
  70. -- stage 2
  71. def.tiles = {"farming_potato_2.png"}
  72. minetest.register_node("farming:potato_2", table.copy(def))
  73. -- stage 3
  74. def.tiles = {"farming_potato_3.png"}
  75. def.drop = {
  76. items = {
  77. {items = {"farming:potato"}, rarity = 1},
  78. {items = {"farming:potato"}, rarity = 3}
  79. }
  80. }
  81. minetest.register_node("farming:potato_3", table.copy(def))
  82. -- stage 4
  83. def.tiles = {"farming_potato_4.png"}
  84. def.groups.growing = nil
  85. def.drop = {
  86. items = {
  87. {items = {"farming:potato 2"}, rarity = 1},
  88. {items = {"farming:potato 3"}, rarity = 2}
  89. }
  90. }
  91. minetest.register_node("farming:potato_4", table.copy(def))
  92. -- add to registered_plants
  93. farming.registered_plants["farming:potato"] = {
  94. crop = "farming:potato",
  95. seed = "farming:potato",
  96. minlight = farming.min_light,
  97. maxlight = farming.max_light,
  98. steps = 4
  99. }