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.

111 lines
4.5KB

  1. -----------------------------------------------------------------------------------------------
  2. local title = "Mole Hills"
  3. local version = "0.0.3"
  4. local mname = "molehills"
  5. -----------------------------------------------------------------------------------------------
  6. -- Idea by Sokomine
  7. -- Code & textures by Mossmanikin
  8. abstract_molehills = {}
  9. dofile(minetest.get_modpath("molehills").."/molehills_settings.txt")
  10. -----------------------------------------------------------------------------------------------
  11. -- NoDe
  12. -----------------------------------------------------------------------------------------------
  13. minetest.register_node("molehills:molehill",{
  14. drawtype = "nodebox",
  15. description = "Mole Hill",
  16. inventory_image = "molehills_side.png",
  17. tiles = {
  18. "molehills_dirt.png",--"molehill_top.png",
  19. "molehills_dirt.png",--"molehill_top.png",
  20. "molehills_dirt.png"--"molehill_side.png"
  21. },
  22. paramtype = "light",
  23. node_box = {
  24. type = "fixed",
  25. fixed = {
  26. -- { left, bottom, front, right, top, back}
  27. {-2/16, -3/16, -1/16, 2/16, -2/16, 1/16},
  28. {-1/16, -3/16, -2/16, 1/16, -2/16, 2/16},
  29. -- { left, bottom, front, right, top, back}
  30. {-4/16, -4/16, -2/16, 4/16, -3/16, 2/16},
  31. {-2/16, -4/16, -4/16, 2/16, -3/16, 4/16},
  32. {-3/16, -4/16, -3/16, 3/16, -3/16, 3/16},
  33. -- { left, bottom, front, right, top, back}
  34. {-5/16, -5/16, -2/16, 5/16, -4/16, 2/16},
  35. {-2/16, -5/16, -5/16, 2/16, -4/16, 5/16},
  36. {-4/16, -5/16, -4/16, 4/16, -4/16, 4/16},
  37. -- { left, bottom, front, right, top, back}
  38. {-6/16, -6/16, -2/16, 6/16, -5/16, 2/16},
  39. {-2/16, -6/16, -6/16, 2/16, -5/16, 6/16},
  40. {-5/16, -6/16, -4/16, 5/16, -5/16, 4/16},
  41. {-4/16, -6/16, -5/16, 4/16, -5/16, 5/16},
  42. -- { left, bottom, front, right, top, back}
  43. {-7/16, -7/16, -3/16, 7/16, -6/16, 3/16},
  44. {-3/16, -7/16, -7/16, 3/16, -6/16, 7/16},
  45. {-6/16, -7/16, -4/16, 6/16, -6/16, 4/16},
  46. {-4/16, -7/16, -6/16, 4/16, -6/16, 6/16},
  47. {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16},
  48. -- { left, bottom, front, right, top, back}
  49. --[[b]] {-1/2 , -1/2 , -3/16, 1/2 , -7/16, 3/16}, -- left to right
  50. --[[o]] {-3/16, -1/2 , -1/2 , 3/16, -7/16, 1/2 }, -- front to back
  51. --[[t]] {-7/16, -1/2 , -5/16, 7/16, -7/16, 5/16},
  52. --[[t]] {-5/16, -1/2 , -7/16, 5/16, -7/16, 7/16},
  53. --[[m]] {-6/16, -1/2 , -6/16, 6/16, -7/16, 6/16}, -- mid
  54. },
  55. },
  56. selection_box = {
  57. type = "fixed",
  58. fixed = {-1/2, -1/2, -1/2, 1/2, 2/16, 1/2},
  59. },
  60. groups = {crumbly=3},
  61. sounds = default.node_sound_dirt_defaults(),
  62. })
  63. -----------------------------------------------------------------------------------------------
  64. -- CRaFTiNG
  65. -----------------------------------------------------------------------------------------------
  66. minetest.register_craft({ -- molehills --> dirt
  67. output = "default:dirt",
  68. recipe = {
  69. {"molehills:molehill","molehills:molehill"},
  70. {"molehills:molehill","molehills:molehill"},
  71. }
  72. })
  73. -----------------------------------------------------------------------------------------------
  74. -- GeNeRaTiNG
  75. -----------------------------------------------------------------------------------------------
  76. abstract_molehills.place_molehill = function(pos)
  77. local right_here = {x=pos.x , y=pos.y+1, z=pos.z }
  78. if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }).name ~= "air"
  79. and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }).name ~= "air"
  80. and minetest.get_node({x=pos.x , y=pos.y, z=pos.z+1}).name ~= "air"
  81. and minetest.get_node({x=pos.x , y=pos.y, z=pos.z-1}).name ~= "air"
  82. and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1}).name ~= "air"
  83. and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air"
  84. and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air"
  85. and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name ~= "air" then
  86. minetest.set_node(right_here, {name="molehills:molehill"})
  87. end
  88. end
  89. biome_lib:register_generate_plant({
  90. surface = {"default:dirt_with_grass"},
  91. max_count = Molehills_Max_Count,
  92. rarity = Molehills_Rarity,
  93. min_elevation = 1,
  94. max_elevation = 40,
  95. avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]},
  96. avoid_radius = 4,
  97. plantlife_limit = -0.3,
  98. },
  99. abstract_molehills.place_molehill
  100. )
  101. -----------------------------------------------------------------------------------------------
  102. print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
  103. -----------------------------------------------------------------------------------------------