init.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. --[[
  2. Original textures from DocFarming mod
  3. https://forum.minetest.net/viewtopic.php?id=3948
  4. ]]
  5. local eat_function = minetest.item_eat(10, "xdecor:bowl")
  6. minetest.register_craftitem(":farming:potato_salad", {
  7. description = "Cucumber and Potato Salad\n\nBoosts current and max HP beyond normal for a short time.",
  8. inventory_image = "farming_potato_salad.png",
  9. on_use = function(itemstack, user, pointed_thing)
  10. if not user or not user:is_player() then return end
  11. hunger.apply_health_boost(user:get_player_name(), "salad", {health=30*500, time=30})
  12. return eat_function(itemstack, user, pointed_thing)
  13. end,
  14. })
  15. minetest.register_craft({
  16. output = "farming:potato_salad",
  17. recipe = {
  18. {"cucumber:cucumber"},
  19. {"potatoes:baked_potato"},
  20. {"xdecor:bowl"},
  21. }
  22. })
  23. minetest.register_node("cucumber:seed", {
  24. description = "Cucumber Seed",
  25. tiles = {"farming_cucumber_seed.png"},
  26. wield_image = "farming_cucumber_seed.png",
  27. inventory_image = "farming_cucumber_seed.png",
  28. drawtype = "signlike",
  29. paramtype = "light",
  30. paramtype2 = "wallmounted",
  31. walkable = false,
  32. sunlight_propagates = true,
  33. selection_box = farming.select,
  34. groups = utility.dig_groups("seeds", {seed = 1, seed_oil = 1, attached_node = 1, flammable = 2, notify_destruct = 1}),
  35. on_place = function(itemstack, placer, pointed_thing)
  36. return farming.place_seed(itemstack, placer, pointed_thing, "cucumber:seed")
  37. end,
  38. on_timer = farming.grow_plant,
  39. minlight = 13,
  40. maxlight = default.LIGHT_MAX,
  41. _farming_next_plant = "cucumber:cucumber_1",
  42. fertility = {"grassland"},
  43. sounds = default.node_sound_dirt_defaults({
  44. dug = {name = "default_grass_footstep", gain = 0.2},
  45. place = {name = "default_place_node", gain = 0.25},
  46. }),
  47. })
  48. -- cucumber
  49. minetest.register_craftitem("cucumber:cucumber", {
  50. description = "Cucumber",
  51. inventory_image = "farming_cucumber.png",
  52. groups = {food_cucumber = 1, flammable = 2},
  53. on_use = minetest.item_eat(4),
  54. flowerpot_insert = {"cucumber:cucumber_1", "cucumber:cucumber_2", "cucumber:cucumber_3", "cucumber:cucumber_4"},
  55. })
  56. -- cucumber definition
  57. local crop_def = {
  58. drawtype = "plantlike",
  59. tiles = {"farming_cucumber_1.png"},
  60. paramtype = "light",
  61. sunlight_propagates = true,
  62. waving = 1,
  63. walkable = false,
  64. buildable_to = true,
  65. drop = "",
  66. selection_box = farming.select,
  67. groups = utility.dig_groups("crop", {
  68. flammable = 2, plant = 1, attached_node = 1,
  69. not_in_creative_inventory = 1,
  70. }),
  71. sounds = default.node_sound_leaves_defaults(),
  72. on_timer = farming.grow_plant,
  73. minlight = 13,
  74. maxlight = default.LIGHT_MAX,
  75. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  76. flowerpot_drop = "cucumber:cucumber",
  77. }
  78. -- stage 1
  79. crop_def._farming_next_plant = "cucumber:cucumber_2"
  80. crop_def._farming_prev_seed = "cucumber:seed"
  81. minetest.register_node("cucumber:cucumber_1", table.copy(crop_def))
  82. -- stage 2
  83. crop_def._farming_next_plant = "cucumber:cucumber_3"
  84. crop_def._farming_prev_plant = "cucumber:cucumber_1"
  85. crop_def.tiles = {"farming_cucumber_2.png"}
  86. minetest.register_node("cucumber:cucumber_2", table.copy(crop_def))
  87. -- stage 3
  88. crop_def._farming_next_plant = "cucumber:cucumber_4"
  89. crop_def._farming_prev_plant = "cucumber:cucumber_2"
  90. crop_def.tiles = {"farming_cucumber_3.png"}
  91. minetest.register_node("cucumber:cucumber_3", table.copy(crop_def))
  92. -- stage 4 (final)
  93. crop_def.tiles = {"farming_cucumber_4.png"}
  94. crop_def.drop = {
  95. items = {
  96. {items = {'cucumber:seed 1'}, rarity = 1},
  97. {items = {'cucumber:seed 1'}, rarity = 3},
  98. {items = {'cucumber:cucumber'}, rarity = 1},
  99. {items = {'cucumber:cucumber'}, rarity = 3},
  100. }
  101. }
  102. crop_def._farming_next_plant = nil
  103. crop_def._farming_prev_plant = "cucumber:cucumber_3"
  104. minetest.register_node("cucumber:cucumber_4", table.copy(crop_def))