common.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. if not minetest.global_exists("moretrees") then moretrees = {} end
  2. moretrees.can_grow = function(pos)
  3. return basictrees.can_grow(pos)
  4. end
  5. moretrees.sapling_selection_box = {
  6. type = "fixed",
  7. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3},
  8. }
  9. moretrees.sapling_groups = utility.dig_groups("plant", {
  10. flammable = 2,
  11. attached_node = 1,
  12. sapling = 1,
  13. })
  14. moretrees.tree_groups = utility.dig_groups("tree", {
  15. tree = 1,
  16. flammable = 2,
  17. })
  18. moretrees.get_wood_groups = function(extra)
  19. local groups = utility.dig_groups("wood", extra or {})
  20. groups.flammable = 2
  21. groups.wood = 1
  22. return groups
  23. end
  24. moretrees.stair_groups = utility.dig_groups("wood", {
  25. flammable = 2,
  26. })
  27. moretrees.leaves_groups = utility.dig_groups("leaves", {
  28. leafdecay = 3,
  29. flammable = 2,
  30. leaves = 1,
  31. green_leaves = 1,
  32. })
  33. moretrees.get_leafdrop_table = function(chance, sapling, leaves)
  34. local drop = {
  35. max_items = 1,
  36. items = {
  37. {items={sapling}, rarity=chance},
  38. {items={"default:stick"}, rarity=10},
  39. -- Player will get leaves only if he gets nothing else; this is because 'max_items' is 1.
  40. {items={leaves}},
  41. }
  42. }
  43. return drop
  44. end