leaves.lua 15 KB

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