Remove hard dependency on default

This commit is contained in:
Juraj Vajda 2023-03-30 23:30:58 -04:00
parent 92fd95538f
commit 33dfabd6e7
2 changed files with 22 additions and 322 deletions

342
api.lua
View File

@ -58,328 +58,7 @@ Everness = {
}
},
loot_chest = {
default = {
{
name = 'default:stick',
max_count = 25,
chance = 25
},
{
name = 'default:paper',
max_count = 10,
chance = 25
},
{
name = 'default:book',
max_count = 2,
chance = 25
},
{
name = 'default:skeleton_key',
max_count = 2,
chance = 25
},
{
name = 'default:flint',
max_count = 2,
chance = 25
},
{
name = 'default:obsidian_shard',
max_count = 2,
chance = 25
},
{
name = 'default:clay_brick',
max_count = 2,
chance = 25
},
{
name = 'default:mese_crystal_fragment',
max_count = 2,
chance = 25
},
{
name = 'default:gold_ingot',
max_count = 2,
chance = 25
},
{
name = 'default:bronze_ingot',
max_count = 2,
chance = 25
},
{
name = 'default:tin_ingot',
max_count = 2,
chance = 25
},
{
name = 'default:copper_ingot',
max_count = 2,
chance = 25
},
{
name = 'default:steel_ingot',
max_count = 2,
chance = 25
},
{
name = 'default:coal_lump',
max_count = 2,
chance = 25
},
{
name = 'default:pick_stone',
max_count = 2,
chance = 25
},
{
name = 'default:pick_bronze',
max_count = 2,
chance = 25
},
{
name = 'default:pick_steel',
max_count = 2,
chance = 25
},
{
name = 'default:shovel_stone',
max_count = 2,
chance = 25
},
{
name = 'default:shovel_bronze',
max_count = 2,
chance = 25
},
{
name = 'default:shovel_steel',
max_count = 2,
chance = 25
},
{
name = 'default:axe_stone',
max_count = 2,
chance = 25
},
{
name = 'default:axe_bronze',
max_count = 2,
chance = 25
},
{
name = 'default:axe_steel',
max_count = 2,
chance = 25
},
{
name = 'default:sword_stone',
max_count = 2,
chance = 25
},
{
name = 'default:sword_bronze',
max_count = 2,
chance = 25
},
{
name = 'default:sword_steel',
max_count = 2,
chance = 25
},
{
name = 'default:bookshelf',
max_count = 2,
chance = 25
},
{
name = 'default:sign_wall_wood',
max_count = 2,
chance = 25
},
{
name = 'default:ladder_wood',
max_count = 5,
chance = 25
},
{
name = 'default:ladder_steel',
max_count = 5,
chance = 25
},
{
name = 'default:glass',
max_count = 10,
chance = 25
},
{
name = 'default:obsidian_glass',
max_count = 10,
chance = 25
},
{
name = 'default:tree',
max_count = 15,
chance = 25
},
{
name = 'default:jungletree',
max_count = 15,
chance = 25
},
{
name = 'default:pine_tree',
max_count = 15,
chance = 25
},
{
name = 'default:cactus',
max_count = 20,
chance = 25
},
{
name = 'default:large_cactus_seedling',
max_count = 2,
chance = 25
},
{
name = 'default:papyrus',
max_count = 20,
chance = 25
},
{
name = 'default:junglegrass',
max_count = 20,
chance = 25
},
{
name = 'default:blueberry_bush_sapling',
max_count = 2,
chance = 25
},
{
name = 'default:sapling',
max_count = 2,
chance = 25
},
{
name = 'default:junglesapling',
max_count = 2,
chance = 25
},
{
name = 'default:pine_sapling',
max_count = 2,
chance = 25
},
{
name = 'default:acacia_sapling',
max_count = 2,
chance = 25
},
{
name = 'default:aspen_sapling',
max_count = 2,
chance = 25
},
{
name = 'default:clay_lump',
max_count = 5,
chance = 25
},
{
name = 'default:tin_lump',
max_count = 2,
chance = 25
},
{
name = 'default:copper_lump',
max_count = 5,
chance = 25
},
{
name = 'default:iron_lump',
max_count = 5,
chance = 25
},
{
name = 'default:coalblock',
max_count = 5,
chance = 25
},
{
name = 'default:steelblock',
max_count = 2,
chance = 25
},
{
name = 'default:copperblock',
max_count = 2,
chance = 25
},
{
name = 'default:tinblock',
max_count = 2,
chance = 25
},
{
name = 'default:bronzeblock',
max_count = 2,
chance = 25
},
{
name = 'default:mese',
max_count = 2,
chance = 25
},
{
name = 'default:meselamp',
max_count = 2,
chance = 25
},
{
name = 'default:obsidian',
max_count = 2,
chance = 25
},
{
name = 'default:mese_crystal',
max_count = 2,
chance = 25
},
{
name = 'default:diamond',
max_count = 2,
chance = 25
},
{
name = 'default:pick_mese',
max_count = 2,
chance = 25
},
{
name = 'default:shovel_mese',
max_count = 2,
chance = 25
},
{
name = 'default:axe_mese',
max_count = 2,
chance = 25
},
{
name = 'default:sword_mese',
max_count = 2,
chance = 25
},
{
name = 'everness:forsaken_fire',
max_count = 1,
chance = 50
},
}
default = {},
},
settings = {
biomes = {
@ -1276,3 +955,22 @@ function Everness.get_inventory_drops(pos, inventory, drops)
end
end
end
function Everness.set_loot_chest_items()
local loot_items = {}
for name, def in pairs(minetest.registered_items) do
if def.groups
and next(def.groups)
and (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
then
table.insert(loot_items, {
name = name,
max_count = 25,
chance = 25
})
end
end
Everness.loot_chest.default = table.copy(loot_items)
end

View File

@ -214,6 +214,8 @@ then
dofile(path .. '/mod_support_x_obsidianmese.lua')
end
Everness.set_loot_chest_items()
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
print('[Mod] everness loaded.. [' .. mod_end_time .. 's]')