Add cave stones.

master
Duane Robertson 2016-04-04 23:47:42 -05:00
parent cee178f3cc
commit c67e7a17b7
1 changed files with 28 additions and 11 deletions

View File

@ -63,6 +63,17 @@ do
end
end
local cave_stones = {
"loud_walking:stone_with_moss",
"loud_walking:stone_with_lichen",
"loud_walking:stone_with_algae",
"loud_walking:stone_with_salt",
}
local mushroom_stones = {}
mushroom_stones[node("default:stone")] = true
mushroom_stones[node("loud_walking:stone_with_algae")] = true
mushroom_stones[node("loud_walking:stone_with_lichen")] = true
local function place_schematic(pos, schem, center)
local yslice = {}
if schem.yslice_prob then
@ -178,7 +189,7 @@ local function get_biome(px, pz)
end
local biome = biome_names[rarity][math.random(#biome_names[rarity])]
return biome
--return "glacier"
--return "sandstone_grassland"
end
local function get_decoration(biome)
@ -227,6 +238,10 @@ function loud_walking.generate(p_minp, p_maxp, seed)
local px = math.floor((minp.x + 32) / csize.x)
local pz = math.floor((minp.z + 32) / csize.z)
local biome = get_biome(px, pz)
local cave_lining = cave_stones[math.random(#cave_stones)]
if math.random(3) == 1 then
cave_lining = nil
end
local node_top = biomes[biome].node_top or "default:dirt_with_grass"
local node_filler = biomes[biome].node_filler or "default:dirt"
@ -281,7 +296,7 @@ function loud_walking.generate(p_minp, p_maxp, seed)
lightmap[ivm] = 0
in_cave = false
elseif math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) < bevel + 1 then
if dy < half then
if biome ~= "underground" and dy < half then
data[ivm] = node("loud_walking:scrith")
lightmap[ivm] = 0
else
@ -293,7 +308,7 @@ function loud_walking.generate(p_minp, p_maxp, seed)
if math.abs(dy - half - 2) < 2 and (dz == half or dx == half) then
data[ivm] = node("air")
else
if dy < half then
if biome ~= "underground" and dy < half then
data[ivm] = node("loud_walking:scrith")
lightmap[ivm] = 0
else
@ -331,10 +346,11 @@ function loud_walking.generate(p_minp, p_maxp, seed)
data[ivm] = node("air")
in_cave = false
elseif cave[index3d] ^ 2 > (biome == "underground" and 0.5 or 1.3 - math.sin(dy / (half * 0.2))) then
cave_height = cave_height + 1
if terr + ground >= dy and not in_cave and dy > terr + ground - 10 then
data[ivm] = node(node_top)
elseif dy == 1 then
if not ocean and not swamp and not beach and math.random(6) == 1 then
if not cave_lining and not ocean and not swamp and not beach and biome ~= "glacier" and math.random(6) == 1 then
data[ivm] = node("default:lava_source")
elseif ocean or swamp or beach then
data[ivm] = node(node_filler)
@ -343,16 +359,16 @@ function loud_walking.generate(p_minp, p_maxp, seed)
data[ivm] = node("loud_walking:glowing_fungal_stone")
elseif (ocean or swamp or beach) and dy < half then
data[ivm] = node(node_water)
elseif cave_height == 2 and node_filler == "default:dirt" and data[ivm - 3] == node(node_stone) and math.random(40) == 1 then
elseif cave_height == 3 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 3 * a.ystride]] and math.random(40) == 1 then
data[ivm] = node("loud_walking:giant_mushroom_cap")
data[ivm - a.ystride] = node("loud_walking:giant_mushroom_stem")
data[ivm - 2 * a.ystride] = node("loud_walking:giant_mushroom_stem")
data[ivm - 3 * a.ystride] = node(node_filler)
elseif cave_height == 1 and node_filler == "default:dirt" and data[ivm - 3] == node(node_stone) and math.random(20) == 1 then
elseif cave_height == 2 and node_filler == "default:dirt" and mushroom_stones[data[ivm - 2 * a.ystride]] and math.random(20) == 1 then
data[ivm] = node("loud_walking:huge_mushroom_cap")
data[ivm - a.ystride] = node("loud_walking:giant_mushroom_stem")
data[ivm - 2 * a.ystride] = node(node_filler)
elseif not in_cave and node_stone == "default:stone" and math.random(10) == 1 then
elseif not in_cave and node_stone == "default:stone" and not cave_lining and math.random(10) == 1 then
data[ivm] = node("loud_walking:stalagmite")
elseif not in_cave and node_stone == "default:ice" and math.random(10) == 1 then
data[ivm] = node("loud_walking:icicle_up")
@ -361,6 +377,9 @@ function loud_walking.generate(p_minp, p_maxp, seed)
end
in_cave = true
lightmap[ivm] = 0
elseif cave_lining and cave[index3d] ^ 2 > (biome == "underground" and 0.4 or 1.2 - math.sin(dy / (half * 0.2))) then
data[ivm] = node(cave_lining)
lightmap[ivm] = 0
elseif dy > terr + ground - depth_top then
data[ivm] = node(node_top)
lightmap[ivm] = 0
@ -375,7 +394,7 @@ function loud_walking.generate(p_minp, p_maxp, seed)
data[ivm] = node(node_stone)
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 math.random(10) == 1 then
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
data[ivm - a.ystride] = node("loud_walking:stalactite")
elseif in_cave and not (ocean or swamp or beach) and node_stone == "default:ice" and math.random(10) == 1 then
data[ivm - a.ystride] = node("loud_walking:icicle_down")
@ -390,9 +409,7 @@ function loud_walking.generate(p_minp, p_maxp, seed)
write = true
end
if in_cave then
cave_height = cave_height + 1
else
if not in_cave then
cave_height = 0
end
ivm = ivm + a.ystride