init.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. --[[
  2. Original textures from DocFarming mod
  3. https://forum.minetest.net/viewtopic.php?id=3948
  4. ]]
  5. local S = function(s)
  6. return s
  7. end
  8. minetest.register_node("potatoes:seed", {
  9. description = "Potato Eyes",
  10. tiles = {"farming_potato_seed.png"},
  11. wield_image = "farming_potato_seed.png",
  12. inventory_image = "farming_potato_seed.png",
  13. drawtype = "signlike",
  14. paramtype = "light",
  15. paramtype2 = "wallmounted",
  16. walkable = false,
  17. sunlight_propagates = true,
  18. selection_box = {
  19. type = "fixed",
  20. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  21. },
  22. groups = utility.dig_groups("seeds", {seed = 1, seed_oil = 1, attached_node = 1, flammable = 2, notify_destruct = 1}),
  23. on_place = function(itemstack, placer, pointed_thing)
  24. return farming.place_seed(itemstack, placer, pointed_thing, "potatoes:seed")
  25. end,
  26. on_timer = farming.grow_plant,
  27. minlight = 13,
  28. maxlight = 15,
  29. _farming_next_plant = "potatoes:potato_1",
  30. fertility = {"grassland"},
  31. sounds = default.node_sound_dirt_defaults({
  32. dug = {name = "default_grass_footstep", gain = 0.2},
  33. place = {name = "default_place_node", gain = 0.25},
  34. }),
  35. })
  36. -- potato
  37. minetest.register_craftitem("potatoes:potato", {
  38. description = S("Potato"),
  39. inventory_image = "farming_potato.png",
  40. on_use = minetest.item_eat(1),
  41. groups = {foodrot=1},
  42. flowerpot_insert = {"potatoes:potato_1", "potatoes:potato_2", "potatoes:potato_3", "potatoes:potato_4"},
  43. })
  44. -- baked potato
  45. minetest.register_craftitem("potatoes:baked_potato", {
  46. description = S("Baked Potato"),
  47. inventory_image = "farming_baked_potato.png",
  48. on_use = minetest.item_eat(4),
  49. groups = {foodrot=1},
  50. })
  51. minetest.register_craft({
  52. type = "cooking",
  53. cooktime = 3,
  54. output = "potatoes:baked_potato",
  55. recipe = "potatoes:potato"
  56. })
  57. -- potato definition
  58. local crop_def = {
  59. drawtype = "plantlike",
  60. tiles = {"farming_potato_1.png"},
  61. paramtype = "light",
  62. sunlight_propagates = true,
  63. waving = 1,
  64. walkable = false,
  65. buildable_to = true,
  66. drop = "",
  67. selection_box = {
  68. type = "fixed",
  69. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  70. },
  71. groups = utility.dig_groups("crop", {
  72. flammable = 2, plant = 1, attached_node = 1,
  73. not_in_creative_inventory = 1, growing = 1, notify_destruct = 1,
  74. }),
  75. sounds = default.node_sound_leaves_defaults(),
  76. on_timer = farming.grow_plant,
  77. minlight = 13,
  78. maxlight = default.LIGHT_MAX,
  79. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  80. flowerpot_drop = "potatoes:potato",
  81. }
  82. -- stage 1
  83. crop_def._farming_next_plant = "potatoes:potato_2"
  84. crop_def._farming_prev_seed = "potatoes:seed"
  85. minetest.register_node("potatoes:potato_1", table.copy(crop_def))
  86. -- stage 2
  87. crop_def._farming_next_plant = "potatoes:potato_3"
  88. crop_def._farming_prev_plant = "potatoes:potato_1"
  89. crop_def.tiles = {"farming_potato_2.png"}
  90. minetest.register_node("potatoes:potato_2", table.copy(crop_def))
  91. -- stage 3
  92. crop_def._farming_next_plant = "potatoes:potato_4"
  93. crop_def._farming_prev_plant = "potatoes:potato_2"
  94. crop_def.tiles = {"farming_potato_3.png"}
  95. crop_def.drop = {
  96. items = {
  97. {items = {'potatoes:potato'}, rarity = 1},
  98. {items = {'potatoes:potato'}, rarity = 3},
  99. }
  100. }
  101. minetest.register_node("potatoes:potato_3", table.copy(crop_def))
  102. -- stage 4
  103. crop_def._farming_next_plant = nil
  104. crop_def._farming_prev_plant = "potatoes:potato_3"
  105. crop_def.tiles = {"farming_potato_4.png"}
  106. crop_def.groups.growing = 0
  107. crop_def.drop = {
  108. items = {
  109. {items = {'potatoes:potato'}, rarity = 1},
  110. {items = {'potatoes:potato 3'}, rarity = 3},
  111. {items = {'potatoes:seed'}, rarity = 1},
  112. {items = {'potatoes:seed'}, rarity = 2},
  113. }
  114. }
  115. minetest.register_node("potatoes:potato_4", table.copy(crop_def))