Vanessa's plantlife modpack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.6KB

  1. -----------------------------------------------------------------------------------------------
  2. -- Grasses - Juncus 0.0.5
  3. -----------------------------------------------------------------------------------------------
  4. -- by Mossmanikin
  5. -- textures & ideas partly by Neuromancer
  6. -- License (everything): WTFPL
  7. -- Contains code from: biome_lib
  8. -- Looked at code from: default
  9. -----------------------------------------------------------------------------------------------
  10. abstract_dryplants.grow_juncus = function(pos)
  11. local juncus_type = math.random(2,3)
  12. local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
  13. if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
  14. or minetest.get_node(right_here).name == "default:junglegrass" then
  15. if juncus_type == 2 then
  16. minetest.set_node(right_here, {name="dryplants:juncus_02"})
  17. else
  18. minetest.set_node(right_here, {name="dryplants:juncus"})
  19. end
  20. end
  21. end
  22. minetest.register_node("dryplants:juncus", {
  23. description = "Juncus",
  24. drawtype = "plantlike",
  25. visual_scale = 2,
  26. paramtype = "light",
  27. tiles = {"dryplants_juncus_03.png"},
  28. inventory_image = "dryplants_juncus_inv.png",
  29. walkable = false,
  30. buildable_to = true,
  31. groups = {
  32. snappy=3,
  33. flammable=2,
  34. attached_node=1,
  35. flora=1
  36. --not_in_creative_inventory=1
  37. },
  38. sounds = default.node_sound_leaves_defaults(),
  39. selection_box = {
  40. type = "fixed",
  41. fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16},
  42. },
  43. on_place = function(itemstack, placer, pointed_thing)
  44. local pos = pointed_thing.under
  45. local juncus_type = math.random(2,3)
  46. local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
  47. if juncus_type == 2 then
  48. minetest.set_node(right_here, {name="dryplants:juncus_02"})
  49. else
  50. minetest.set_node(right_here, {name="dryplants:juncus"})
  51. end
  52. if not minetest.setting_getbool("creative_mode") then
  53. itemstack:take_item()
  54. end
  55. return itemstack
  56. end,
  57. })
  58. minetest.register_node("dryplants:juncus_02", {
  59. description = "Juncus",
  60. drawtype = "plantlike",
  61. visual_scale = 2,
  62. paramtype = "light",
  63. tiles = {"dryplants_juncus_02.png"},
  64. walkable = false,
  65. buildable_to = true,
  66. groups = {
  67. snappy=3,
  68. flammable=2,
  69. attached_node=1,
  70. flora=1,
  71. not_in_creative_inventory=1
  72. },
  73. sounds = default.node_sound_leaves_defaults(),
  74. selection_box = {
  75. type = "fixed",
  76. fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16},
  77. },
  78. drop = "dryplants:juncus",
  79. })
  80. -----------------------------------------------------------------------------------------------
  81. -- GENERATE SMALL JUNCUS
  82. -----------------------------------------------------------------------------------------------
  83. -- near water or swamp
  84. biome_lib:register_generate_plant({
  85. surface = {
  86. "default:dirt_with_grass",
  87. --"default:desert_sand",
  88. --"default:sand",
  89. "stoneage:grass_with_silex",
  90. "sumpf:peat",
  91. "sumpf:sumpf"
  92. },
  93. max_count = JUNCUS_NEAR_WATER_PER_MAPBLOCK,
  94. rarity = 101 - JUNCUS_NEAR_WATER_RARITY,
  95. min_elevation = 1, -- above sea level
  96. near_nodes = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"},
  97. near_nodes_size = 2,
  98. near_nodes_vertical = 1,
  99. near_nodes_count = 1,
  100. plantlife_limit = -0.9,
  101. },
  102. abstract_dryplants.grow_juncus
  103. )
  104. -- at dunes/beach
  105. biome_lib:register_generate_plant({
  106. surface = {
  107. --"default:dirt_with_grass",
  108. --"default:desert_sand",
  109. "default:sand",
  110. --"stoneage:grass_with_silex",
  111. --"sumpf:peat",
  112. --"sumpf:sumpf"
  113. },
  114. max_count = JUNCUS_AT_BEACH_PER_MAPBLOCK,
  115. rarity = 101 - JUNCUS_AT_BEACH_RARITY,
  116. min_elevation = 1, -- above sea level
  117. near_nodes = {"default:dirt_with_grass"},
  118. near_nodes_size = 2,
  119. near_nodes_vertical = 1,
  120. near_nodes_count = 1,
  121. plantlife_limit = -0.9,
  122. },
  123. abstract_dryplants.grow_juncus
  124. )