Singlenode option. ores. fissures. cloud every 160n. mod dirt/grass nodes. harmonic noise
This commit is contained in:
parent
6dc945dadc
commit
c35ddd8d8c
@ -1,4 +1,4 @@
|
|||||||
fracture 0.1.1 by paramat
|
fracture 0.1.2 by paramat
|
||||||
For latest stable Minetest back to 0.4.8
|
For latest stable Minetest back to 0.4.8
|
||||||
Depends default
|
Depends default
|
||||||
Licenses: code WTFPL
|
Licenses: code WTFPL
|
@ -97,3 +97,13 @@ function fracture_cactus(x, y, z, area, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Singlenode option
|
||||||
|
|
||||||
|
local SINGLENODE = false
|
||||||
|
|
||||||
|
if SINGLENODE then
|
||||||
|
minetest.register_on_mapgen_init(function(mgparams)
|
||||||
|
minetest.set_mapgen_params({mgname="singlenode", water_level=-32000})
|
||||||
|
end)
|
||||||
|
end
|
172
init.lua
172
init.lua
@ -1,47 +1,73 @@
|
|||||||
-- fracture 0.1.1 by paramat
|
-- fracture 0.1.2 by paramat
|
||||||
-- For latest stable Minetest and back to 0.4.8
|
-- For latest stable Minetest and back to 0.4.8
|
||||||
-- Depends default
|
-- Depends default
|
||||||
-- License: code WTFPL
|
-- License: code WTFPL
|
||||||
|
|
||||||
-- 0.1.1
|
-- 0.1.2
|
||||||
-- tune parameters
|
-- singlenode option
|
||||||
-- vertical overgeneration
|
-- ores
|
||||||
-- 16x16 clouds
|
-- fissures
|
||||||
|
-- cloud in odd chunk layers
|
||||||
|
-- noise squash of 128:256
|
||||||
|
-- mod dirt nodes
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local YMIN = -33000
|
local YMIN = 208
|
||||||
local YMAX = 33000
|
local YMAX = 33000
|
||||||
local DENOFF = -0.4 -- Density offset, -2 to 2, 0 = equal volumes of air and floatland
|
local DENOFF = -0.4 -- Density offset, -2 to 2, 0 = equal volumes of air and floatland
|
||||||
local TSTONE = 0.05 -- Stone density threshold, controls average depth of stone below surface
|
local TSTONE = 0.03 -- Stone density threshold, controls average depth of stone below surface
|
||||||
local STABLE = 2 -- Minimum number of stacked stone nodes in column required to support dirt/sand
|
local TFIS = 0.02 -- Fissure threshold, controls width
|
||||||
|
local ORECHA = 1 / (5 * 5 * 5) -- Ore chance per stone node
|
||||||
|
|
||||||
local BLEND = 0.03 -- Controls biome blend distance
|
local BLEND = 0.03 -- Controls biome blend distance
|
||||||
local PINCHA = 36 -- Pine chance 1/x chance
|
local PINCHA = 17 * 17 -- Pine chance 1/x chance per surface node
|
||||||
local APPCHA = 36 -- Appletree 1/x chance
|
local APPCHA = 13 * 13 -- Appletree
|
||||||
local CACCHA = 841 -- Cactus 1/x chance
|
local CACCHA = 31 * 31 -- Cactus
|
||||||
local TCAC = 0.2 -- Cactus threshold, width of cactus areas
|
local TCAC = 0.1 -- Cactus threshold, width of cactus areas
|
||||||
local TFOR = 0.2 -- Forest threshold, width of forest paths/clearings
|
local TFOR = 0.1 -- Forest threshold, width of forest paths/clearings
|
||||||
|
|
||||||
-- 3D noise for terrain
|
-- 3D noise for terrain
|
||||||
|
|
||||||
local np_terrain = {
|
local np_terrain = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=512, y=171, z=512},
|
spread = {x=256, y=128, z=256},
|
||||||
seed = 5900033,
|
seed = 593,
|
||||||
octaves = 6,
|
octaves = 5,
|
||||||
persist = 0.67
|
persist = 0.67
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- 3D noise for alt terrain
|
||||||
|
|
||||||
|
local np_terralt = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=207, y=104, z=207},
|
||||||
|
seed = 593,
|
||||||
|
octaves = 5,
|
||||||
|
persist = 0.67
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 3D noise for fissures
|
||||||
|
|
||||||
|
local np_fissure = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=128, y=256, z=128},
|
||||||
|
seed = 593,
|
||||||
|
octaves = 4,
|
||||||
|
persist = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
-- 3D noise for biomes
|
-- 3D noise for biomes
|
||||||
|
|
||||||
local np_biome = {
|
local np_biome = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=512, y=171, z=512},
|
spread = {x=512, y=256, z=512},
|
||||||
seed = -188900,
|
seed = -188900,
|
||||||
octaves = 3,
|
octaves = 2,
|
||||||
persist = 0.33
|
persist = 0.33
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +78,8 @@ local np_flora = {
|
|||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=256, y=256, z=256},
|
spread = {x=256, y=256, z=256},
|
||||||
seed = 188,
|
seed = 188,
|
||||||
octaves = 4,
|
octaves = 2,
|
||||||
persist = 0.67
|
persist = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 3D noise for cloud noise
|
-- 3D noise for cloud noise
|
||||||
@ -61,10 +87,10 @@ local np_flora = {
|
|||||||
local np_cloud = {
|
local np_cloud = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=52, y=52, z=52},
|
spread = {x=26, y=26, z=26},
|
||||||
seed = -144111,
|
seed = 593,
|
||||||
octaves = 2,
|
octaves = 2,
|
||||||
persist = 1
|
persist = 0.67
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Stuff
|
-- Stuff
|
||||||
@ -91,6 +117,37 @@ minetest.register_node("fracture:desertstone", {
|
|||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("fracture:dirt", {
|
||||||
|
description = "Dirt",
|
||||||
|
tiles = {"default_dirt.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {crumbly=3,soil=1},
|
||||||
|
drop = "default:dirt",
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("fracture:dirtsnow", {
|
||||||
|
description = "Dirt with Snow",
|
||||||
|
tiles = {"default_snow.png", "default_dirt.png", "default_snow.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=3},
|
||||||
|
drop = "default:dirt",
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("fracture:grass", {
|
||||||
|
description = "Grass",
|
||||||
|
tiles = {"default_grass.png", "default_dirt.png", "default_grass.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {crumbly=3,soil=1},
|
||||||
|
drop = "default:dirt",
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.25},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("fracture:appleleaf", {
|
minetest.register_node("fracture:appleleaf", {
|
||||||
description = "Appletree Leaves",
|
description = "Appletree Leaves",
|
||||||
drawtype = "allfaces_optional",
|
drawtype = "allfaces_optional",
|
||||||
@ -138,12 +195,6 @@ minetest.register_node("fracture:cloud", {
|
|||||||
post_effect_color = {a=63, r=241, g=248, b=255},
|
post_effect_color = {a=63, r=241, g=248, b=255},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set mapgen parameters
|
|
||||||
|
|
||||||
minetest.register_on_mapgen_init(function(mgparams)
|
|
||||||
minetest.set_mapgen_params({mgname="singlenode", water_level=-32000})
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- On generated function
|
-- On generated function
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
@ -158,28 +209,36 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local x0 = minp.x
|
local x0 = minp.x
|
||||||
local y0 = minp.y
|
local y0 = minp.y
|
||||||
local z0 = minp.z
|
local z0 = minp.z
|
||||||
|
local chuy = math.floor((y0 + 32) / 80)
|
||||||
print ("[fracture] chunk minp ("..x0.." "..y0.." "..z0..")")
|
print ("[fracture] chunk minp ("..x0.." "..y0.." "..z0..")")
|
||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
|
|
||||||
local c_air = minetest.get_content_id("air")
|
|
||||||
local c_stone = minetest.get_content_id("fracture:stone")
|
local c_stone = minetest.get_content_id("fracture:stone")
|
||||||
local c_destone = minetest.get_content_id("fracture:desertstone")
|
local c_destone = minetest.get_content_id("fracture:desertstone")
|
||||||
local c_cloud = minetest.get_content_id("fracture:cloud")
|
local c_cloud = minetest.get_content_id("fracture:cloud")
|
||||||
|
local c_dirt = minetest.get_content_id("fracture:dirt")
|
||||||
|
local c_grass = minetest.get_content_id("fracture:grass")
|
||||||
|
local c_dirtsnow = minetest.get_content_id("fracture:dirtsnow")
|
||||||
|
|
||||||
local c_desand = minetest.get_content_id("default:desert_sand")
|
local c_desand = minetest.get_content_id("default:desert_sand")
|
||||||
local c_dirt = minetest.get_content_id("default:dirt")
|
|
||||||
local c_grass = minetest.get_content_id("default:dirt_with_grass")
|
|
||||||
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
|
|
||||||
local c_snowblock = minetest.get_content_id("default:snowblock")
|
local c_snowblock = minetest.get_content_id("default:snowblock")
|
||||||
|
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
||||||
|
local c_stomese = minetest.get_content_id("default:stone_with_mese")
|
||||||
|
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
||||||
|
local c_stocopp = minetest.get_content_id("default:stone_with_copper")
|
||||||
|
local c_stoiron = minetest.get_content_id("default:stone_with_iron")
|
||||||
|
local c_stocoal = minetest.get_content_id("default:stone_with_coal")
|
||||||
|
|
||||||
local sidelen = x1 - x0 + 1
|
local sidelen = x1 - x0 + 1
|
||||||
local chulens = {x=sidelen, y=sidelen+2, z=sidelen}
|
local chulens = {x=sidelen, y=sidelen+2, z=sidelen}
|
||||||
local minposxyz = {x=x0, y=y0-1, z=z0}
|
local minposxyz = {x=x0, y=y0-1, z=z0}
|
||||||
|
|
||||||
local nvals_terrain = minetest.get_perlin_map(np_terrain, chulens):get3dMap_flat(minposxyz)
|
local nvals_terrain = minetest.get_perlin_map(np_terrain, chulens):get3dMap_flat(minposxyz)
|
||||||
|
local nvals_terralt = minetest.get_perlin_map(np_terralt, chulens):get3dMap_flat(minposxyz)
|
||||||
|
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get3dMap_flat(minposxyz)
|
local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_flora = minetest.get_perlin_map(np_flora, chulens):get3dMap_flat(minposxyz)
|
local nvals_flora = minetest.get_perlin_map(np_flora, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_cloud = minetest.get_perlin_map(np_cloud, chulens):get3dMap_flat(minposxyz)
|
local nvals_cloud = minetest.get_perlin_map(np_cloud, chulens):get3dMap_flat(minposxyz)
|
||||||
@ -198,10 +257,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local viu = area:index(x0, y-1, z)
|
local viu = area:index(x0, y-1, z)
|
||||||
for x = x0, x1 do
|
for x = x0, x1 do
|
||||||
local si = x - x0 + 1
|
local si = x - x0 + 1
|
||||||
local density = nvals_terrain[nixyz] + DENOFF
|
|
||||||
local n_biome = nvals_biome[nixyz]
|
|
||||||
local n_flora = math.abs(nvals_flora[nixyz])
|
local n_flora = math.abs(nvals_flora[nixyz])
|
||||||
|
|
||||||
|
local n_terrain = nvals_terrain[nixyz]
|
||||||
|
local n_terralt = nvals_terralt[nixyz]
|
||||||
|
local density = (n_terrain + n_terralt) * 0.5 + DENOFF
|
||||||
|
|
||||||
|
local n_biome = nvals_biome[nixyz]
|
||||||
local biome = false
|
local biome = false
|
||||||
if n_biome > 0.4 + (math.random() - 0.5) * BLEND then
|
if n_biome > 0.4 + (math.random() - 0.5) * BLEND then
|
||||||
biome = 3
|
biome = 3
|
||||||
@ -211,7 +273,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
biome = 2
|
biome = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
if y == y0 - 1 then
|
local n_fissure = nvals_fissure[nixyz]
|
||||||
|
local nofis = false
|
||||||
|
if math.abs(n_fissure) > TFIS then
|
||||||
|
nofis = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if y == y0 - 1 then -- overgeneration, initialise tables
|
||||||
under[si] = 0
|
under[si] = 0
|
||||||
if ungen then
|
if ungen then
|
||||||
if density >= 0 then
|
if density >= 0 then
|
||||||
@ -233,16 +301,31 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
stable[si] = 0
|
stable[si] = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif y >= y0 and y <= y1 then
|
elseif y >= y0 and y <= y1 then -- stone, ores
|
||||||
if density >= TSTONE then
|
if nofis and density >= TSTONE then
|
||||||
if biome == 3 then
|
if biome == 3 then
|
||||||
data[vi] = c_destone
|
data[vi] = c_destone
|
||||||
|
elseif math.random() < ORECHA then
|
||||||
|
local osel = math.random(24)
|
||||||
|
if osel == 24 then
|
||||||
|
data[vi] = c_stodiam
|
||||||
|
elseif osel == 23 then
|
||||||
|
data[vi] = c_stomese
|
||||||
|
elseif osel == 22 then
|
||||||
|
data[vi] = c_stogold
|
||||||
|
elseif osel >= 19 then
|
||||||
|
data[vi] = c_stocopp
|
||||||
|
elseif osel >= 10 then
|
||||||
|
data[vi] = c_stoiron
|
||||||
|
else
|
||||||
|
data[vi] = c_stocoal
|
||||||
|
end
|
||||||
else
|
else
|
||||||
data[vi] = c_stone
|
data[vi] = c_stone
|
||||||
end
|
end
|
||||||
stable[si] = stable[si] + 1
|
stable[si] = stable[si] + 1
|
||||||
under[si] = 0
|
under[si] = 0
|
||||||
elseif density >= 0 and density < TSTONE and stable[si] >= 2 then
|
elseif density >= 0 and density < TSTONE and stable[si] >= 2 then -- fine materials
|
||||||
if biome == 3 then
|
if biome == 3 then
|
||||||
data[vi] = c_desand
|
data[vi] = c_desand
|
||||||
under[si] = 3
|
under[si] = 3
|
||||||
@ -253,7 +336,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[vi] = c_dirt
|
data[vi] = c_dirt
|
||||||
under[si] = 2
|
under[si] = 2
|
||||||
end
|
end
|
||||||
elseif density < 0 and under[si] ~= 0 then
|
elseif density < 0 and under[si] ~= 0 then -- air above surface node
|
||||||
if under[si] == 1 then
|
if under[si] == 1 then
|
||||||
if math.random(PINCHA) == 2 and n_flora > TFOR then
|
if math.random(PINCHA) == 2 and n_flora > TFOR then
|
||||||
fracture_snowypine(x, y, z, area, data)
|
fracture_snowypine(x, y, z, area, data)
|
||||||
@ -274,7 +357,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
stable[si] = 0
|
stable[si] = 0
|
||||||
under[si] = 0
|
under[si] = 0
|
||||||
elseif y == y0 + 1 then
|
elseif density < 0 and y == y1 - 1 and chuy ~= 1 -- clouds, not underground, not at y = 126
|
||||||
|
and chuy / 2 ~= math.floor(chuy / 2) then -- every odd chunk layer
|
||||||
local xrq = 16 * math.floor((x - x0) / 16)
|
local xrq = 16 * math.floor((x - x0) / 16)
|
||||||
local zrq = 16 * math.floor((z - z0) / 16)
|
local zrq = 16 * math.floor((z - z0) / 16)
|
||||||
local yrq = 79
|
local yrq = 79
|
||||||
@ -289,11 +373,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
stable[si] = 0
|
stable[si] = 0
|
||||||
under[si] = 0
|
under[si] = 0
|
||||||
end
|
end
|
||||||
elseif y == y1 + 1 then
|
elseif y == y1 + 1 then -- overgeneration, detect surface, add surface nodes
|
||||||
if density < 0 and under[si] ~= 0 then
|
if density < 0 and under[si] ~= 0 then
|
||||||
if under[si] == 1 then
|
if under[si] == 1 then
|
||||||
data[viu] = c_dirtsnow
|
data[viu] = c_dirtsnow
|
||||||
data[vi] = c_snowblock
|
data[vi] = c_snowblock -- added in chunk above
|
||||||
elseif under[si] == 2 then
|
elseif under[si] == 2 then
|
||||||
data[viu] = c_grass
|
data[viu] = c_grass
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user