cucumber.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --[[
  2. Original textures from DocFarming mod
  3. https://forum.minetest.net/viewtopic.php?id=3948
  4. ]]
  5. local S = farming.intllib
  6. -- cucumber
  7. minetest.register_craftitem("farming:cucumber", {
  8. description = S("Cucumber"),
  9. inventory_image = "farming_cucumber.png",
  10. groups = {seed = 2, food_cucumber = 1, flammable = 2},
  11. on_place = function(itemstack, placer, pointed_thing)
  12. return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
  13. end,
  14. on_use = minetest.item_eat(4),
  15. })
  16. -- cucumber definition
  17. local crop_def = {
  18. drawtype = "plantlike",
  19. tiles = {"farming_cucumber_1.png"},
  20. paramtype = "light",
  21. walkable = false,
  22. buildable_to = true,
  23. drop = "",
  24. selection_box = farming.select,
  25. groups = {
  26. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  27. not_in_creative_inventory = 1, growing = 1
  28. },
  29. sounds = default.node_sound_leaves_defaults()
  30. }
  31. -- stage 1
  32. minetest.register_node("farming:cucumber_1", table.copy(crop_def))
  33. -- stage 2
  34. crop_def.tiles = {"farming_cucumber_2.png"}
  35. minetest.register_node("farming:cucumber_2", table.copy(crop_def))
  36. -- stage 3
  37. crop_def.tiles = {"farming_cucumber_3.png"}
  38. minetest.register_node("farming:cucumber_3", table.copy(crop_def))
  39. -- stage 4 (final)
  40. crop_def.tiles = {"farming_cucumber_4.png"}
  41. crop_def.groups.growing = 0
  42. crop_def.drop = {
  43. items = {
  44. {items = {"farming:cucumber 2"}, rarity = 1},
  45. {items = {"farming:cucumber 2"}, rarity = 2},
  46. }
  47. }
  48. minetest.register_node("farming:cucumber_4", table.copy(crop_def))
  49. -- add to registered_plants
  50. farming.registered_plants["farming:cucumber"] = {
  51. crop = "farming:cucumber",
  52. seed = "farming:cucumber",
  53. minlight = 13,
  54. maxlight = 15,
  55. steps = 4
  56. }