Add hot spikes. Bias ores toward bad zones.
This commit is contained in:
parent
87fbc5256c
commit
0780d8dd67
4 changed files with 124 additions and 16 deletions
23
init.lua
23
init.lua
|
@ -15,6 +15,7 @@ minetest.register_on_mapgen_init(function(mgparams)
|
|||
end)
|
||||
|
||||
|
||||
fun_caves.ores = {}
|
||||
if default then
|
||||
if default.register_ores then
|
||||
default.register_ores()
|
||||
|
@ -35,6 +36,8 @@ if default then
|
|||
local ores = {}
|
||||
for id, ore_table in pairs(minetest.registered_ores) do
|
||||
local ore = table.copy(ore_table)
|
||||
local ore2 = table.copy(ore_table)
|
||||
table.insert(fun_caves.ores, ore2)
|
||||
ore.y_min = -31000
|
||||
ore.y_max = 31000
|
||||
table.insert(ores, ore)
|
||||
|
@ -47,6 +50,26 @@ if default then
|
|||
end
|
||||
|
||||
|
||||
function fun_caves.set_ores(biome)
|
||||
local ores = fun_caves.ores
|
||||
|
||||
--print("generating ores based on biome: "..biome)
|
||||
local y_factor = (math.abs(biome) - 0.4) * -3500
|
||||
--print("y_factor: "..y_factor)
|
||||
|
||||
minetest.clear_registered_ores()
|
||||
for id, ore_table in pairs(ores) do
|
||||
local ore = table.copy(ore_table)
|
||||
if ore.y_max >= y_factor then
|
||||
--print("using ore: "..ore.ore..", y_max: "..ore.y_max)
|
||||
ore.y_min = -31000
|
||||
ore.y_max = 31000
|
||||
minetest.register_ore(ore)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Check if the table contains an element.
|
||||
function table.contains(table, element)
|
||||
for key, value in pairs(table) do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue