cucumber.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --[[
  2. Original textures from DocFarming mod
  3. https://forum.minetest.net/viewtopic.php?id=3948
  4. ]]
  5. local S = farming.translate
  6. -- cucumber
  7. minetest.register_craftitem("farming:cucumber", {
  8. description = S("Cucumber"),
  9. inventory_image = "farming_cucumber.png",
  10. groups = {compostability = 48, 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 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. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  27. not_in_creative_inventory = 1, growing = 1
  28. },
  29. sounds = farming.sounds.node_sound_leaves_defaults()
  30. }
  31. -- stage 1
  32. minetest.register_node("farming:cucumber_1", table.copy(def))
  33. -- stage 2
  34. def.tiles = {"farming_cucumber_2.png"}
  35. minetest.register_node("farming:cucumber_2", table.copy(def))
  36. -- stage 3
  37. def.tiles = {"farming_cucumber_3.png"}
  38. minetest.register_node("farming:cucumber_3", table.copy(def))
  39. -- stage 4 (final)
  40. def.tiles = {"farming_cucumber_4.png"}
  41. def.groups.growing = nil
  42. def.selection_box = farming.select_final
  43. def.drop = {
  44. items = {
  45. {items = {"farming:cucumber 2"}, rarity = 1},
  46. {items = {"farming:cucumber 2"}, rarity = 2}
  47. }
  48. }
  49. minetest.register_node("farming:cucumber_4", table.copy(def))
  50. -- add to registered_plants
  51. farming.registered_plants["farming:cucumber"] = {
  52. crop = "farming:cucumber",
  53. seed = "farming:cucumber",
  54. minlight = farming.min_light,
  55. maxlight = farming.max_light,
  56. steps = 4
  57. }
  58. -- mapgen
  59. local mg = farming.mapgen == "v6"
  60. def = {
  61. near = mg and "group:water" or nil,
  62. num = mg and 1 or -1,
  63. }
  64. minetest.register_decoration({
  65. deco_type = "simple",
  66. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  67. sidelen = 16,
  68. noise_params = {
  69. offset = 0,
  70. scale = farming.cucumber,
  71. spread = {x = 100, y = 100, z = 100},
  72. seed = 245,
  73. octaves = 3,
  74. persist = 0.6
  75. },
  76. y_min = 1,
  77. y_max = 20,
  78. decoration = "farming:cucumber_4",
  79. spawn_by = def.near,
  80. num_spawn_by = def.num
  81. })