leaves.lua 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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 = {"willow_twig.png"},
  67. inventory_image = "willow_twig.png",
  68. wield_image = "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 = {"redwood_leaves.png"},
  90. inventory_image = "redwood_leaves.png",
  91. wield_image = "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 = {"orange_leaves.png"},
  112. inventory_image = "orange_leaves.png",
  113. wield_image = "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 = {"banana_leaf.png"},
  134. inventory_image = "banana_leaf.png",
  135. wield_image = "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 = {"yellow_leaves.png"},
  156. inventory_image = "yellow_leaves.png",
  157. wield_image = "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 = {"bamboo_leaves.png"},
  248. inventory_image = "bamboo_leaves.png",
  249. wield_image = "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. -- mushroom tops
  308. minetest.register_node("ethereal:mushroom", {
  309. description = S("Mushroom Cap"),
  310. tiles = {"mushroom_block.png"},
  311. groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  312. drop = {
  313. max_items = 1,
  314. items = {
  315. {items = {"ethereal:mushroom_sapling"}, rarity = 20},
  316. {items = {"ethereal:mushroom"}}
  317. }
  318. },
  319. sounds = default.node_sound_wood_defaults(),
  320. })
  321. minetest.register_craft({
  322. type = "fuel",
  323. recipe = "ethereal:mushroom",
  324. burntime = 10,
  325. })
  326. -- mushroom pore (spongelike material found inside giant shrooms)
  327. minetest.register_node("ethereal:mushroom_pore", {
  328. description = S("Mushroom Pore"),
  329. tiles = {"mushroom_pore.png"},
  330. groups = {
  331. snappy = 3, cracky = 3, choppy = 3, oddly_breakable_by_hand = 3,
  332. flammable = 2, disable_jump = 1, fall_damage_add_percent = -100
  333. },
  334. sounds = default.node_sound_dirt_defaults(),
  335. })
  336. minetest.register_craft({
  337. type = "fuel",
  338. recipe = "ethereal:mushroom_pore",
  339. burntime = 3,
  340. })
  341. -- hedge block
  342. minetest.register_node("ethereal:bush", {
  343. description = S("Bush"),
  344. tiles = {"ethereal_bush.png"},
  345. walkable = true,
  346. groups = {snappy = 3, flammable = 2},
  347. sounds = default.node_sound_leaves_defaults(),
  348. })
  349. minetest.register_craft({
  350. output = "ethereal:bush",
  351. recipe = {
  352. {"group:leaves", "group:leaves", "group:leaves"},
  353. {"group:leaves", "ethereal:bamboo_leaves", "group:leaves"},
  354. {"group:leaves", "group:leaves", "group:leaves"},
  355. }
  356. })
  357. minetest.register_craft({
  358. type = "fuel",
  359. recipe = "ethereal:bush",
  360. burntime = 1,
  361. })
  362. -- bush block #2
  363. minetest.register_node("ethereal:bush2", {
  364. drawtype = "allfaces_optional",
  365. description = S("Bush #2"),
  366. tiles = {"default_aspen_leaves.png"},
  367. paramtype = "light",
  368. walkable = true,
  369. groups = {snappy = 3, flammable = 2},
  370. sounds = default.node_sound_leaves_defaults(),
  371. })
  372. minetest.register_craft({
  373. output = "ethereal:bush2",
  374. recipe = {
  375. {"group:leaves", "group:leaves", "group:leaves"},
  376. {"group:leaves", "default:aspen_leaves", "group:leaves"},
  377. {"group:leaves", "group:leaves", "group:leaves"},
  378. }
  379. })
  380. minetest.register_craft({
  381. type = "fuel",
  382. recipe = "ethereal:bush2",
  383. burntime = 1,
  384. })
  385. -- bush block #3
  386. minetest.register_node("ethereal:bush3", {
  387. drawtype = "allfaces_optional",
  388. description = S("Bush #3"),
  389. tiles = {"default_pine_needles.png"},
  390. paramtype = "light",
  391. walkable = true,
  392. groups = {snappy = 3, flammable = 2},
  393. sounds = default.node_sound_leaves_defaults(),
  394. })
  395. minetest.register_craft({
  396. output = "ethereal:bush3",
  397. recipe = {
  398. {"group:leaves", "group:leaves", "group:leaves"},
  399. {"group:leaves", "default:pine_needles", "group:leaves"},
  400. {"group:leaves", "group:leaves", "group:leaves"},
  401. }
  402. })
  403. minetest.register_craft({
  404. type = "fuel",
  405. recipe = "ethereal:bush3",
  406. burntime = 1,
  407. })
  408. -- compatibility check for new mt version with leafdecay function
  409. if minetest.registered_nodes["default:dirt_with_rainforest_litter"] then
  410. default.register_leafdecay({
  411. trunks = {"default:tree"},
  412. leaves = {
  413. "default:apple", "default:leaves", "ethereal:orange",
  414. "ethereal:orange_leaves", "ethereal:vine"},
  415. radius = 3
  416. })
  417. default.register_leafdecay({
  418. trunks = {"ethereal:willow_trunk"},
  419. leaves = {"ethereal:willow_twig"},
  420. radius = 3
  421. })
  422. default.register_leafdecay({
  423. trunks = {"ethereal:redwood_trunk"},
  424. leaves = {"ethereal:redwood_leaves"},
  425. radius = 3
  426. })
  427. default.register_leafdecay({
  428. trunks = {"ethereal:frost_tree"},
  429. leaves = {"ethereal:frost_leaves"},
  430. radius = 3
  431. })
  432. default.register_leafdecay({
  433. trunks = {"ethereal:yellow_trunk"},
  434. leaves = {"ethereal:yellowleaves", "ethereal:golden_apple"},
  435. radius = 3
  436. })
  437. default.register_leafdecay({
  438. trunks = {"ethereal:palm_trunk"},
  439. leaves = {"ethereal:palmleaves", "ethereal:coconut"},
  440. radius = 3
  441. })
  442. default.register_leafdecay({
  443. trunks = {"ethereal:banana_trunk"},
  444. leaves = {"ethereal:bananaleaves", "ethereal:banana"},
  445. radius = 3
  446. })
  447. default.register_leafdecay({
  448. trunks = {"ethereal:birch_trunk"},
  449. leaves = {"ethereal:birch_leaves"},
  450. radius = 3
  451. })
  452. default.register_leafdecay({
  453. trunks = {"ethereal:bamboo"},
  454. leaves = {"ethereal:bamboo_leaves"},
  455. radius = 2
  456. })
  457. default.register_leafdecay({
  458. trunks = {"ethereal:sakura_trunk"},
  459. leaves = {"ethereal:sakura_leaves", "ethereal:sakura_leaves2"},
  460. radius = 3
  461. })
  462. end