l_system_gen.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. minetest.register_decoration({
  2. name = "eg_trees:ls",
  3. deco_type = "simple",
  4. place_on = "eg_mapgen:sand",
  5. y_min = 0,
  6. y_max = 10,
  7. fill_ratio = 0.001,
  8. decoration = "air",
  9. place_offset_y = -1,
  10. })
  11. local lstrees = minetest.get_decoration_id("eg_trees:ls")
  12. local big = minetest.get_decoration_id("eg_trees:largels")
  13. minetest.set_gen_notify({decoration = true}, {lstrees})
  14. minetest.set_gen_notify({decoration = true}, {big})
  15. minetest.register_alias("mapgen_dirt", "eg_mapgen:dirt")
  16. minetest.register_on_generated(function(minp, maxp, blockseed)
  17. local gennotify = minetest.get_mapgen_object("gennotify")
  18. for _, pos in ipairs(gennotify["decoration#" .. lstrees] or {}) do
  19. pos.y = pos.y + 1
  20. if minetest.get_node(pos).name == "air" then
  21. minetest.spawn_tree(pos, {
  22. axiom="*TdddcbbbbTTTT&&A",
  23. rules_a = "[fff&ff]+[fff]+[fff&ff]+[fff]+[fff&ff]+[fff]+[fff&ff]+[fff]",
  24. rules_b = "TT",
  25. rules_c = "&",
  26. rules_d = "**",
  27. trunk="eg_trees:wood",
  28. leaves="eg_trees:leaves",
  29. angle = 45,
  30. iterations=8,
  31. random_level=9,
  32. trunk_type="single",
  33. thin_branches=true,
  34. fruit_chance= 0,
  35. })
  36. end
  37. end
  38. end)