saplings.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. -- sapling growth
  2. -- these tables only affect hand-placed saplings
  3. -- mapgen-placed always use their biome def settings, which are much more
  4. -- limited, in the interest of speed.
  5. local dirt_surfaces = {
  6. set = true,
  7. ["default:dirt"] = true,
  8. ["default:dirt_with_grass"] = true,
  9. ["default:dirt_with_dry_grass"] = true,
  10. ["default:dirt_with_coniferous_litter"] = true,
  11. ["default:dirt_with_rainforest_litter"] = true,
  12. ["woodsoils:dirt_with_leaves_1"] = true,
  13. ["woodsoils:dirt_with_leaves_2"] = true,
  14. ["woodsoils:grass_with_leaves_1"] = true,
  15. ["woodsoils:grass_with_leaves_2"] = true
  16. }
  17. local conifer_surfaces = {
  18. set = true,
  19. ["default:dirt"] = true,
  20. ["default:dirt_with_grass"] = true,
  21. ["default:dirt_with_dry_grass"] = true,
  22. ["default:dirt_with_coniferous_litter"] = true,
  23. ["default:dirt_with_rainforest_litter"] = true,
  24. ["woodsoils:dirt_with_leaves_1"] = true,
  25. ["woodsoils:dirt_with_leaves_2"] = true,
  26. ["woodsoils:grass_with_leaves_1"] = true,
  27. ["woodsoils:grass_with_leaves_2"] = true,
  28. ["default:dirt_with_snow"] = true
  29. }
  30. local sand_surfaces = {
  31. set = true,
  32. ["default:sand"] = true,
  33. ["default:desert_sand"] = true,
  34. ["cottages:loam"] = true,
  35. -- note, no silver sand here.
  36. -- too cold for a palm, too... well... sandy for anything else.
  37. }
  38. for i in ipairs(moretrees.treelist) do
  39. local treename = moretrees.treelist[i][1]
  40. local tree_model = treename.."_model"
  41. local tree_biome = treename.."_biome"
  42. local surfaces
  43. local grow_function = moretrees[tree_model]
  44. if treename == "spruce"
  45. or treename == "fir"
  46. or treename == "cedar"
  47. or treename == "pine" then
  48. surfaces = conifer_surfaces
  49. elseif string.find(treename, "palm") then
  50. surfaces = sand_surfaces
  51. else
  52. surfaces = dirt_surfaces
  53. end
  54. if treename == "spruce"
  55. or treename == "fir"
  56. or treename == "birch"
  57. or treename == "jungletree" then
  58. grow_function = "moretrees.grow_"..treename
  59. end
  60. biome_lib:dbg(dump(moretrees[tree_biome].surface))
  61. biome_lib:grow_plants({
  62. grow_delay = moretrees.sapling_interval,
  63. grow_chance = moretrees.sapling_chance,
  64. grow_plant = "moretrees:"..treename.."_sapling",
  65. grow_nodes = surfaces,
  66. grow_function = grow_function,
  67. })
  68. biome_lib:grow_plants({
  69. grow_delay = 2,
  70. grow_chance = 1,
  71. grow_plant = "moretrees:"..treename.."_sapling_ongen",
  72. grow_nodes = surfaces,
  73. grow_function = grow_function,
  74. })
  75. end