cotton.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. minetest.register_craftitem("farming:cotton_seed", {
  2. description = "Cotton Seeds",
  3. inventory_image = "farming_cotton_seed.png",
  4. on_place = function(itemstack, placer, pointed_thing)
  5. local above = minetest.env:get_node(pointed_thing.above)
  6. if above.name == "air" then
  7. above.name = "farming:cotton_1"
  8. minetest.env:set_node(pointed_thing.above, above)
  9. itemstack:take_item(1)
  10. return itemstack
  11. end
  12. end
  13. })
  14. minetest.register_node("farming:cotton_1", {
  15. paramtype = "light",
  16. sunlight_propagates = true,
  17. walkable = false,
  18. drawtype = "raillike",
  19. drop = "",
  20. tiles = {"farming_cotton_seed.png"},
  21. selection_box = {
  22. type = "fixed",
  23. fixed = {
  24. {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5}
  25. },
  26. },
  27. groups = {snappy=3, flammable=2, not_in_creative_inventory=1, attached_node=1},
  28. sounds = default.node_sound_leaves_defaults(),
  29. })
  30. minetest.register_node("farming:cotton_2", {
  31. paramtype = "light",
  32. sunlight_propagates = true,
  33. walkable = false,
  34. drawtype = "plantlike",
  35. drop = "",
  36. tiles = {"farming_cotton_2.png"},
  37. selection_box = {
  38. type = "fixed",
  39. fixed = {
  40. {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5}
  41. },
  42. },
  43. groups = {snappy=3, flammable=2, not_in_creative_inventory=1, attached_node=1},
  44. sounds = default.node_sound_leaves_defaults(),
  45. })
  46. minetest.register_node("farming:cotton", {
  47. paramtype = "light",
  48. sunlight_propagates = true,
  49. walkable = false,
  50. drawtype = "nodebox",
  51. tiles = {"farming_cotton.png"},
  52. node_box = {
  53. type = "fixed",
  54. fixed = {
  55. {-0.5/5, -2.5/5, -0.5/5, 0.5/5, -1.5/5, 0.5/5},
  56. {0.5/5, -1.5/5, -1.5/5, 1.5/5, 1.5/5, -0.5/5},
  57. {-1.5/5, -1.5/5, 0.5/5, -0.5/5, 1.5/5, 1.5/5},
  58. {0.5/5, -1.5/5, 0.5/5, 1.5/5, 1.5/5, 1.5/5},
  59. {-1.5/5, -1.5/5, -1.5/5, -0.5/5, 1.5/5, -0.5/5},
  60. {-2.5/5, 0.5/5, -2.5/5, -1.5/5, 2.5/5, -1.5/5},
  61. {1.5/5, 0.5/5, -2.5/5, 2.5/5, 2.5/5, -1.5/5},
  62. {1.5/5, 0.5/5, 1.5/5, 2.5/5, 2.5/5, 2.5/5},
  63. {-2.5/5, 0.5/5, 1.5/5, -1.5/5, 2.5/5, 2.5/5},
  64. }
  65. },
  66. drop = {
  67. max_items = 6,
  68. items = {
  69. { items = {'farming:cotton_seed'} },
  70. { items = {'farming:cotton_seed'}, rarity = 2},
  71. { items = {'farming:cotton_seed'}, rarity = 5},
  72. { items = {'farming:string'} },
  73. { items = {'farming:string'}, rarity = 2 },
  74. { items = {'farming:string'}, rarity = 5 }
  75. }
  76. },
  77. groups = {snappy=3, flammable=2, not_in_creative_inventory=1, attached_node=1},
  78. sounds = default.node_sound_leaves_defaults(),
  79. })
  80. farming:add_plant("farming:cotton", {"farming:cotton_1", "farming:cotton_2"}, 50, 20)
  81. minetest.register_craftitem("farming:string", {
  82. description = "String",
  83. inventory_image = "farming_string.png",
  84. })
  85. minetest.register_craft({
  86. output = "wool:white",
  87. recipe = {{"farming:string"}}
  88. })
  89. -- ========= FUEL =========
  90. minetest.register_craft({
  91. type = "fuel",
  92. recipe = "farming:cotton_seed",
  93. burntime = 1
  94. })
  95. minetest.register_craft({
  96. type = "fuel",
  97. recipe = "farming:string",
  98. burntime = 1
  99. })