Lava cooling: Choose ore from the list of registered ores
parent
2de8ff9861
commit
6634877d52
|
@ -129,8 +129,10 @@ end
|
|||
|
||||
-- Lava cooling
|
||||
|
||||
-- Exclude bedrock, coal and diamond from being generated
|
||||
additional_stuff.not_an_ore = {"default:stone_with_coal", "default:stone_with_diamond", "bedrock:deepstone", "bedrock:bedrock"}
|
||||
-- Exclude coal and diamond from being generated
|
||||
additional_stuff.not_an_ore = {"default:stone_with_coal", "default:stone_with_diamond"}
|
||||
additional_stuff.not_an_ore = {} --bell07 prefered setting
|
||||
additional_stuff.ore_rarity = 5
|
||||
|
||||
local function is_not_an_ore(ore_name)
|
||||
for _,no_ore in ipairs(additional_stuff.not_an_ore) do
|
||||
|
@ -148,7 +150,7 @@ local function choose_ore()
|
|||
if is_not_an_ore(ore.ore) then
|
||||
-- Do noting, keep cycling.
|
||||
elseif ore.wherein == cool_flowing and ore.ore_type == "scatter" then
|
||||
local rarity = math.floor(ore.clust_scarcity / ore.clust_size)
|
||||
local rarity = math.floor(additional_stuff.ore_rarity * ore.clust_scarcity / ore.clust_size)
|
||||
if math.random(rarity) == 1 then
|
||||
cool_flowing = ore.ore
|
||||
break
|
||||
|
@ -171,18 +173,8 @@ default.cool_lava = function(pos, node)
|
|||
end
|
||||
minetest.set_node(pos, {name = cool_source})
|
||||
else -- Lava flowing
|
||||
local ORE_RARITY = 5
|
||||
local stone = "default:stone"
|
||||
for _, ore in pairs(minetest.registered_ores) do
|
||||
if ore.wherein == stone and ore.ore_type == "scatter" then
|
||||
local rarity = math.floor(ORE_RARITY * ore.clust_scarcity / ore.clust_size)
|
||||
if math.random(rarity) == 1 then
|
||||
stone = ore.ore
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.set_node(pos, {name = stone})
|
||||
local cool_flowing = choose_ore()
|
||||
minetest.set_node(pos, {name = cool_flowing})
|
||||
end
|
||||
minetest.sound_play("default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
|
|
Loading…
Reference in New Issue