mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-07-18 08:20:25 +02:00
Fix a crash in ambient sound biome checking when the player is halfway between level 2 and level 3. Also add API to puzzle chests
This fixes issue https://github.com/FaceDeer/dfcaverns/issues/39
This commit is contained in:
@ -17,6 +17,17 @@ if mapgen_helper.log_location_enabled then
|
||||
log_location = mapgen_helper.log_first_location
|
||||
end
|
||||
|
||||
-- Exposed as a global so that other mods can override it.
|
||||
df_caverns.populate_puzzle_chest = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
for i = 1, math.random(1,8) do
|
||||
local item = ItemStack(df_underworld_items.colour_items[math.random(1,#df_underworld_items.colour_items)])
|
||||
--item:set_count(math.random(1,4))
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
|
||||
local name_pit = function() end
|
||||
local name_ruin = function() end
|
||||
|
||||
@ -81,8 +92,6 @@ if named_waypoints_path then
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local c_slade = df_caverns.node_id.slade
|
||||
local c_slade_block = df_caverns.node_id.slade_block
|
||||
local c_air = df_caverns.node_id.air
|
||||
@ -496,13 +505,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if puzzle_chest then
|
||||
local def = minetest.registered_nodes["df_underworld_items:puzzle_chest_closed"]
|
||||
def.can_dig(puzzle_chest) -- initializes the inventory
|
||||
local meta = minetest.get_meta(puzzle_chest)
|
||||
local inv = meta:get_inventory()
|
||||
for i = 1, math.random(1,8) do
|
||||
local item = ItemStack(df_underworld_items.colour_items[math.random(1,#df_underworld_items.colour_items)])
|
||||
--item:set_count(math.random(1,4))
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
df_caverns.populate_puzzle_chest(puzzle_chest)
|
||||
end
|
||||
end)
|
||||
elseif building.building_type == "medium building" then
|
||||
|
Reference in New Issue
Block a user