coffee.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. local S = farming.intllib
  2. -- coffee
  3. minetest.register_craftitem("farming:coffee_beans", {
  4. description = S("Coffee Beans"),
  5. inventory_image = "farming_coffee_beans.png",
  6. groups = {seed = 2, food_coffee = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
  9. end
  10. })
  11. -- cup of coffee
  12. minetest.register_node("farming:coffee_cup", {
  13. description = S("Cup of Coffee"),
  14. drawtype = "torchlike",
  15. tiles = {"farming_coffee_cup.png"},
  16. inventory_image = "farming_coffee_cup.png",
  17. wield_image = "farming_coffee_cup.png",
  18. paramtype = "light",
  19. walkable = false,
  20. selection_box = {
  21. type = "fixed",
  22. fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
  23. },
  24. groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1},
  25. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  26. sounds = default.node_sound_glass_defaults()
  27. })
  28. minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup")
  29. minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass")
  30. minetest.register_craft( {
  31. output = "farming:coffee_cup",
  32. recipe = {
  33. {"group:food_saucepan", "group:food_coffee", "group:water_bucket"},
  34. {"", "vessels:drinking_glass", ""}
  35. },
  36. replacements = {
  37. {"group:water_bucket", "bucket:bucket_empty"},
  38. {"group:food_saucepan", "farming:saucepan"}
  39. }
  40. })
  41. if minetest.get_modpath("bucket_wooden") then
  42. minetest.register_craft( {
  43. output = "farming:coffee_cup",
  44. recipe = {
  45. {"group:food_saucepan", "group:food_coffee", "group:water_bucket_wooden"},
  46. {"", "vessels:drinking_glass", ""}
  47. },
  48. replacements = {
  49. {"group:water_bucket_wooden", "bucket_wooden:bucket_empty"},
  50. {"group:food_saucepan", "farming:saucepan"}
  51. }
  52. })
  53. end
  54. -- coffee definition
  55. local def = {
  56. drawtype = "plantlike",
  57. tiles = {"farming_coffee_1.png"},
  58. paramtype = "light",
  59. sunlight_propagates = true,
  60. walkable = false,
  61. buildable_to = true,
  62. drop = "",
  63. selection_box = farming.select,
  64. groups = {
  65. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  66. not_in_creative_inventory = 1, growing = 1
  67. },
  68. sounds = default.node_sound_leaves_defaults()
  69. }
  70. -- stage 1
  71. minetest.register_node("farming:coffee_1", table.copy(def))
  72. -- stage 2
  73. def.tiles = {"farming_coffee_2.png"}
  74. minetest.register_node("farming:coffee_2", table.copy(def))
  75. -- stage 3
  76. def.tiles = {"farming_coffee_3.png"}
  77. minetest.register_node("farming:coffee_3", table.copy(def))
  78. -- stage 4
  79. def.tiles = {"farming_coffee_4.png"}
  80. minetest.register_node("farming:coffee_4", table.copy(def))
  81. -- stage 5 (final)
  82. def.tiles = {"farming_coffee_5.png"}
  83. def.groups.growing = nil
  84. def.drop = {
  85. items = {
  86. {items = {"farming:coffee_beans 2"}, rarity = 1},
  87. {items = {"farming:coffee_beans 2"}, rarity = 2},
  88. {items = {"farming:coffee_beans 2"}, rarity = 3}
  89. }
  90. }
  91. minetest.register_node("farming:coffee_5", table.copy(def))
  92. -- add to registered_plants
  93. farming.registered_plants["farming:coffee"] = {
  94. crop = "farming:coffee",
  95. seed = "farming:coffee_beans",
  96. minlight = farming.min_light,
  97. maxlight = farming.max_light,
  98. steps = 5
  99. }