init.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. -- This file supplies jungle grass for the plantlife modpack
  2. -- Last revision: 2013-01-24
  3. local SPAWN_DELAY = 1000
  4. local SPAWN_CHANCE = 200
  5. local GROW_DELAY = 500
  6. local GROW_CHANCE = 30
  7. local junglegrass_seed_diff = 329
  8. local grasses_list = {
  9. {"junglegrass:shortest","junglegrass:short" },
  10. {"junglegrass:short" ,"junglegrass:medium" },
  11. {"junglegrass:medium" ,"default:junglegrass" },
  12. {"default:junglegrass" , nil}
  13. }
  14. minetest.register_node('junglegrass:medium', {
  15. description = "Jungle Grass (medium height)",
  16. drawtype = 'nodebox',
  17. node_box = {
  18. type = "fixed",
  19. fixed = {
  20. {-0.125, -0.5, -0.125, 0.125, 0.0625, 0.125}, -- NodeBox18
  21. {0.125, 0.0625, -0.125, 0.375, 0.3125, 0.125}, -- NodeBox19
  22. {0.25, -0.5, 0.25, 0.5, -0.25, 0.5}, -- NodeBox20
  23. {-0.5, -0.5, 0.25, -0.25, -0.375, 0.5}, -- NodeBox21
  24. {0.25, -0.5, -0.5, 0.5, -0.3125, -0.25}, -- NodeBox22
  25. {-0.5, -0.5, -0.5, -0.25, -0.1875, -0.25}, -- NodeBox23
  26. }
  27. },
  28. tile_images = { 'junglegrass.png' },
  29. inventory_image = 'junglegrass_medium.png',
  30. wield_image = 'junglegrass_medium.png',
  31. sunlight_propagates = true,
  32. paramtype = 'light',
  33. paramtype2 = "facedir",
  34. walkable = false,
  35. groups = { snappy = 3, flammable=2, junglegrass=1, flora=1 },
  36. sounds = default.node_sound_leaves_defaults(),
  37. drop = 'default:junglegrass',
  38. selection_box = {
  39. type = "fixed",
  40. fixed = {-0.4, -0.5, -0.4, 0.4, 0.5, 0.4},
  41. },
  42. buildable_to = true,
  43. })
  44. minetest.register_node('junglegrass:short', {
  45. description = "Jungle Grass (short)",
  46. drawtype = 'nodebox',
  47. node_box = {
  48. type = "fixed",
  49. fixed = {
  50. {-0.125, -0.5, -0.125, 0.125, -0.0625, 0.125}, -- NodeBox18
  51. {0.125, -0.0625, -0.125, 0.375, 0.1875, 0.125}, -- NodeBox19
  52. {0.25, -0.5, 0.25, 0.5, -0.3125, 0.5}, -- NodeBox20
  53. {-0.5, -0.5, 0.25, -0.25, -0.4375, 0.5}, -- NodeBox21
  54. {0.25, -0.5, -0.5, 0.5, -0.375, -0.25}, -- NodeBox22
  55. {-0.5, -0.5, -0.5, -0.25, -0.3125, -0.25}, -- NodeBox23
  56. }
  57. },
  58. tile_images = { 'junglegrass.png' },
  59. inventory_image = 'junglegrass_short.png',
  60. wield_image = 'junglegrass_short.png',
  61. sunlight_propagates = true,
  62. paramtype = 'light',
  63. paramtype2 = "facedir",
  64. walkable = false,
  65. groups = { snappy = 3, flammable=2, junglegrass=1, flora=1 },
  66. sounds = default.node_sound_leaves_defaults(),
  67. drop = 'default:junglegrass',
  68. selection_box = {
  69. type = "fixed",
  70. fixed = {-0.4, -0.5, -0.4, 0.4, 0.3, 0.4},
  71. },
  72. buildable_to = true,
  73. })
  74. minetest.register_node('junglegrass:shortest', {
  75. description = "Jungle Grass (very short)",
  76. drawtype = "nodebox",
  77. node_box = {
  78. type = "fixed",
  79. fixed = {
  80. {-0.125, -0.5, -0.125, 0.125, -0.0625, 0.125}, -- NodeBox18
  81. {0.125, -0.0625, -0.125, 0.375, 0.1875, 0.125}, -- NodeBox19
  82. }
  83. },
  84. tile_images = { 'junglegrass.png' },
  85. inventory_image = 'junglegrass_shortest.png',
  86. wield_image = 'junglegrass_shortest.png',
  87. sunlight_propagates = true,
  88. paramtype = 'light',
  89. paramtype2 = "facedir",
  90. walkable = false,
  91. groups = { snappy = 3, flammable=2, junglegrass=1, flora=1 },
  92. sounds = default.node_sound_leaves_defaults(),
  93. drop = 'default:junglegrass',
  94. selection_box = {
  95. type = "fixed",
  96. fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3},
  97. },
  98. buildable_to = true,
  99. })
  100. plantslib:spawn_on_surfaces({
  101. spawn_delay = SPAWN_DELAY,
  102. spawn_plants = {"junglegrass:shortest"},
  103. avoid_radius = 4,
  104. spawn_chance = SPAWN_CHANCE,
  105. spawn_surfaces = {"default:dirt_with_grass", "default:cactus", "default:papyrus"},
  106. avoid_nodes = {"group:junglegrass", "default:junglegrass", "default:dry_shrub"},
  107. seed_diff = junglegrass_seed_diff,
  108. light_min = 5
  109. })
  110. plantslib:spawn_on_surfaces({
  111. spawn_delay = SPAWN_DELAY,
  112. spawn_plants = {"junglegrass:shortest"},
  113. avoid_radius = 4,
  114. spawn_chance = SPAWN_CHANCE*2,
  115. spawn_surfaces = {"default:sand"},
  116. avoid_nodes = {"group:junglegrass", "default:junglegrass", "default:dry_shrub"},
  117. seed_diff = junglegrass_seed_diff,
  118. light_min = 5
  119. })
  120. plantslib:spawn_on_surfaces({
  121. spawn_delay = SPAWN_DELAY,
  122. spawn_plants = {"junglegrass:shortest"},
  123. avoid_radius = 4,
  124. spawn_chance = SPAWN_CHANCE*5,
  125. spawn_surfaces = {"default:desert_sand"},
  126. avoid_nodes = {"group:junglegrass", "default:junglegrass", "default:dry_shrub"},
  127. seed_diff = junglegrass_seed_diff,
  128. light_min = 5
  129. })
  130. for i in ipairs(grasses_list) do
  131. plantslib:grow_plants({
  132. grow_delay = GROW_DELAY,
  133. grow_chance = GROW_CHANCE/2,
  134. grow_plant = grasses_list[i][1],
  135. grow_result = grasses_list[i][2],
  136. dry_early_node = "default:desert_sand",
  137. grow_nodes = {"default:dirt_with_grass", "default:sand", "default:desert_sand"}
  138. })
  139. end
  140. print("[Junglegrass] Loaded.")