From 14a276033d716933e7db8c9acede85eecbe39a31 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 7 Sep 2017 04:38:50 +0200 Subject: [PATCH] v6: Add otherwise ungettable saplings into chests --- mods/MAPGEN/mcl_dungeons/init.lua | 20 +++++++++++++++-- mods/MAPGEN/tsm_railcorridors/gameconfig.lua | 23 +++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 065fb0da84..b18d30e5fa 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -2,11 +2,12 @@ -- TODO: Add monster spawner +local mg_name = minetest.get_mapgen_setting("mg_name") local pr = PseudoRandom(os.time()) -- Get loot for dungeon chests local get_loot = function() - local items = mcl_loot.get_multi_loot({ + local loottable = { { stacks_min = 1, stacks_max = 3, @@ -50,7 +51,22 @@ local get_loot = function() { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 }, { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 }, }, - }}, pr) + } + } + + -- Bonus loot for v6 mapgen: Otherwise unobtainable saplings. + if mg_name == "v6" then + table.insert(loottable, { + stacks_min = 1, + stacks_max = 1, + items = { + { itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 }, + { itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 }, + { itemstring = "", weight = 11 }, + }, + }) + end + local items = mcl_loot.get_multi_loot(loottable, pr) return items end diff --git a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua index cbbab61fc6..7f05381352 100644 --- a/mods/MAPGEN/tsm_railcorridors/gameconfig.lua +++ b/mods/MAPGEN/tsm_railcorridors/gameconfig.lua @@ -41,10 +41,12 @@ function tsm_railcorridors.on_construct_spawner(pos) mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider") end +local mg_name = minetest.get_mapgen_setting("mg_name") + -- MineClone 2's treasure function. Gets all treasures for a single chest. -- Based on information from Minecraft Wiki. function tsm_railcorridors.get_treasures(pr) - local items = mcl_loot.get_multi_loot({ + local loottable = { { stacks_min = 1, stacks_max = 1, @@ -54,7 +56,7 @@ function tsm_railcorridors.get_treasures(pr) { itemstring = "mcl_books:book", weight = 10 }, -- TODO: Enchanted Book { itemstring = "", weight = 5}, { itemstring = "mcl_core:pick_iron", weight = 5 }, - { itemstring = "mcl:core:apple_gold", weight = 1 }, -- TODO: Enchanted Golden Apple + { itemstring = "mcl_core:apple_gold", weight = 1 }, -- TODO: Enchanted Golden Apple } }, { @@ -83,7 +85,22 @@ function tsm_railcorridors.get_treasures(pr) { itemstring = "mcl_minecarts:detector_rail", weight = 5, amount_min = 1, amount_max = 4 }, { itemstring = "mcl_minecarts:golden_rail", weight = 5, amount_min = 1, amount_max = 4 }, } - }}, pr) + } + } + + -- Bonus loot for v6 mapgen: Otherwise unobtainable saplings. + if mg_name == "v6" then + table.insert(loottable, { + stacks_min = 1, + stacks_max = 1, + items = { + { itemstring = "mcl_core:darksapling", weight = 1, amount_min = 1, amount_max = 2 }, + { itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 }, + { itemstring = "", weight = 14 }, + }, + }) + end + local items = mcl_loot.get_multi_loot(loottable, pr) return items end