From d6bc045bbb5232dd8c4bdd8602ea181c4aa4573a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 20 Aug 2019 01:52:43 +0200 Subject: [PATCH] Add a few additional default treasures --- init.lua | 26 ++++++++++++++++++++------ mod.conf | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 7fffcc9..4dcfd7e 100644 --- a/init.lua +++ b/init.lua @@ -8,15 +8,28 @@ dofile(minetest.get_modpath("tsm_pyramids").."/room.lua") local chest_stuff = { {name="default:apple", max = 3}, - {name="farming:bread", max = 3}, - {name="default:steel_ingot", max = 2}, + {name="default:steel_ingot", max = 3}, + {name="default:copper_ingot", max = 3}, {name="default:gold_ingot", max = 2}, {name="default:diamond", 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) minetest.after(2, function() local n = minetest.get_node(pos) @@ -24,14 +37,15 @@ function tsm_pyramids.fill_chest(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() 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 = {} if minetest.get_modpath("treasurer") ~= nil then stacks = treasurer.select_random_treasures(3,7,9,{"minetool", "food", "crafting_component"}) else for i=0,2,1 do 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)}) end end diff --git a/mod.conf b/mod.conf index 9e0d4ef..0ac86be 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = tsm_pyramids description = Pyramids with treasures! You can find them in deserts and sandstone deserts. depends = default -optional_depends = farming, treasurer, doc_items, awards +optional_depends = farming, tnt, treasurer, doc_items, awards