v1.01: Extended for moreores
This commit is contained in:
parent
d1399221a6
commit
a546617feb
24
init.lua
24
init.lua
@ -25,6 +25,8 @@
|
|||||||
* Output is 50% gravel and 50% sieved gravel
|
* Output is 50% gravel and 50% sieved gravel
|
||||||
2017-06-20 v0.05 * Hammer sound bugfix
|
2017-06-20 v0.05 * Hammer sound bugfix
|
||||||
2017-06-24 v1.00 * Released version w/o any changes
|
2017-06-24 v1.00 * Released version w/o any changes
|
||||||
|
2017-07-08 V1.01 * extended for moreores
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
gravelsieve = {
|
gravelsieve = {
|
||||||
@ -34,19 +36,25 @@ dofile(minetest.get_modpath("gravelsieve") .. "/hammer.lua")
|
|||||||
|
|
||||||
gravelsieve.ore_rarity = tonumber(minetest.setting_get("gravelsieve_ore_rarity")) or 1.0
|
gravelsieve.ore_rarity = tonumber(minetest.setting_get("gravelsieve_ore_rarity")) or 1.0
|
||||||
|
|
||||||
|
|
||||||
-- Ore probability table (1/n)
|
-- Ore probability table (1/n)
|
||||||
local ore_probability = {
|
local ore_probability = {
|
||||||
iron_lump = 35,
|
["default:iron_lump"] = 35,
|
||||||
copper_lump = 60,
|
["default:copper_lump"] = 60,
|
||||||
tin_lump = 80,
|
["default:tin_lump"] = 80,
|
||||||
gold_lump = 175,
|
["default:gold_lump"] = 175,
|
||||||
mese_crystal = 275,
|
["default:mese_crystal"] = 275,
|
||||||
diamond = 340,
|
["default:diamond"] = 340,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if minetest.get_modpath("moreores") then
|
||||||
|
ore_probability["moreores:silver_lump"] = 100
|
||||||
|
ore_probability["moreores:mithril_lump"] = 250
|
||||||
|
end
|
||||||
|
|
||||||
-- check if tin is available
|
-- check if tin is available
|
||||||
if ItemStack("default:tin_lump") == nil then
|
if ItemStack("default:tin_lump") == nil then
|
||||||
ore_probability[tin_lump] = nil -- not available
|
ore_probability["tin_lump"] = nil -- not available
|
||||||
end
|
end
|
||||||
|
|
||||||
local sieve_formspec =
|
local sieve_formspec =
|
||||||
@ -109,7 +117,7 @@ local function random_ore(inv, src)
|
|||||||
probability = probability * gravelsieve.ore_rarity
|
probability = probability * gravelsieve.ore_rarity
|
||||||
if probability ~= nil then
|
if probability ~= nil then
|
||||||
if math.random(probability) == 1 then
|
if math.random(probability) == 1 then
|
||||||
local item = ItemStack("default:"..ore)
|
local item = ItemStack(ore)
|
||||||
if inv:room_for_item("dst", item) then
|
if inv:room_for_item("dst", item) then
|
||||||
inv:add_item("dst", item)
|
inv:add_item("dst", item)
|
||||||
return true -- ore placed
|
return true -- ore placed
|
||||||
|
Loading…
Reference in New Issue
Block a user