hemp.lua 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. local S = farming.intllib
  2. -- hemp seeds
  3. minetest.register_node("farming:seed_hemp", {
  4. description = S("Hemp Seed"),
  5. tiles = {"farming_hemp_seed.png"},
  6. inventory_image = "farming_hemp_seed.png",
  7. wield_image = "farming_hemp_seed.png",
  8. drawtype = "signlike",
  9. groups = {seed = 1, snappy = 3, attached_node = 1},
  10. paramtype = "light",
  11. paramtype2 = "wallmounted",
  12. walkable = false,
  13. sunlight_propagates = true,
  14. selection_box = farming.select,
  15. on_place = function(itemstack, placer, pointed_thing)
  16. return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1")
  17. end,
  18. })
  19. -- harvested hemp
  20. minetest.register_craftitem("farming:hemp_leaf", {
  21. description = S("Hemp Leaf"),
  22. inventory_image = "farming_hemp_leaf.png",
  23. })
  24. -- hemp oil
  25. minetest.register_node("farming:hemp_oil", {
  26. description = S("Bottle of Hemp Oil"),
  27. drawtype = "plantlike",
  28. tiles = {"farming_hemp_oil.png"},
  29. inventory_image = "farming_hemp_oil.png",
  30. wield_image = "farming_hemp_oil.png",
  31. paramtype = "light",
  32. is_ground_content = false,
  33. walkable = false,
  34. selection_box = {
  35. type = "fixed",
  36. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  37. },
  38. groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1},
  39. sounds = default.node_sound_glass_defaults(),
  40. })
  41. minetest.register_craft( {
  42. output = "farming:hemp_oil",
  43. recipe = {
  44. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
  45. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
  46. {"", "vessels:glass_bottle", ""}
  47. }
  48. })
  49. minetest.register_craft( {
  50. output = "farming:hemp_oil",
  51. recipe = {
  52. {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
  53. {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
  54. {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"}
  55. }
  56. })
  57. minetest.register_craft({
  58. type = "fuel",
  59. recipe = "farming:hemp_oil",
  60. burntime = 20,
  61. replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}}
  62. })
  63. -- hemp fibre
  64. minetest.register_craftitem("farming:hemp_fibre", {
  65. description = S("Hemp Fibre"),
  66. inventory_image = "farming_hemp_fibre.png",
  67. })
  68. minetest.register_craft( {
  69. output = "farming:hemp_fibre 8",
  70. recipe = {
  71. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
  72. {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"},
  73. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
  74. },
  75. replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
  76. })
  77. minetest.register_craft( {
  78. output = "farming:hemp_fibre 8",
  79. recipe = {
  80. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
  81. {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"},
  82. {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
  83. },
  84. replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}}
  85. })
  86. -- hemp block
  87. minetest.register_node("farming:hemp_block", {
  88. description = S("Hemp Block"),
  89. tiles = {"farming_hemp_block.png"},
  90. paramtype = "light",
  91. groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2}
  92. })
  93. minetest.register_craft( {
  94. output = "farming:hemp_block",
  95. recipe = {
  96. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  97. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  98. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}
  99. },
  100. })
  101. -- check and register stairs
  102. if minetest.global_exists("stairs") then
  103. if stairs.mod and stairs.mod == "redo" then
  104. stairs.register_all("hemp_block", "farming:hemp_block",
  105. {snappy = 1, flammable = 2},
  106. {"farming_hemp_block.png"},
  107. "Hemp Block",
  108. default.node_sound_leaves_defaults())
  109. else
  110. stairs.register_stair_and_slab("hemp_block", "farming:hemp_block",
  111. {snappy = 1, flammable = 2},
  112. {"farming_hemp_block.png"},
  113. "Hemp Block Stair",
  114. "Hemp Block Slab",
  115. default.node_sound_leaves_defaults())
  116. end
  117. end
  118. -- paper
  119. minetest.register_craft( {
  120. output = "default:paper",
  121. recipe = {
  122. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  123. }
  124. })
  125. -- string
  126. minetest.register_craft( {
  127. output = "farming:cotton",
  128. recipe = {
  129. {"farming:hemp_fibre"},
  130. {"farming:hemp_fibre"},
  131. {"farming:hemp_fibre"},
  132. }
  133. })
  134. -- hemp rope
  135. minetest.register_node("farming:hemp_rope", {
  136. description = S("Hemp Rope"),
  137. walkable = false,
  138. climbable = true,
  139. sunlight_propagates = true,
  140. paramtype = "light",
  141. tiles = {"farming_hemp_rope.png"},
  142. wield_image = "farming_hemp_rope.png",
  143. inventory_image = "farming_hemp_rope.png",
  144. drawtype = "plantlike",
  145. groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3},
  146. sounds = default.node_sound_leaves_defaults(),
  147. selection_box = {
  148. type = "fixed",
  149. fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
  150. },
  151. })
  152. -- string
  153. minetest.register_craft( {
  154. output = "farming:hemp_rope 6",
  155. recipe = {
  156. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  157. {"farming:cotton", "farming:cotton", "farming:cotton"},
  158. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  159. }
  160. })
  161. -- hemp definition
  162. local crop_def = {
  163. drawtype = "plantlike",
  164. tiles = {"farming_hemp_1.png"},
  165. paramtype = "light",
  166. sunlight_propagates = true,
  167. walkable = false,
  168. buildable_to = true,
  169. drop = "",
  170. selection_box = farming.select,
  171. groups = {
  172. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  173. not_in_creative_inventory = 1, growing = 1
  174. },
  175. sounds = default.node_sound_leaves_defaults()
  176. }
  177. -- stage 1
  178. minetest.register_node("farming:hemp_1", table.copy(crop_def))
  179. -- stage 2
  180. crop_def.tiles = {"farming_hemp_2.png"}
  181. minetest.register_node("farming:hemp_2", table.copy(crop_def))
  182. -- stage 3
  183. crop_def.tiles = {"farming_hemp_3.png"}
  184. minetest.register_node("farming:hemp_3", table.copy(crop_def))
  185. -- stage 4
  186. crop_def.tiles = {"farming_hemp_4.png"}
  187. minetest.register_node("farming:hemp_4", table.copy(crop_def))
  188. -- stage 5
  189. crop_def.tiles = {"farming_hemp_5.png"}
  190. minetest.register_node("farming:hemp_5", table.copy(crop_def))
  191. -- stage 6
  192. crop_def.tiles = {"farming_hemp_6.png"}
  193. crop_def.drop = {
  194. items = {
  195. {items = {"farming:hemp_leaf"}, rarity = 2},
  196. {items = {"farming:seed_hemp"}, rarity = 1},
  197. }
  198. }
  199. minetest.register_node("farming:hemp_6", table.copy(crop_def))
  200. -- stage 7
  201. crop_def.tiles = {"farming_hemp_7.png"}
  202. crop_def.drop = {
  203. items = {
  204. {items = {"farming:hemp_leaf"}, rarity = 1},
  205. {items = {"farming:hemp_leaf"}, rarity = 3},
  206. {items = {"farming:seed_hemp"}, rarity = 1},
  207. {items = {"farming:seed_hemp"}, rarity = 3},
  208. }
  209. }
  210. minetest.register_node("farming:hemp_7", table.copy(crop_def))
  211. -- stage 8 (final)
  212. crop_def.tiles = {"farming_hemp_8.png"}
  213. crop_def.groups.growing = 0
  214. crop_def.drop = {
  215. items = {
  216. {items = {"farming:hemp_leaf 2"}, rarity = 1},
  217. {items = {"farming:hemp_leaf"}, rarity = 2},
  218. {items = {"farming:seed_hemp"}, rarity = 1},
  219. {items = {"farming:seed_hemp"}, rarity = 2},
  220. }
  221. }
  222. minetest.register_node("farming:hemp_8", table.copy(crop_def))
  223. -- add to registered_plants
  224. farming.registered_plants["farming:hemp"] = {
  225. crop = "farming:hemp",
  226. seed = "farming:seed_hemp",
  227. minlight = 13,
  228. maxlight = 15,
  229. steps = 8
  230. }