1
0
Fork 0

randomly enchant treasure

This commit is contained in:
cora 2022-06-02 12:30:51 +02:00
parent 4af1094eed
commit b7419dc207
2 changed files with 47 additions and 39 deletions

View File

@ -14,7 +14,8 @@ local schems = {
"shipwreck_half_back",
}
local loottable_supply = {
local function get_supply_loot()
return {
stacks_min = 3,
stacks_max = 10,
items = {
@ -28,18 +29,24 @@ local loottable_supply = {
{ itemstring = "mcl_core:coal_lump", weight = 6, amount_min = 2, amount_max = 8 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 },
{ itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 },
{ itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3 },
{ itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3 },
{ itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3 },
{ itemstring = "mcl_armor:boots_leather_enchanted", weight = 3 },
{ itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
{ itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
{ itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
{ itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
--{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 },
}
}
end
local loottable_treasure = {
local function get_treasure_loot()
return {
stacks_min = 3,
stacks_max = 10,
items = {
@ -53,6 +60,7 @@ local loottable_treasure = {
{ itemstring = "mcl_core:diamond", weight = 8, amount_min = 1, amount_max = 10 },
}
}
end
local function fill_chests(p1,p2)
for _,p in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_chests:chest_small"})) do
@ -60,8 +68,8 @@ local function fill_chests(p1,p2)
minetest.registered_nodes["mcl_chests:chest_small"].on_construct(p)
end
local inv = minetest.get_inventory( {type="node", pos=p} )
local loot = loottable_supply
if pr:next(1,10) == 1 then loot = loottable_treasure end
local loot = get_supply_loot()
if pr:next(1,10) == 1 then loot = get_treasure_loot() end
mcl_loot.fill_inventory(inv, "main", mcl_loot.get_multi_loot({loot}, pr), pr)
end
end

View File

@ -1,3 +1,3 @@
name = mcl_shipwrecks
author = cora
depends = mcl_loot, mcl_structures
depends = mcl_loot, mcl_structures, mcl_enchanting