add optional loot mod support

This commit is contained in:
FaceDeer 2017-02-11 12:02:30 -07:00
parent 6a56592ecc
commit 3355729f06
4 changed files with 71 additions and 6 deletions

View File

@ -1,3 +1,4 @@
default default
mg? mg?
intllib? intllib?
loot?

View File

@ -15,11 +15,8 @@ local modpath = minetest.get_modpath("moreores")
local S, NS = dofile(modpath.."/intllib.lua") local S, NS = dofile(modpath.."/intllib.lua")
dofile(modpath .. "/readsettings.lua") dofile(modpath .. "/readsettings.lua")
dofile(modpath .. "/loot.lua")
-- `mg` support:
if minetest.get_modpath("mg") then
dofile(modpath .. "/mg.lua") dofile(modpath .. "/mg.lua")
end
-- Utility functions -- Utility functions
-- ================= -- =================

63
loot.lua Normal file
View File

@ -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

4
mg.lua
View File

@ -4,6 +4,10 @@ More Ores: `mg` mod support
Copyright (c) 2011-2015 Calinou and contributors. Copyright (c) 2011-2015 Calinou and contributors.
Licensed under the zlib license. See LICENSE.md for more information. 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 if moreores.tin_enabled then
mg.register_ore({ mg.register_ore({