coffee.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. -- cold cup of coffee
  12. minetest.register_node("farming:coffee_cup", {
  13. description = S("Cup of Coffee"),
  14. drawtype = "torchlike", --"plantlike",
  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},
  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. type = "shapeless",
  33. recipe = {"vessels:drinking_glass", "group:food_coffee",
  34. "bucket:bucket_water", "group:food_saucepan"},
  35. replacements = {
  36. {"bucket:bucket_water", "bucket:bucket_empty"},
  37. {"group:food_saucepan", "farming:saucepan"},
  38. }
  39. })
  40. -- coffee definition
  41. local crop_def = {
  42. drawtype = "plantlike",
  43. tiles = {"farming_coffee_1.png"},
  44. paramtype = "light",
  45. sunlight_propagates = true,
  46. walkable = false,
  47. buildable_to = true,
  48. drop = "",
  49. selection_box = farming.select,
  50. groups = {
  51. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  52. not_in_creative_inventory = 1, growing = 1
  53. },
  54. sounds = default.node_sound_leaves_defaults()
  55. }
  56. -- stage 1
  57. minetest.register_node("farming:coffee_1", table.copy(crop_def))
  58. -- stage 2
  59. crop_def.tiles = {"farming_coffee_2.png"}
  60. minetest.register_node("farming:coffee_2", table.copy(crop_def))
  61. -- stage 3
  62. crop_def.tiles = {"farming_coffee_3.png"}
  63. minetest.register_node("farming:coffee_3", table.copy(crop_def))
  64. -- stage 4
  65. crop_def.tiles = {"farming_coffee_4.png"}
  66. minetest.register_node("farming:coffee_4", table.copy(crop_def))
  67. -- stage 5 (final)
  68. crop_def.tiles = {"farming_coffee_5.png"}
  69. crop_def.groups.growing = 0
  70. crop_def.drop = {
  71. items = {
  72. {items = {"farming:coffee_beans 2"}, rarity = 1},
  73. {items = {"farming:coffee_beans 2"}, rarity = 2},
  74. {items = {"farming:coffee_beans 2"}, rarity = 3},
  75. }
  76. }
  77. minetest.register_node("farming:coffee_5", table.copy(crop_def))
  78. -- add to registered_plants
  79. farming.registered_plants["farming:coffee"] = {
  80. crop = "farming:coffee",
  81. seed = "farming:coffee_beans",
  82. minlight = 13,
  83. maxlight = 15,
  84. steps = 5
  85. }