add mapgen

This commit is contained in:
FaceDeer
2023-02-12 13:06:08 -07:00
parent 633f230ae4
commit fc1a6d754e
5 changed files with 47 additions and 9 deletions

View File

@ -18,4 +18,5 @@ dofile(modpath.."/lava_sea.lua")
dofile(modpath.."/underworld.lua")
dofile(modpath.."/primordial.lua")
dofile(modpath.."/dungeon_loot.lua")
dofile(modpath.."/growth_restrictions.lua")
dofile(modpath.."/growth_restrictions.lua")
dofile(modpath.."/lorebooks.lua")

20
df_caverns/lorebooks.lua Normal file
View File

@ -0,0 +1,20 @@
if not minetest.get_modpath("df_lorebooks") then return end
local foundations = {"group:stone", "group:dirt", "group:soil"}
minetest.register_on_generated(function(minp, maxp, blockseed)
if maxp.y > 0 or maxp.y < df_caverns.config.primordial_min then return end
-- using after so that all other mapgen should be finished fiddling with stuff by the time this runs
minetest.after(1, function(minp, maxp)
local middle = vector.divide(vector.add(minp, maxp), 2)
if collectible_lore.are_cairns_close_to_pos(middle) then return end -- quick and dirty check to discard mapblocks close to other cairns
local possibles = minetest.find_nodes_in_area_under_air(minp, maxp, foundations)
if next(possibles) then
local target = possibles[math.random(#possibles)]
target.y=target.y+1
collectible_lore.place_cairn(target)
end
end, minp, maxp)
end)

View File

@ -1,4 +1,4 @@
name = df_caverns
description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
depends = df_dependencies, subterrane, df_trees, df_mapitems,
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies, chasms, big_webs, mcl_flowers, mine_gas, bubblesponge
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, name_generator, fireflies, chasms, big_webs, mcl_flowers, mine_gas, bubblesponge, df_lorebooks