From 46e4c7be128f9bf8a19d41b63d046083a6c571c8 Mon Sep 17 00:00:00 2001 From: An0n3m0us Date: Thu, 20 Feb 2020 23:37:57 +0000 Subject: [PATCH] Sort loot registration into respective mods --- mods/bucket/init.lua | 16 ++++++++++++++++ mods/bucket/mod.conf | 2 +- mods/carts/init.lua | 7 +++++++ mods/carts/mod.conf | 2 +- mods/dungeon_loot/loot.lua | 16 ---------------- mods/farming/init.lua | 13 +++++++++++++ mods/farming/mod.conf | 2 +- mods/vessels/init.lua | 7 +++++++ mods/vessels/mod.conf | 2 +- 9 files changed, 47 insertions(+), 20 deletions(-) diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index 2cf431ca..42fb4b97 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -225,3 +225,19 @@ minetest.register_craft({ replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}}, }) +-- Register buckets as dungeon loot +if dungeon_loot and dungeon_loot.register then + local loot_list = { + {name = "bucket:bucket_empty", chance = 0.55}, + -- water in deserts/ice or above ground, lava otherwise + {name = "bucket:bucket_water", chance = 0.45, + types = {"sandstone", "desert", "ice"}}, + {name = "bucket:bucket_water", chance = 0.45, y = {0, 32768}, + types = {"normal"}}, + {name = "bucket:bucket_lava", chance = 0.45, y = {-32768, -1}, + types = {"normal"}}, + } + for _,loot in pairs(loot_list) do + dungeon_loot.register(loot) + end +end diff --git a/mods/bucket/mod.conf b/mods/bucket/mod.conf index 1c60a099..8ff8c7bd 100644 --- a/mods/bucket/mod.conf +++ b/mods/bucket/mod.conf @@ -1,3 +1,3 @@ name = bucket description = Minetest Game mod: bucket -depends = default +depends = default, dungeon_loot diff --git a/mods/carts/init.lua b/mods/carts/init.lua index a5aa9cb5..4fb46229 100644 --- a/mods/carts/init.lua +++ b/mods/carts/init.lua @@ -19,3 +19,10 @@ carts.path_distance_max = 3 dofile(carts.modpath.."/functions.lua") dofile(carts.modpath.."/rails.lua") dofile(carts.modpath.."/cart_entity.lua") + +-- Register rails as dungeon loot +if dungeon_loot and dungeon_loot.register then + dungeon_loot.register({ + name = "carts:rail", chance = 0.35, count = {1, 6} + }) +end diff --git a/mods/carts/mod.conf b/mods/carts/mod.conf index 20357e3e..a2de0d08 100644 --- a/mods/carts/mod.conf +++ b/mods/carts/mod.conf @@ -1,3 +1,3 @@ name = carts description = Carts (formerly boost_cart) -depends = default, player_api +depends = default, player_api, dungeon_loot diff --git a/mods/dungeon_loot/loot.lua b/mods/dungeon_loot/loot.lua index 7eb08cd8..3bed399a 100644 --- a/mods/dungeon_loot/loot.lua +++ b/mods/dungeon_loot/loot.lua @@ -1,26 +1,10 @@ dungeon_loot.registered_loot = { - -- buckets - {name = "bucket:bucket_empty", chance = 0.55}, - -- water in deserts/ice or above ground, lava otherwise - {name = "bucket:bucket_water", chance = 0.45, - types = {"sandstone", "desert", "ice"}}, - {name = "bucket:bucket_water", chance = 0.45, y = {0, 32768}, - types = {"normal"}}, - {name = "bucket:bucket_lava", chance = 0.45, y = {-32768, -1}, - types = {"normal"}}, - -- various items {name = "default:stick", chance = 0.6, count = {3, 6}}, {name = "default:flint", chance = 0.4, count = {1, 3}}, - {name = "vessels:glass_fragments", chance = 0.35, count = {1, 4}}, - {name = "carts:rail", chance = 0.35, count = {1, 6}}, -- farming / consumable - {name = "farming:string", chance = 0.5, count = {1, 8}}, - {name = "farming:wheat", chance = 0.5, count = {2, 5}}, {name = "default:apple", chance = 0.4, count = {1, 4}}, - {name = "farming:seed_cotton", chance = 0.4, count = {1, 4}, - types = {"normal"}}, {name = "default:cactus", chance = 0.4, count = {1, 4}, types = {"sandstone", "desert"}}, diff --git a/mods/farming/init.lua b/mods/farming/init.lua index e6dfd579..93c07962 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -144,3 +144,16 @@ minetest.register_craft({ recipe = "farming:hoe_wood", burntime = 5, }) + +-- Register farming items as dungeon loot +if dungeon_loot and dungeon_loot.register then + local loot_list = { + {name = "farming:string", chance = 0.5, count = {1, 8}}, + {name = "farming:wheat", chance = 0.5, count = {2, 5}}, + {name = "farming:seed_cotton", chance = 0.4, count = {1, 4}, + types = {"normal"}}, + } + for _,loot in pairs(loot_list) do + dungeon_loot.register(loot) + end +end diff --git a/mods/farming/mod.conf b/mods/farming/mod.conf index c26c28fc..aa38c0df 100644 --- a/mods/farming/mod.conf +++ b/mods/farming/mod.conf @@ -1,3 +1,3 @@ name = farming description = Minetest Game mod: farming -depends = default, wool, stairs +depends = default, wool, stairs, dungeon_loot diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua index b330efc2..c375a0a6 100644 --- a/mods/vessels/init.lua +++ b/mods/vessels/init.lua @@ -228,3 +228,10 @@ minetest.register_craft({ recipe = "vessels:shelf", burntime = 30, }) + +-- Register glass fragments as dungeon loot +if dungeon_loot and dungeon_loot.register then + dungeon_loot.register({ + name = "vessels:glass_fragments", chance = 0.35, count = {1, 4} + }) +end diff --git a/mods/vessels/mod.conf b/mods/vessels/mod.conf index 7551b54a..97a4bf6e 100644 --- a/mods/vessels/mod.conf +++ b/mods/vessels/mod.conf @@ -1,3 +1,3 @@ name = vessels description = Minetest Game mod: vessels -depends = default +depends = default, dungeon_loot