Add a few additional default treasures

This commit is contained in:
Wuzzy 2019-08-20 01:52:43 +02:00
parent 9e9433dcae
commit d6bc045bbb
2 changed files with 21 additions and 7 deletions

View File

@ -8,15 +8,28 @@ dofile(minetest.get_modpath("tsm_pyramids").."/room.lua")
local chest_stuff = { local chest_stuff = {
{name="default:apple", max = 3}, {name="default:apple", max = 3},
{name="farming:bread", max = 3}, {name="default:steel_ingot", max = 3},
{name="default:steel_ingot", max = 2}, {name="default:copper_ingot", max = 3},
{name="default:gold_ingot", max = 2}, {name="default:gold_ingot", max = 2},
{name="default:diamond", max = 1}, {name="default:diamond", max = 1},
{name="default:pick_steel", max = 1}, {name="default:pick_steel", max = 1},
{name="default:pick_diamond", max = 1} {name="default:pick_diamond", max = 1},
{name="default:papyrus", max = 9},
} }
if minetest.get_modpath("farming") then
table.insert(chest_stuff, {name="farming:bread", max = 3})
table.insert(chest_stuff, {name="farming:cotton", max = 8})
else
table.insert(chest_stuff, {name="farming:apple", max = 8})
table.insert(chest_stuff, {name="farming:apple", max = 3})
end
if minetest.get_modpath("tnt") then
table.insert(chest_stuff, {name="tnt:gunpowder", max = 6})
else
table.insert(chest_stuff, {name="farming:apple", max = 3})
end
function tsm_pyramids.fill_chest(pos) function tsm_pyramids.fill_chest(pos)
minetest.after(2, function() minetest.after(2, function()
local n = minetest.get_node(pos) local n = minetest.get_node(pos)
@ -24,14 +37,15 @@ function tsm_pyramids.fill_chest(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*4) inv:set_size("main", 8*4)
if math.random(1,10) < 7 then return end if math.random(1,10) <= 5 then
return
end
local stacks = {} local stacks = {}
if minetest.get_modpath("treasurer") ~= nil then if minetest.get_modpath("treasurer") ~= nil then
stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"}) stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"})
else else
for i=0,2,1 do for i=0,2,1 do
local stuff = chest_stuff[math.random(1,#chest_stuff)] local stuff = chest_stuff[math.random(1,#chest_stuff)]
if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then stuff = chest_stuff[1] end
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)}) table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
end end
end end

View File

@ -1,4 +1,4 @@
name = tsm_pyramids name = tsm_pyramids
description = Pyramids with treasures! You can find them in deserts and sandstone deserts. description = Pyramids with treasures! You can find them in deserts and sandstone deserts.
depends = default depends = default
optional_depends = farming, treasurer, doc_items, awards optional_depends = farming, tnt, treasurer, doc_items, awards