init.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. -- Global farming namespace
  2. farming = {}
  3. farming.path = minetest.get_modpath("farming")
  4. -- Load files
  5. dofile(farming.path .. "/api.lua")
  6. dofile(farming.path .. "/nodes.lua")
  7. dofile(farming.path .. "/hoes.lua")
  8. -- WHEAT
  9. farming.register_plant("farming:wheat", {
  10. description = "Wheat seed",
  11. paramtype2 = "meshoptions",
  12. inventory_image = "farming_wheat_seed.png",
  13. steps = 8,
  14. minlight = 13,
  15. maxlight = default.LIGHT_MAX,
  16. fertility = {"grassland"},
  17. groups = {flammable = 4},
  18. place_param2 = 3,
  19. })
  20. minetest.register_craftitem("farming:flour", {
  21. description = "Flour",
  22. inventory_image = "farming_flour.png",
  23. groups = {flammable = 1},
  24. })
  25. minetest.register_craftitem("farming:bread", {
  26. description = "Bread",
  27. inventory_image = "farming_bread.png",
  28. on_use = minetest.item_eat(5),
  29. groups = {flammable = 2},
  30. })
  31. minetest.register_craft({
  32. type = "shapeless",
  33. output = "farming:flour",
  34. recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
  35. })
  36. minetest.register_craft({
  37. type = "cooking",
  38. cooktime = 15,
  39. output = "farming:bread",
  40. recipe = "farming:flour"
  41. })
  42. -- Cotton
  43. farming.register_plant("farming:cotton", {
  44. description = "Cotton seed",
  45. inventory_image = "farming_cotton_seed.png",
  46. steps = 8,
  47. minlight = 13,
  48. maxlight = default.LIGHT_MAX,
  49. fertility = {"grassland", "desert"},
  50. groups = {flammable = 4},
  51. })
  52. minetest.register_alias("farming:string", "farming:cotton")
  53. minetest.register_craft({
  54. output = "wool:white",
  55. recipe = {
  56. {"farming:cotton", "farming:cotton"},
  57. {"farming:cotton", "farming:cotton"},
  58. }
  59. })
  60. -- Straw
  61. minetest.register_craft({
  62. output = "farming:straw 3",
  63. recipe = {
  64. {"farming:wheat", "farming:wheat", "farming:wheat"},
  65. {"farming:wheat", "farming:wheat", "farming:wheat"},
  66. {"farming:wheat", "farming:wheat", "farming:wheat"},
  67. }
  68. })
  69. minetest.register_craft({
  70. output = "farming:wheat 3",
  71. recipe = {
  72. {"farming:straw"},
  73. }
  74. })
  75. -- Fuels
  76. minetest.register_craft({
  77. type = "fuel",
  78. recipe = "farming:straw",
  79. burntime = 3,
  80. })
  81. minetest.register_craft({
  82. type = "fuel",
  83. recipe = "farming:wheat",
  84. burntime = 1,
  85. })
  86. minetest.register_craft({
  87. type = "fuel",
  88. recipe = "farming:cotton",
  89. burntime = 1,
  90. })
  91. minetest.register_craft({
  92. type = "fuel",
  93. recipe = "farming:hoe_wood",
  94. burntime = 5,
  95. })