mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-02-23 07:20:22 +01:00
add mapgen
This commit is contained in:
parent
633f230ae4
commit
fc1a6d754e
@ -87,6 +87,8 @@ end
|
||||
|
||||
minetest.register_node("collectible_lore:cairn", {
|
||||
description = S("Cairn"),
|
||||
_doc_items_longdesc = S("A cairn of rocks constructed by a previous explorer to protect documents and supplies."),
|
||||
_doc_items_usagehelp = S("The first time you discover a cairn like this, it may reveal to you some new record or piece of lore. Afterward it can be used as a public storage location."),
|
||||
drawtype = "nodebox",
|
||||
tiles = {df_dependencies.texture_cobble, df_dependencies.texture_cobble, df_dependencies.texture_cobble .. "^(collectible_lore_cairn_marker.png^[opacity:100)"},
|
||||
is_ground_content = true,
|
||||
@ -138,8 +140,8 @@ minetest.register_node("collectible_lore:cairn", {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
|
||||
local nearby = cairn_area:get_areas_in_area(vector.subtract(pos, cairn_spacing/2), vector.add(pos, cairn_spacing/2))
|
||||
if next(nearby) then
|
||||
local nearby = collectible_lore.are_cairns_close_to_pos(pos)
|
||||
if nearby then
|
||||
minetest.log("error", "Cairn placed too close to other cairns. Placed at: " .. minetest.pos_to_string(pos))
|
||||
for _,data in pairs(nearby) do
|
||||
minetest.log("error", "nearby: " .. minetest.pos_to_string(data.min))
|
||||
@ -173,13 +175,16 @@ collectible_lore.get_nearby_cairns = function(pos, spacing)
|
||||
return nil
|
||||
end
|
||||
|
||||
collectible_lore.place_cairn = function(pos)
|
||||
collectible_lore.are_cairns_close_to_pos = function(pos)
|
||||
local nearby = collectible_lore.get_nearby_cairns(pos, cairn_spacing)
|
||||
if nearby then return end
|
||||
if nearby then return nearby end
|
||||
return false
|
||||
end
|
||||
|
||||
collectible_lore.place_cairn = function(pos)
|
||||
if collectible_lore.are_cairns_close_to_pos(pos) then return end
|
||||
minetest.set_node(pos, {name="collectible_lore:cairn"})
|
||||
local def = minetest.registered_nodes["collectible_lore:cairn"]
|
||||
def.on_construct(pos)
|
||||
--minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name=torch_node_name})
|
||||
--minetest.debug("placed " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
|
||||
local player_state = {}
|
||||
@ -230,6 +235,8 @@ end
|
||||
|
||||
minetest.register_craftitem("collectible_lore:satchel", {
|
||||
description = S("Collectibles Satchel"),
|
||||
_doc_items_longdesc = S("A satchel containing various documents you've recovered in your travels."),
|
||||
_doc_items_usagehelp = S("The documents and lore you've unlocked are not tied to a specific satchel, any satchel will let you view your personal collection."),
|
||||
inventory_image = "collectible_lore_satchel.png",
|
||||
stack_max = 99,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
@ -13,10 +13,20 @@ Administrative control of collectibles=
|
||||
### items.lua ###
|
||||
|
||||
<not found yet>=
|
||||
|
||||
A cairn of rocks constructed by a previous explorer to protect documents and supplies.=
|
||||
|
||||
A satchel containing various documents you've recovered in your travels.=
|
||||
|
||||
Cairn=
|
||||
Collected: @1/@2=
|
||||
Collectibles Satchel=
|
||||
Exit=
|
||||
|
||||
The documents and lore you've unlocked are not tied to a specific satchel, any satchel will let you view your personal collection.=
|
||||
|
||||
The first time you discover a cairn like this, it may reveal to you some new record or piece of lore. Afterward it can be used as a public storage location.=
|
||||
|
||||
View=
|
||||
You've already collected the lore hidden in this cairn.=
|
||||
You've found a collectible item of lore titled:@n@1=
|
||||
|
@ -19,3 +19,4 @@ dofile(modpath.."/underworld.lua")
|
||||
dofile(modpath.."/primordial.lua")
|
||||
dofile(modpath.."/dungeon_loot.lua")
|
||||
dofile(modpath.."/growth_restrictions.lua")
|
||||
dofile(modpath.."/lorebooks.lua")
|
20
df_caverns/lorebooks.lua
Normal file
20
df_caverns/lorebooks.lua
Normal 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)
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user