Make domes sky-like.
parent
edd82cce62
commit
46a82f2f64
46
mapgen.lua
46
mapgen.lua
|
@ -1,7 +1,8 @@
|
||||||
local node = loud_walking.node
|
local node = loud_walking.node
|
||||||
|
|
||||||
local bevel = 40
|
local bevel = 40
|
||||||
local glass = "loud_walking:transparent_scrith"
|
local cloud_i = 0.5
|
||||||
|
local glass = {"loud_walking:sky_scrith", "loud_walking:cloud_scrith", "loud_walking:transparent_scrith"}
|
||||||
|
|
||||||
|
|
||||||
local data = {}
|
local data = {}
|
||||||
|
@ -18,6 +19,10 @@ local cave_noise = {offset = 0, scale = 1,
|
||||||
seed = -3977, spread = {x = 30, y = 30, z = 30}, octaves = 3,
|
seed = -3977, spread = {x = 30, y = 30, z = 30}, octaves = 3,
|
||||||
persist = 0.8, lacunarity = 2}
|
persist = 0.8, lacunarity = 2}
|
||||||
|
|
||||||
|
local cloud_noise = {offset = 0, scale = 1,
|
||||||
|
seed = -7874, spread = {x = 30, y = 30, z = 30}, octaves = 3,
|
||||||
|
persist = 0.8, lacunarity = 2}
|
||||||
|
|
||||||
loud_walking.biomes = {}
|
loud_walking.biomes = {}
|
||||||
local biomes = loud_walking.biomes
|
local biomes = loud_walking.biomes
|
||||||
local biome_names = {}
|
local biome_names = {}
|
||||||
|
@ -235,8 +240,6 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||||
csize = vector.add(vector.subtract(maxp, minp), 1)
|
csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||||
|
|
||||||
local write = false
|
|
||||||
|
|
||||||
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
-- Deal with memory issues. This, of course, is supposed to be automatic.
|
||||||
local mem = math.floor(collectgarbage("count")/1024)
|
local mem = math.floor(collectgarbage("count")/1024)
|
||||||
if mem > 300 then
|
if mem > 300 then
|
||||||
|
@ -283,6 +286,7 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
|
|
||||||
terrain = minetest.get_perlin_map(terrain_noise, csize):get2dMap_flat(minp)
|
terrain = minetest.get_perlin_map(terrain_noise, csize):get2dMap_flat(minp)
|
||||||
cave = minetest.get_perlin_map(cave_noise, csize):get3dMap_flat(minp)
|
cave = minetest.get_perlin_map(cave_noise, csize):get3dMap_flat(minp)
|
||||||
|
cloud = minetest.get_perlin_map(cloud_noise, csize):get2dMap_flat(minp)
|
||||||
|
|
||||||
local pod = is_pod(minp.x, minp.y, minp.z)
|
local pod = is_pod(minp.x, minp.y, minp.z)
|
||||||
local connection = connection(minp.x, minp.y, minp.z)
|
local connection = connection(minp.x, minp.y, minp.z)
|
||||||
|
@ -316,10 +320,9 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
data[ivm] = node("loud_walking:scrith")
|
data[ivm] = node("loud_walking:scrith")
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
else
|
else
|
||||||
data[ivm] = node(glass)
|
data[ivm] = node(glass[cloud[index] < cloud_i and 1 or 2])
|
||||||
end
|
end
|
||||||
in_cave = false
|
in_cave = false
|
||||||
write = true
|
|
||||||
elseif (dx == 0 or dx == csize.x - 1) or (dz == 0 or dz == csize.z - 1) or (dy == 0 or dy == csize.y - 1) then
|
elseif (dx == 0 or dx == csize.x - 1) or (dz == 0 or dz == csize.z - 1) or (dy == 0 or dy == csize.y - 1) then
|
||||||
if math.abs(dy - half - 2) < 2 and (dz == half or dx == half) then
|
if math.abs(dy - half - 2) < 2 and (dz == half or dx == half) then
|
||||||
data[ivm] = node("air")
|
data[ivm] = node("air")
|
||||||
|
@ -327,31 +330,30 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
if biome ~= "underground" and dy < half then
|
if biome ~= "underground" and dy < half then
|
||||||
data[ivm] = node("loud_walking:scrith")
|
data[ivm] = node("loud_walking:scrith")
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
|
elseif dy == csize.y - 1 then
|
||||||
|
data[ivm] = node(glass[cloud[index] < cloud_i and 1 or 2])
|
||||||
else
|
else
|
||||||
data[ivm] = node(glass)
|
data[ivm] = node(glass[1])
|
||||||
end
|
end
|
||||||
write = true
|
|
||||||
end
|
end
|
||||||
in_cave = false
|
in_cave = false
|
||||||
elseif (((dx == 35 or dx == 45) and dz >= 35 and dz <= 45) or ((dz == 35 or dz == 45) and dx >= 35 and dx <= 45)) and dx ~= 40 and dz ~= 40 and dy == csize.y - 2 then
|
elseif (((dx == 35 or dx == 45) and dz >= 35 and dz <= 45) or ((dz == 35 or dz == 45) and dx >= 35 and dx <= 45)) and dx ~= 40 and dz ~= 40 and dy == csize.y - 2 then
|
||||||
data[ivm] = node("loud_walking:controls")
|
data[ivm] = node("loud_walking:controls")
|
||||||
elseif (((dx == 35 or dx == 45) and dz >= 35 and dz <= 45) or ((dz == 35 or dz == 45) and dx >= 35 and dx <= 45)) and dx ~= 40 and dz ~= 40 and dy > csize.y - 5 then
|
elseif (((dx == 35 or dx == 45) and dz >= 35 and dz <= 45) or ((dz == 35 or dz == 45) and dx >= 35 and dx <= 45)) and dx ~= 40 and dz ~= 40 and dy > csize.y - 5 then
|
||||||
data[ivm] = node(glass)
|
data[ivm] = node(glass[3])
|
||||||
elseif dz >= 35 and dz <= 45 and dx >= 35 and dx <= 45 and dy == csize.y - 5 then
|
elseif dz >= 35 and dz <= 45 and dx >= 35 and dx <= 45 and dy == csize.y - 5 then
|
||||||
data[ivm] = node(glass)
|
data[ivm] = node(glass[3])
|
||||||
elseif not in_cave and (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy == terr + ground + 1 then
|
elseif not in_cave and (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy == terr + ground + 1 then
|
||||||
-- ** water decorations **
|
-- ** water decorations **
|
||||||
--local deco = get_decoration(biome)
|
--local deco = get_decoration(biome)
|
||||||
--if deco then
|
--if deco then
|
||||||
-- data[ivm] = node(deco)
|
-- data[ivm] = node(deco)
|
||||||
--end
|
--end
|
||||||
--write = true
|
|
||||||
elseif not in_cave and dy == terr + ground + 1 then
|
elseif not in_cave and dy == terr + ground + 1 then
|
||||||
local deco = get_decoration(biome)
|
local deco = get_decoration(biome)
|
||||||
if deco then
|
if deco then
|
||||||
data[ivm] = node(deco)
|
data[ivm] = node(deco)
|
||||||
end
|
end
|
||||||
write = true
|
|
||||||
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy >= half - depth_water_top then
|
elseif (ocean or swamp or beach) and dy > terr + ground and dy <= half and dy >= half - depth_water_top then
|
||||||
data[ivm] = node(node_water_top)
|
data[ivm] = node(node_water_top)
|
||||||
in_cave = false
|
in_cave = false
|
||||||
|
@ -400,12 +402,10 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
data[ivm] = node(node_top)
|
data[ivm] = node(node_top)
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
in_cave = false
|
in_cave = false
|
||||||
write = true
|
|
||||||
elseif dy > terr + ground - depth_filler - depth_top then
|
elseif dy > terr + ground - depth_filler - depth_top then
|
||||||
data[ivm] = node(node_filler)
|
data[ivm] = node(node_filler)
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
in_cave = false
|
in_cave = false
|
||||||
write = true
|
|
||||||
else
|
else
|
||||||
data[ivm] = node(node_stone)
|
data[ivm] = node(node_stone)
|
||||||
if in_cave and node_stone == "default:stone" and math.random(20) == 1 then
|
if in_cave and node_stone == "default:stone" and math.random(20) == 1 then
|
||||||
|
@ -417,12 +417,10 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
end
|
end
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
in_cave = false
|
in_cave = false
|
||||||
write = true
|
|
||||||
end
|
end
|
||||||
elseif connection and dy == half and ((dx == half and connection % 4 == 0) or (dz == half and connection % 2 == 1)) then
|
elseif connection and dy == half and ((dx == half and connection % 4 == 0) or (dz == half and connection % 2 == 1)) then
|
||||||
data[ivm] = node("loud_walking:scrith")
|
data[ivm] = node("loud_walking:scrith")
|
||||||
lightmap[ivm] = 0
|
lightmap[ivm] = 0
|
||||||
write = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not in_cave then
|
if not in_cave then
|
||||||
|
@ -462,17 +460,17 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if write then
|
vm:set_data(data)
|
||||||
vm:set_data(data)
|
minetest.generate_ores(vm, minp, maxp)
|
||||||
minetest.generate_ores(vm, minp, maxp)
|
minetest.generate_decorations(vm, minp, maxp)
|
||||||
minetest.generate_decorations(vm, minp, maxp)
|
--vm:set_param2_data(p2data)
|
||||||
--vm:set_param2_data(p2data)
|
--vm:set_lighting({day = 15, night = 0})
|
||||||
--vm:set_lighting({day = 15, night = 0})
|
if pod then
|
||||||
vm:set_light_data(lightmap)
|
vm:set_light_data(lightmap)
|
||||||
vm:calc_lighting(minp, maxp, false)
|
|
||||||
vm:update_liquids()
|
|
||||||
vm:write_to_map()
|
|
||||||
end
|
end
|
||||||
|
vm:update_liquids()
|
||||||
|
vm:calc_lighting(minp, maxp, false)
|
||||||
|
vm:write_to_map()
|
||||||
|
|
||||||
vm, a, heightmap, biomemap = nil, nil, nil, nil
|
vm, a, heightmap, biomemap = nil, nil, nil, nil
|
||||||
end
|
end
|
||||||
|
|
19
nodes.lua
19
nodes.lua
|
@ -21,8 +21,23 @@ minetest.register_node("loud_walking:scrith", {
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
local node = loud_walking.clone_node("default:glass")
|
minetest.register_node("loud_walking:sky_scrith", {
|
||||||
node.groups = {}
|
description = "Transparent Scrith",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"loud_walking_sky_glass.png"},
|
||||||
|
light_source = 1,
|
||||||
|
use_texture_alpha = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
local node = loud_walking.clone_node("loud_walking:sky_scrith")
|
||||||
|
node.tiles = {"loud_walking_cloud_glass.png"}
|
||||||
|
minetest.register_node("loud_walking:cloud_scrith", node)
|
||||||
|
local node = loud_walking.clone_node("loud_walking:sky_scrith")
|
||||||
|
node.tiles = {"loud_walking_glass_detail.png"}
|
||||||
minetest.register_node("loud_walking:transparent_scrith", node)
|
minetest.register_node("loud_walking:transparent_scrith", node)
|
||||||
|
|
||||||
minetest.register_node("loud_walking:controls", {
|
minetest.register_node("loud_walking:controls", {
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 144 B |
Binary file not shown.
After Width: | Height: | Size: 167 B |
Binary file not shown.
After Width: | Height: | Size: 144 B |
Loading…
Reference in New Issue