From 3355729f06c3d108a37078a8f1daac39715e5f72 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sat, 11 Feb 2017 12:02:30 -0700 Subject: [PATCH] add optional loot mod support --- depends.txt | 3 ++- init.lua | 7 ++---- loot.lua | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ mg.lua | 4 ++++ 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 loot.lua diff --git a/depends.txt b/depends.txt index 983fe4e..0410c8b 100644 --- a/depends.txt +++ b/depends.txt @@ -1,3 +1,4 @@ default mg? -intllib? \ No newline at end of file +intllib? +loot? \ No newline at end of file diff --git a/init.lua b/init.lua index 5ef7569..37a8b60 100644 --- a/init.lua +++ b/init.lua @@ -15,11 +15,8 @@ local modpath = minetest.get_modpath("moreores") local S, NS = dofile(modpath.."/intllib.lua") dofile(modpath .. "/readsettings.lua") - --- `mg` support: -if minetest.get_modpath("mg") then - dofile(modpath .. "/mg.lua") -end +dofile(modpath .. "/loot.lua") +dofile(modpath .. "/mg.lua") -- Utility functions -- ================= diff --git a/loot.lua b/loot.lua new file mode 100644 index 0000000..9b2b87e --- /dev/null +++ b/loot.lua @@ -0,0 +1,63 @@ +if not minetest.get_modpath("loot") then + return +end + +if moreores.tin_enabled then + loot.register_loot({ + weights = { generic = 500 }, + payload = { + stack = ItemStack("moreores:tin_ingot"), + min_size = 1, + max_size = 10, + }, + }) + + loot.register_loot({ + weights = { generic = 500 }, + payload = { + stack = ItemStack("moreores:tin_lump"), + min_size = 1, + max_size = 10, + }, + }) +end + +if moreores.silver_enabled then + loot.register_loot({ + weights = { generic = 200, valuable = 200, }, + payload = { + stack = ItemStack("moreores:silver_ingot"), + min_size = 1, + max_size = 10, + }, + }) + + loot.register_loot({ + weights = { generic = 200, valuable = 200, }, + payload = { + stack = ItemStack("moreores:silver_lump"), + min_size = 1, + max_size = 10, + }, + }) +end + +if moreores.mithril_enabled then + loot.register_loot({ + weights = { generic = 25, valuable = 25, }, + payload = { + stack = ItemStack("moreores:mithril_ingot"), + min_size = 1, + max_size = 5, + }, + }) + + loot.register_loot({ + weights = { generic = 25, valuable = 25, }, + payload = { + stack = ItemStack("moreores:mithril_lump"), + min_size = 1, + max_size = 5, + }, + }) +end \ No newline at end of file diff --git a/mg.lua b/mg.lua index e23934a..4ff93f3 100644 --- a/mg.lua +++ b/mg.lua @@ -4,6 +4,10 @@ More Ores: `mg` mod support Copyright (c) 2011-2015 Calinou and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] +if not minetest.get_modpath("mg") then + return +end + if moreores.tin_enabled then mg.register_ore({