hemp.lua 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. -- hemp rope
  126. minetest.register_node("farming:hemp_rope", {
  127. description = S("Hemp Rope"),
  128. walkable = false,
  129. climbable = true,
  130. sunlight_propagates = true,
  131. paramtype = "light",
  132. tiles = {"farming_hemp_rope.png"},
  133. wield_image = "farming_hemp_rope.png",
  134. inventory_image = "farming_hemp_rope.png",
  135. drawtype = "plantlike",
  136. groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3},
  137. sounds = default.node_sound_leaves_defaults(),
  138. selection_box = {
  139. type = "fixed",
  140. fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
  141. },
  142. })
  143. -- string
  144. minetest.register_craft( {
  145. output = "farming:hemp_rope 6",
  146. recipe = {
  147. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  148. {"farming:cotton", "farming:cotton", "farming:cotton"},
  149. {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
  150. }
  151. })
  152. -- hemp definition
  153. local crop_def = {
  154. drawtype = "plantlike",
  155. tiles = {"farming_hemp_1.png"},
  156. paramtype = "light",
  157. sunlight_propagates = true,
  158. walkable = false,
  159. buildable_to = true,
  160. drop = "",
  161. selection_box = farming.select,
  162. groups = {
  163. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  164. not_in_creative_inventory = 1, growing = 1
  165. },
  166. sounds = default.node_sound_leaves_defaults()
  167. }
  168. -- stage 1
  169. minetest.register_node("farming:hemp_1", table.copy(crop_def))
  170. -- stage 2
  171. crop_def.tiles = {"farming_hemp_2.png"}
  172. minetest.register_node("farming:hemp_2", table.copy(crop_def))
  173. -- stage 3
  174. crop_def.tiles = {"farming_hemp_3.png"}
  175. minetest.register_node("farming:hemp_3", table.copy(crop_def))
  176. -- stage 4
  177. crop_def.tiles = {"farming_hemp_4.png"}
  178. minetest.register_node("farming:hemp_4", table.copy(crop_def))
  179. -- stage 5
  180. crop_def.tiles = {"farming_hemp_5.png"}
  181. minetest.register_node("farming:hemp_5", table.copy(crop_def))
  182. -- stage 6
  183. crop_def.tiles = {"farming_hemp_6.png"}
  184. crop_def.drop = {
  185. items = {
  186. {items = {"farming:hemp_leaf"}, rarity = 2},
  187. {items = {"farming:seed_hemp"}, rarity = 1},
  188. }
  189. }
  190. minetest.register_node("farming:hemp_6", table.copy(crop_def))
  191. -- stage 7
  192. crop_def.tiles = {"farming_hemp_7.png"}
  193. crop_def.drop = {
  194. items = {
  195. {items = {"farming:hemp_leaf"}, rarity = 1},
  196. {items = {"farming:hemp_leaf"}, rarity = 3},
  197. {items = {"farming:seed_hemp"}, rarity = 1},
  198. {items = {"farming:seed_hemp"}, rarity = 3},
  199. }
  200. }
  201. minetest.register_node("farming:hemp_7", table.copy(crop_def))
  202. -- stage 8 (final)
  203. crop_def.tiles = {"farming_hemp_8.png"}
  204. crop_def.groups.growing = 0
  205. crop_def.drop = {
  206. items = {
  207. {items = {"farming:hemp_leaf 2"}, rarity = 1},
  208. {items = {"farming:hemp_leaf"}, rarity = 2},
  209. {items = {"farming:seed_hemp"}, rarity = 1},
  210. {items = {"farming:seed_hemp"}, rarity = 2},
  211. }
  212. }
  213. minetest.register_node("farming:hemp_8", table.copy(crop_def))
  214. -- add to registered_plants
  215. farming.registered_plants["farming:hemp"] = {
  216. crop = "farming:hemp",
  217. seed = "farming:seed_hemp",
  218. minlight = 13,
  219. maxlight = 15,
  220. steps = 8
  221. }