init.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. -- If any trees get added to the game, consider extending this list.
  2. local all_trees = {
  3. {trunk="basictrees:acacia_trunk"},
  4. {trunk="basictrees:aspen_trunk"},
  5. {trunk="basictrees:jungletree_trunk"},
  6. {trunk="basictrees:pine_trunk"},
  7. {trunk="basictrees:tree_trunk"},
  8. {trunk="jungletree:jungletree_tree"},
  9. {trunk="firetree:trunk"},
  10. {trunk="moretrees:apple_tree_tree"},
  11. {trunk="moretrees:beech_tree"},
  12. {trunk="moretrees:birch_tree"},
  13. {trunk="moretrees:cedar_tree"},
  14. {trunk="moretrees:date_palm_tree"},
  15. {trunk="moretrees:fir_tree"},
  16. {trunk="moretrees:jungletree_tree"},
  17. {trunk="moretrees:oak_tree"},
  18. {trunk="moretrees:palm_tree"},
  19. {trunk="moretrees:poplar_tree"},
  20. {trunk="moretrees:rubber_tree_tree"},
  21. {trunk="moretrees:sequoia_tree"},
  22. {trunk="moretrees:spruce_tree"},
  23. {trunk="moretrees:willow_tree"},
  24. }
  25. -- For all listed tree trunk nodes, register cuttings for them.
  26. for _, tree in ipairs(all_trees) do
  27. assert(type(tree.trunk) == "string")
  28. local ndef = minetest.registered_items[tree.trunk]
  29. assert(ndef)
  30. assert(ndef.sounds)
  31. assert(ndef.tiles)
  32. assert(ndef.description)
  33. local stairname = string.split(tree.trunk, ":")[2]
  34. assert(type(stairname) == "string")
  35. stairs.register_stair_and_slab(
  36. stairname,
  37. tree.trunk,
  38. {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2},
  39. ndef.tiles,
  40. ndef.description,
  41. ndef.sounds
  42. )
  43. end