Replace default ore generation.
parent
3affe23a94
commit
fe4c162089
28
mapgen.lua
28
mapgen.lua
|
@ -151,6 +151,7 @@ local room_size = 20
|
|||
local control_off = math_floor(room_size / 4)
|
||||
local biome_look = {}
|
||||
local cave_look = {}
|
||||
local ore_look = {}
|
||||
local tree_space = 3
|
||||
|
||||
loud_walking.fcsize = table.copy(fcsize)
|
||||
|
@ -237,10 +238,27 @@ local function get_biome(x, y, z)
|
|||
cave_lining = cave_stones[math.random(#cave_stones)]
|
||||
end
|
||||
cave_look[hash] = cave_lining
|
||||
|
||||
local sr = math.random(100)
|
||||
if sr == 1 then
|
||||
ore_look[hash] = 'default:stone_with_mese'
|
||||
elseif sr <= 3 then
|
||||
ore_look[hash] = 'default:stone_with_diamond'
|
||||
elseif sr <= 7 then
|
||||
ore_look[hash] = 'default:stone_with_gold'
|
||||
elseif sr <= 15 then
|
||||
ore_look[hash] = 'default:stone_with_copper'
|
||||
elseif sr <= 31 then
|
||||
ore_look[hash] = 'default:stone_with_iron'
|
||||
elseif sr <= 63 then
|
||||
ore_look[hash] = 'default:stone_with_coal'
|
||||
else
|
||||
ore_look[hash] = 'default:stone'
|
||||
end
|
||||
end
|
||||
|
||||
--return 'rainforest', cave_look[hash]
|
||||
return biome_look[hash], cave_look[hash]
|
||||
return biome_look[hash], cave_look[hash], ore_look[hash]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -301,7 +319,7 @@ local function generate(p_minp, p_maxp, seed)
|
|||
local index = 0
|
||||
local index3d = 0
|
||||
local last_biome, last_px, last_py, last_pz, node_top, node_filler, node_water_top, node_water, depth_top, depth_water_top, depth_filler, node_stone, ocean, swamp, beach, dunes, height
|
||||
local biome, cave_lining, room_type, room_type_below
|
||||
local biome, cave_lining, room_type, room_type_below, ore_type
|
||||
|
||||
for z = minp.z, maxp.z do
|
||||
local dz = z - minp.z
|
||||
|
@ -335,7 +353,7 @@ local function generate(p_minp, p_maxp, seed)
|
|||
end
|
||||
|
||||
if py ~= last_py or px ~= last_px or pz ~= last_pz then
|
||||
biome, cave_lining = get_biome(x, y, z)
|
||||
biome, cave_lining, ore_type = get_biome(x, y, z)
|
||||
end
|
||||
if biome ~= last_biome then
|
||||
node_top = biomes[biome].node_top or "default:dirt_with_grass"
|
||||
|
@ -505,6 +523,10 @@ local function generate(p_minp, p_maxp, seed)
|
|||
in_cave = false
|
||||
else
|
||||
data[ivm] = node[node_stone]
|
||||
if math.random(100) == 1 then
|
||||
data[ivm] = node[ore_type]
|
||||
end
|
||||
|
||||
if in_cave and node_stone == "default:stone" and math.random(20) == 1 then
|
||||
data[ivm] = node["loud_walking:glowing_fungal_stone"]
|
||||
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:stone" and not cave_lining and math.random(10) == 1 then
|
||||
|
|
Loading…
Reference in New Issue