leaves.lua 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. local S = ethereal.intllib
  2. -- set leaftype (value inside init.lua)
  3. local leaftype = "plantlike"
  4. if ethereal.leaftype ~= 0 then
  5. leaftype = "allfaces_optional"
  6. end
  7. -- default apple tree leaves
  8. minetest.override_item("default:leaves", {
  9. drawtype = leaftype,
  10. visual_scale = 1.4,
  11. inventory_image = "default_leaves.png",
  12. wield_image = "default_leaves.png",
  13. walkable = ethereal.leafwalk,
  14. })
  15. -- ability to craft big tree sapling
  16. minetest.register_craft({
  17. recipe = {{"default:sapling", "default:sapling", "default:sapling"}},
  18. output = "ethereal:big_tree_sapling"
  19. })
  20. -- default jungle tree leaves
  21. minetest.override_item("default:jungleleaves", {
  22. drawtype = leaftype,
  23. visual_scale = 1.4,
  24. inventory_image = "default_jungleleaves.png",
  25. wield_image = "default_jungleleaves.png",
  26. walkable = ethereal.leafwalk,
  27. })
  28. -- default pine tree leaves
  29. minetest.override_item("default:pine_needles", {
  30. drawtype = leaftype,
  31. visual_scale = 1.4,
  32. inventory_image = "default_pine_needles.png",
  33. wield_image = "default_pine_needles.png",
  34. walkable = ethereal.leafwalk,
  35. drop = {
  36. max_items = 1,
  37. items = {
  38. {items = {"default:pine_sapling"}, rarity = 20},
  39. {items = {"ethereal:pine_nuts"}, rarity = 5},
  40. {items = {"default:pine_needles"}}
  41. }
  42. },
  43. })
  44. -- default acacia tree leaves
  45. minetest.override_item("default:acacia_leaves", {
  46. drawtype = leaftype,
  47. inventory_image = "default_acacia_leaves.png",
  48. wield_image = "default_acacia_leaves.png",
  49. visual_scale = 1.4,
  50. walkable = ethereal.leafwalk,
  51. })
  52. -- default aspen tree leaves
  53. minetest.override_item("default:aspen_leaves", {
  54. drawtype = leaftype,
  55. inventory_image = "default_aspen_leaves.png",
  56. wield_image = "default_aspen_leaves.png",
  57. visual_scale = 1.4,
  58. walkable = ethereal.leafwalk,
  59. })
  60. -- willow twig
  61. minetest.register_node("ethereal:willow_twig", {
  62. description = S("Willow Twig"),
  63. drawtype = "plantlike",
  64. tiles = {"willow_twig.png"},
  65. inventory_image = "willow_twig.png",
  66. wield_image = "willow_twig.png",
  67. paramtype = "light",
  68. walkable = ethereal.leafwalk,
  69. visual_scale = 1.4,
  70. waving = 1,
  71. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  72. drop = {
  73. max_items = 1,
  74. items = {
  75. {items = {"ethereal:willow_sapling"}, rarity = 50},
  76. {items = {"ethereal:willow_twig"}}
  77. }
  78. },
  79. sounds = default.node_sound_leaves_defaults(),
  80. after_place_node = default.after_place_leaves,
  81. })
  82. -- redwood leaves
  83. minetest.register_node("ethereal:redwood_leaves", {
  84. description = S("Redwood Leaves"),
  85. drawtype = leaftype,
  86. visual_scale = 1.4,
  87. tiles = {"redwood_leaves.png"},
  88. inventory_image = "redwood_leaves.png",
  89. wield_image = "redwood_leaves.png",
  90. paramtype = "light",
  91. walkable = ethereal.leafwalk,
  92. waving = 1,
  93. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  94. drop = {
  95. max_items = 1,
  96. items = {
  97. {items = {"ethereal:redwood_sapling"}, rarity = 50},
  98. {items = {"ethereal:redwood_leaves"}}
  99. }
  100. },
  101. sounds = default.node_sound_leaves_defaults(),
  102. after_place_node = default.after_place_leaves,
  103. })
  104. -- orange tree leaves
  105. minetest.register_node("ethereal:orange_leaves", {
  106. description = S("Orange Leaves"),
  107. drawtype = leaftype,
  108. visual_scale = 1.4,
  109. tiles = {"orange_leaves.png"},
  110. inventory_image = "orange_leaves.png",
  111. wield_image = "orange_leaves.png",
  112. paramtype = "light",
  113. walkable = ethereal.leafwalk,
  114. waving = 1,
  115. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  116. drop = {
  117. max_items = 1,
  118. items = {
  119. {items = {"ethereal:orange_tree_sapling"}, rarity = 15},
  120. {items = {"ethereal:orange_leaves"}}
  121. }
  122. },
  123. sounds = default.node_sound_leaves_defaults(),
  124. after_place_node = default.after_place_leaves,
  125. })
  126. -- banana tree leaves
  127. minetest.register_node("ethereal:bananaleaves", {
  128. description = S("Banana Leaves"),
  129. drawtype = leaftype,
  130. visual_scale = 1.4,
  131. tiles = {"banana_leaf.png"},
  132. inventory_image = "banana_leaf.png",
  133. wield_image = "banana_leaf.png",
  134. paramtype = "light",
  135. walkable = ethereal.leafwalk,
  136. waving = 1,
  137. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  138. drop = {
  139. max_items = 1,
  140. items = {
  141. {items = {"ethereal:banana_tree_sapling"}, rarity = 10},
  142. {items = {"ethereal:bananaleaves"}}
  143. }
  144. },
  145. sounds = default.node_sound_leaves_defaults(),
  146. after_place_node = default.after_place_leaves,
  147. })
  148. -- healing tree leaves
  149. minetest.register_node("ethereal:yellowleaves", {
  150. description = S("Healing Tree Leaves"),
  151. drawtype = leaftype,
  152. visual_scale = 1.4,
  153. tiles = {"yellow_leaves.png"},
  154. inventory_image = "yellow_leaves.png",
  155. wield_image = "yellow_leaves.png",
  156. paramtype = "light",
  157. walkable = ethereal.leafwalk,
  158. waving = 1,
  159. groups = {snappy = 3, leafdecay = 3, leaves = 1},
  160. drop = {
  161. max_items = 1,
  162. items = {
  163. {items = {"ethereal:yellow_tree_sapling"}, rarity = 50},
  164. {items = {"ethereal:yellowleaves"}}
  165. }
  166. },
  167. -- one leaf heals half a heart when eaten
  168. on_use = minetest.item_eat(1),
  169. sounds = default.node_sound_leaves_defaults(),
  170. after_place_node = default.after_place_leaves,
  171. light_source = 9,
  172. })
  173. -- palm tree leaves
  174. minetest.register_node("ethereal:palmleaves", {
  175. description = S("Palm Leaves"),
  176. drawtype = leaftype,
  177. visual_scale = 1.4,
  178. tiles = {"moretrees_palm_leaves.png"},
  179. inventory_image = "moretrees_palm_leaves.png",
  180. wield_image = "moretrees_palm_leaves.png",
  181. paramtype = "light",
  182. walkable = ethereal.leafwalk,
  183. waving = 1,
  184. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  185. drop = {
  186. max_items = 1,
  187. items = {
  188. {items = {"ethereal:palm_sapling"}, rarity = 10},
  189. {items = {"ethereal:palmleaves"}}
  190. }
  191. },
  192. sounds = default.node_sound_leaves_defaults(),
  193. after_place_node = default.after_place_leaves,
  194. })
  195. -- birch tree leaves
  196. minetest.register_node("ethereal:birch_leaves", {
  197. description = S("Birch Leaves"),
  198. drawtype = leaftype,
  199. visual_scale = 1.4,
  200. tiles = {"moretrees_birch_leaves.png"},
  201. inventory_image = "moretrees_birch_leaves.png",
  202. wield_image = "moretrees_birch_leaves.png",
  203. paramtype = "light",
  204. walkable = ethereal.leafwalk,
  205. waving = 1,
  206. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  207. drop = {
  208. max_items = 1,
  209. items = {
  210. {items = {"ethereal:birch_sapling"}, rarity = 20},
  211. {items = {"ethereal:birch_leaves"}}
  212. }
  213. },
  214. sounds = default.node_sound_leaves_defaults(),
  215. after_place_node = default.after_place_leaves,
  216. })
  217. -- frost tree leaves
  218. minetest.register_node("ethereal:frost_leaves", {
  219. description = S("Frost Leaves"),
  220. drawtype = leaftype,
  221. visual_scale = 1.4,
  222. tiles = {"ethereal_frost_leaves.png"},
  223. inventory_image = "ethereal_frost_leaves.png",
  224. wield_image = "ethereal_frost_leaves.png",
  225. paramtype = "light",
  226. walkable = ethereal.leafwalk,
  227. waving = 1,
  228. groups = {snappy = 3, leafdecay = 3, leaves = 1, puts_out_fire = 1},
  229. drop = {
  230. max_items = 1,
  231. items = {
  232. {items = {"ethereal:frost_tree_sapling"}, rarity = 15},
  233. {items = {"ethereal:frost_leaves"}}
  234. }
  235. },
  236. light_source = 9,
  237. sounds = default.node_sound_leaves_defaults(),
  238. after_place_node = default.after_place_leaves,
  239. })
  240. -- bamboo stalk leaves
  241. minetest.register_node("ethereal:bamboo_leaves", {
  242. description = S("Bamboo Leaves"),
  243. drawtype = leaftype,
  244. visual_scale = 1.4,
  245. tiles = {"bamboo_leaves.png"},
  246. inventory_image = "bamboo_leaves.png",
  247. wield_image = "bamboo_leaves.png",
  248. paramtype = "light",
  249. walkable = ethereal.leafwalk,
  250. waving = 1,
  251. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  252. drop = {
  253. max_items = 1,
  254. items = {
  255. {items = {"ethereal:bamboo_sprout"}, rarity = 10},
  256. {items = {"ethereal:bamboo_leaves"}}
  257. }
  258. },
  259. sounds = default.node_sound_leaves_defaults(),
  260. after_place_node = default.after_place_leaves,
  261. })
  262. -- sakura leaves
  263. minetest.register_node("ethereal:sakura_leaves", {
  264. description = S("Sakura Leaves"),
  265. drawtype = leaftype,
  266. visual_scale = 1.4,
  267. tiles = {"ethereal_sakura_leaves.png"},
  268. inventory_image = "ethereal_sakura_leaves.png",
  269. wield_image = "ethereal_sakura_leaves.png",
  270. paramtype = "light",
  271. walkable = ethereal.leafwalk,
  272. waving = 1,
  273. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  274. drop = {
  275. max_items = 1,
  276. items = {
  277. {items = {"ethereal:sakura_sapling"}, rarity = 30},
  278. {items = {"ethereal:sakura_leaves"}}
  279. }
  280. },
  281. sounds = default.node_sound_leaves_defaults(),
  282. after_place_node = default.after_place_leaves,
  283. })
  284. minetest.register_node("ethereal:sakura_leaves2", {
  285. description = S("Sakura Leaves"),
  286. drawtype = leaftype,
  287. visual_scale = 1.4,
  288. tiles = {"ethereal_sakura_leaves2.png"},
  289. inventory_image = "ethereal_sakura_leaves2.png",
  290. wield_image = "ethereal_sakura_leaves2.png",
  291. paramtype = "light",
  292. walkable = ethereal.leafwalk,
  293. waving = 1,
  294. groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
  295. drop = {
  296. max_items = 1,
  297. items = {
  298. {items = {"ethereal:sakura_sapling"}, rarity = 30},
  299. {items = {"ethereal:sakura_leaves2"}}
  300. }
  301. },
  302. sounds = default.node_sound_leaves_defaults(),
  303. after_place_node = default.after_place_leaves,
  304. })
  305. -- mushroom tops
  306. minetest.register_node("ethereal:mushroom", {
  307. description = S("Mushroom Cap"),
  308. tiles = {"mushroom_block.png"},
  309. groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  310. drop = {
  311. max_items = 1,
  312. items = {
  313. {items = {"ethereal:mushroom_sapling"}, rarity = 20},
  314. {items = {"ethereal:mushroom"}}
  315. }
  316. },
  317. sounds = default.node_sound_wood_defaults(),
  318. })
  319. minetest.register_craft({
  320. type = "fuel",
  321. recipe = "ethereal:mushroom",
  322. burntime = 10,
  323. })
  324. -- mushroom pore (spongelike material found inside giant shrooms)
  325. minetest.register_node("ethereal:mushroom_pore", {
  326. description = S("Mushroom Pore"),
  327. tiles = {"mushroom_pore.png"},
  328. groups = {
  329. snappy = 3, cracky = 3, choppy = 3, oddly_breakable_by_hand = 3,
  330. flammable = 2, disable_jump = 1, fall_damage_add_percent = -100
  331. },
  332. sounds = default.node_sound_dirt_defaults(),
  333. })
  334. minetest.register_craft({
  335. type = "fuel",
  336. recipe = "ethereal:mushroom_pore",
  337. burntime = 3,
  338. })
  339. -- hedge block
  340. minetest.register_node("ethereal:bush", {
  341. description = S("Bush"),
  342. tiles = {"ethereal_bush.png"},
  343. walkable = true,
  344. groups = {snappy = 3, flammable = 2},
  345. sounds = default.node_sound_leaves_defaults(),
  346. })
  347. minetest.register_craft({
  348. output = "ethereal:bush",
  349. recipe = {
  350. {"group:leaves", "group:leaves", "group:leaves"},
  351. {"group:leaves", "ethereal:bamboo_leaves", "group:leaves"},
  352. {"group:leaves", "group:leaves", "group:leaves"},
  353. }
  354. })
  355. minetest.register_craft({
  356. type = "fuel",
  357. recipe = "ethereal:bush",
  358. burntime = 1,
  359. })
  360. -- bush block #2
  361. minetest.register_node("ethereal:bush2", {
  362. drawtype = "allfaces_optional",
  363. description = S("Bush #2"),
  364. tiles = {"default_aspen_leaves.png"},
  365. paramtype = "light",
  366. walkable = true,
  367. groups = {snappy = 3, flammable = 2},
  368. sounds = default.node_sound_leaves_defaults(),
  369. })
  370. minetest.register_craft({
  371. output = "ethereal:bush2",
  372. recipe = {
  373. {"group:leaves", "group:leaves", "group:leaves"},
  374. {"group:leaves", "default:aspen_leaves", "group:leaves"},
  375. {"group:leaves", "group:leaves", "group:leaves"},
  376. }
  377. })
  378. minetest.register_craft({
  379. type = "fuel",
  380. recipe = "ethereal:bush2",
  381. burntime = 1,
  382. })
  383. -- bush block #3
  384. minetest.register_node("ethereal:bush3", {
  385. drawtype = "allfaces_optional",
  386. description = S("Bush #3"),
  387. tiles = {"default_pine_needles.png"},
  388. paramtype = "light",
  389. walkable = true,
  390. groups = {snappy = 3, flammable = 2},
  391. sounds = default.node_sound_leaves_defaults(),
  392. })
  393. minetest.register_craft({
  394. output = "ethereal:bush3",
  395. recipe = {
  396. {"group:leaves", "group:leaves", "group:leaves"},
  397. {"group:leaves", "default:pine_needles", "group:leaves"},
  398. {"group:leaves", "group:leaves", "group:leaves"},
  399. }
  400. })
  401. minetest.register_craft({
  402. type = "fuel",
  403. recipe = "ethereal:bush3",
  404. burntime = 1,
  405. })
  406. -- compatibility check for new mt version with leafdecay function
  407. if minetest.registered_nodes["default:dirt_with_rainforest_litter"] then
  408. default.register_leafdecay({
  409. trunks = {"default:tree"},
  410. leaves = {"default:apple", "default:leaves", "ethereal:orange", "ethereal:orange_leaves"},
  411. radius = 3
  412. })
  413. default.register_leafdecay({
  414. trunks = {"ethereal:willow_trunk"},
  415. leaves = {"ethereal:willow_twig"},
  416. radius = 3
  417. })
  418. default.register_leafdecay({
  419. trunks = {"ethereal:redwood_trunk"},
  420. leaves = {"ethereal:redwood_leaves"},
  421. radius = 3
  422. })
  423. default.register_leafdecay({
  424. trunks = {"ethereal:frost_tree"},
  425. leaves = {"ethereal:frost_leaves"},
  426. radius = 3
  427. })
  428. default.register_leafdecay({
  429. trunks = {"ethereal:yellow_trunk"},
  430. leaves = {"ethereal:yellowleaves", "ethereal:golden_apple"},
  431. radius = 3
  432. })
  433. default.register_leafdecay({
  434. trunks = {"ethereal:palm_trunk"},
  435. leaves = {"ethereal:palmleaves", "ethereal:coconut"},
  436. radius = 3
  437. })
  438. default.register_leafdecay({
  439. trunks = {"ethereal:banana_trunk"},
  440. leaves = {"ethereal:bananaleaves", "ethereal:banana"},
  441. radius = 3
  442. })
  443. default.register_leafdecay({
  444. trunks = {"ethereal:birch_trunk"},
  445. leaves = {"ethereal:birch_leaves"},
  446. radius = 3
  447. })
  448. default.register_leafdecay({
  449. trunks = {"ethereal:bamboo"},
  450. leaves = {"ethereal:bamboo_leaves"},
  451. radius = 2
  452. })
  453. default.register_leafdecay({
  454. trunks = {"ethereal:sakura_trunk"},
  455. leaves = {"ethereal:sakura_leaves", "ethereal:sakura_leaves2"},
  456. radius = 3
  457. })
  458. end