Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a011034c2f | |||
e2f5faa83d | |||
53b4e26b58 |
@ -1,138 +0,0 @@
|
||||
# world_dir/map_meta.txt
|
||||
chunksize = 5
|
||||
mg_biome_np_heat = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 50
|
||||
persistence = 0.5
|
||||
scale = 50
|
||||
seed = 5349
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mg_biome_np_humidity = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 50
|
||||
persistence = 0.5
|
||||
scale = 50
|
||||
seed = 842
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mg_flags = trees, caves, nodungeons, noflat, light
|
||||
mg_name = v7
|
||||
mgv7_np_cave1 = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.5
|
||||
scale = 12
|
||||
seed = 52534
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_cave2 = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.5
|
||||
scale = 12
|
||||
seed = 10325
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_filler_depth = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.7
|
||||
scale = 1.2
|
||||
seed = 261
|
||||
spread = (150,150,150)
|
||||
}
|
||||
mgv7_np_height_select = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = -0.5
|
||||
persistence = 0.69
|
||||
scale = 1
|
||||
seed = 4213
|
||||
spread = (250,250,250)
|
||||
}
|
||||
mgv7_np_mount_height = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 6
|
||||
offset = 630
|
||||
persistence = 0.6
|
||||
scale = 250
|
||||
seed = 72449
|
||||
spread = (2000,2000,2000)
|
||||
}
|
||||
mgv7_np_mountain = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = -0.6
|
||||
persistence = 0.68
|
||||
scale = 1
|
||||
seed = 5333
|
||||
spread = (750,1400,750)
|
||||
}
|
||||
mgv7_np_ridge = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.75
|
||||
scale = 1
|
||||
seed = 6467
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_ridge_uwater = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.6
|
||||
scale = 1
|
||||
seed = 85039
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mgv7_np_terrain_alt = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = 4
|
||||
persistence = 0.6
|
||||
scale = 50
|
||||
seed = 5934
|
||||
spread = (1200,1200,1200)
|
||||
}
|
||||
mgv7_np_terrain_base = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 6
|
||||
offset = 4
|
||||
persistence = 0.7
|
||||
scale = 70
|
||||
seed = 82341
|
||||
spread = (300,300,300)
|
||||
}
|
||||
mgv7_np_terrain_persist = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 0.6
|
||||
persistence = 0.6
|
||||
scale = 0.1
|
||||
seed = 539
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mgv7_spflags = mountains, ridges
|
||||
seed = 9237944289836255171
|
||||
water_level = 1
|
||||
[end_of_params]
|
128
a.txt
@ -1,40 +1,29 @@
|
||||
Geological layer generator for Minetest "rocks" {wip}
|
||||
Geological layer generator for [Minetest] "rocks"
|
||||
=============
|
||||
|
||||
Aim of this mod is to replace all generic stone (default:stone) and
|
||||
generate underground layers of different rocks.
|
||||
|
||||
Currently everithing generated above ground, in air. This is for debugging.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* layers of different rocks: sort of working
|
||||
* ore veins: being added
|
||||
* extensibility, api: changed million times
|
||||
* ore veins: nothing
|
||||
* extensibility, api: ok
|
||||
|
||||
** Work in progress! **
|
||||
|
||||
* git clone git://repo.or.cz/rocks.git ([show](http://repo.or.cz/rocks.git/))
|
||||
* (old) Git clone: [https](https://gitorious.org/mt/rocks.git)
|
||||
* Forum [post](https://forum.minetest.net/viewtopic.php?f=9&t=11779)
|
||||
|
||||
This mod nor minetest_game/default do not define meaningful biomes.
|
||||
So if you do not want unlimited grassland I suggest installing the
|
||||
[Paramat's biomesdev mod](https://github.com/paramat/biomesdev) and adding
|
||||
"rocks?" to depends.txt file inside the biomesdev folder. This is needed,
|
||||
becouse "rocks" overrides the standard biome registration callback to patch
|
||||
in it's own sedimentary rocks.
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
all were out of date
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
* My Code: GNU General Public License v2 or higher.
|
||||
* Media: see txt files in the texture folder
|
||||
* stated in the corresponding file
|
||||
* Layers: 
|
||||
* Coal pane: 
|
||||
* Vein: 
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
@ -42,104 +31,3 @@ Documentation
|
||||
How the underground is generated: *todo*.
|
||||
|
||||
Mod has been rewritten, so no doc yet.
|
||||
|
||||
The sedimentary layer
|
||||
-------------
|
||||
|
||||
Is implemented by modifiing MGv7 biomes to use rocks's sedimentary rocks.
|
||||
This means that you need mapgen v7 enabled. I also suggest enabling caves
|
||||
and dungeons, as they are cool.
|
||||
|
||||
Soil is normlly 50-70 cm deep in real life, so I made soil (dirt) only 1
|
||||
block thick. Under this thin layer of dirt an sedimentary layer is located.
|
||||
In RL, there is clay and other stuff.
|
||||
|
||||
There are various types of sedimentary rock. They are generated according
|
||||
to 2D noises described below.
|
||||
|
||||
types = Clastic, Biochemical, Chemical, Vulcano/Other
|
||||
|
||||
| X | tp2<0.76 | tp2>0.7 |
|
||||
|--------|--------------|--------|
|
||||
| tp1<0.2 | Clastic | Chemical |
|
||||
| tp1>0.2 | BioChemical | Vu/Ot |
|
||||
|
||||
- Noise_tp1( 50)= type1
|
||||
- Noise_tp2( 70)= type2
|
||||
- Noise_vc(100)= particle size
|
||||
- Noise_sp(220)= pressue/ hardness
|
||||
|
||||
I. 2D: fast, acceptable imho <-(used)
|
||||
II. 3D: nice
|
||||
|
||||
### Clastic sediments
|
||||
|
||||
Made from large or small particles. Either loose or bound into stones.
|
||||
|
||||
(particle size: top-large botom-small)
|
||||
|
||||
(hargness: loose -> solid)
|
||||
|
||||
1. gravel -> conglomerate
|
||||
2. sand -> sandstone
|
||||
3. mudstone
|
||||
4. clay -> claystone -> slate
|
||||
|
||||
### BioChemical sediments
|
||||
|
||||
Made from acient plants and creatures that died long ago and turned into rock.
|
||||
|
||||
Noise_vs: kind of sediment: (top) oil, Limestone, other, carbon-based
|
||||
|
||||
Noise_sp: low quality -> high quality
|
||||
|
||||
1. oil: ?
|
||||
2. Limestone
|
||||
3. other: fosfates, silicates, hornfels (unimp)
|
||||
4. carbon-based: Lignite -> Coal -> Anthracite
|
||||
|
||||
### Chemical sediments
|
||||
|
||||
Created by chemical or physics/chemical reactions.
|
||||
|
||||
- Evaporites (unimp)
|
||||
|
||||
### Vulanic and extraterrestrial sediments
|
||||
|
||||
???
|
||||
|
||||
The Igenous layer
|
||||
--------------
|
||||
|
||||
Default stone is aliased to basalt, but for some reason the alias is not
|
||||
working so please treat stone as basalt until I find way to fix it.
|
||||
|
||||
Everything below sedimentary and (unimp) metamorphic layer is of igneous origin. Primary rock is basalt. But about half of basalt is replaced by granite. Some smaller fraction (like 20%) is then replaced by diorite and gabbro.
|
||||
These are the primary rocks, and more should come.
|
||||
|
||||
### Mineral distribution
|
||||
|
||||
Mineral ore is placed only in nodes of correct rock and only if the region
|
||||
for the ore is right. These "mineral biomes" can and do overlap and change
|
||||
every like 100 nodes. Following regions are defined:
|
||||
|
||||
| Region | minerals
|
||||
|---------|----------
|
||||
| Copper | Chalcopyrite, Malachyte
|
||||
| Pb/Zn | Sphalerite, Galena
|
||||
| Iron | Magnetite
|
||||
|
||||
### Skarn deposits
|
||||
|
||||
Are larg-ish (15-20m) blobs of skarn stone. They spawn only in granite and
|
||||
limestone. Copper, Lead, Zinc and Iron ores often enrich the skarn stone.
|
||||
Some deposits may (unimp) contain considerable amounts of Molybenium,
|
||||
Uranium and Wolfram ores.
|
||||
|
||||
Concentration of the minerals is quite high, as to regard the player for
|
||||
finding a not-so-common skarn vein.
|
||||
|
||||
### Pegmatite veis
|
||||
|
||||
Spawn only in granite. Are bit larger than skarn veins. Contain minerals
|
||||
like skarn and more exotic minerals.
|
||||
|
BIN
coal-pane0.png
Normal file
After Width: | Height: | Size: 154 KiB |
@ -1,2 +1 @@
|
||||
rocks
|
||||
default
|
@ -1,50 +0,0 @@
|
||||
depositgen={}
|
||||
local l={}
|
||||
depositgen.l=l
|
||||
|
||||
l.print=function(text)
|
||||
minetest.log("action","[depositgen] "..text)
|
||||
end
|
||||
|
||||
l.print("mod initializing")
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
l.OnGenerate={}
|
||||
l.OnInit={}
|
||||
l.ToResolve={}
|
||||
|
||||
local includes={
|
||||
"utils","pipes","veins"
|
||||
}
|
||||
|
||||
minetest.register_on_generated(function(minp,maxp,seed)
|
||||
l.print("on generated")
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local pr=PseudoRandom(seed)
|
||||
local data=vm:get_data()
|
||||
local mgc={minp=minp,maxp=maxp,pr=pr,data=data,area=area}
|
||||
for i=1, #l.OnGenerate do
|
||||
l.OnGenerate[i](mgc)
|
||||
end
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
-- todo: disable caves and ores
|
||||
-- todo: sort layers
|
||||
--Resolve all mapgen nodes to content ids
|
||||
l.print("Resolving node names")
|
||||
for index,i in pairs(l.ToResolve) do
|
||||
i.id=minetest.get_content_id(i.name)
|
||||
i.name=nil --free some memory
|
||||
end
|
||||
l.print("running mapgen initialization tasks")
|
||||
for _,i in pairs(l.OnInit) do
|
||||
i(mapgen_params)
|
||||
end
|
||||
end)
|
||||
|
||||
for _,s in pairs(includes) do dofile(modpath.."/"..s..".lua") end
|
@ -1,115 +0,0 @@
|
||||
-- experimental pipe generator
|
||||
local l=depositgen.l
|
||||
local print=l.print
|
||||
|
||||
-- the public table of registered pipes
|
||||
depositgen.pipes={}
|
||||
local regs=depositgen.pipes
|
||||
|
||||
depositgen.register_pipe= function(descr)
|
||||
local pipe={
|
||||
ymin=(descr.ymin or -10000),
|
||||
ymax=(descr.ymax or 200),
|
||||
scarcity=descr.scarcity,
|
||||
width=descr.width-1,
|
||||
content={ name=descr.content },
|
||||
scatter={}
|
||||
}
|
||||
table.insert(depositgen.l.ToResolve,pipe.content)
|
||||
for _,sc in pairs(descr.scatter) do
|
||||
local psc={
|
||||
scarcity=sc.scarcity,
|
||||
size=(sc.size or pipe.width),
|
||||
density=sc.density,
|
||||
content={ name=sc.content }
|
||||
}
|
||||
table.insert(depositgen.l.ToResolve,psc.content)
|
||||
table.insert(pipe.scatter,psc)
|
||||
end
|
||||
return table.insert(regs,pipe)
|
||||
end
|
||||
|
||||
do
|
||||
local sample_pipe_def={
|
||||
ymin=-200, ymax=-6,
|
||||
scarcity=80,
|
||||
width=4,
|
||||
content="default:glass",
|
||||
scatter={
|
||||
{ scarcity=7, density=4, content="default:mese", size=2 }
|
||||
}
|
||||
}
|
||||
--depositgen.register_pipe(sample_pipe_def)
|
||||
end
|
||||
|
||||
depositgen.l.ToResolve.air={name="air"}
|
||||
|
||||
local function generate(mgc)
|
||||
local t1 = os.clock()
|
||||
|
||||
local data = mgc.data
|
||||
local area = mgc.area
|
||||
local pr=mgc.pr
|
||||
local minp,maxp=mgc.minp,mgc.maxp
|
||||
local chunksizer = maxp.x - minp.x + 1
|
||||
local chunksize = chunksizer + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
|
||||
for _,descr in pairs(regs) do
|
||||
local numpipes_raw=(chunksize/descr.scarcity)
|
||||
local numpipes = math.floor(numpipes_raw + (pr:next(0,99)/100))
|
||||
|
||||
for vc=1, numpipes do
|
||||
local pointA=l.rndvector(mgc)
|
||||
local pointB=l.rndvector(mgc)
|
||||
local pointC=l.rndvector(mgc)
|
||||
local step=(1.8)/(vector.distance(pointA,pointB)+vector.distance(pointB,pointC))
|
||||
|
||||
for t=0, 1, step do
|
||||
local p=vector.multiply(pointA,(1-t)^2)
|
||||
local di
|
||||
p=vector.add(p, vector.multiply(pointB,2*t*(1-t)) )
|
||||
p=vector.add(p, vector.multiply(pointC,t*t) )
|
||||
p=vector.round(p)
|
||||
local radiusp=math.floor(descr.width/2)
|
||||
local radiusn=-descr.width+radiusp
|
||||
--<scatter>
|
||||
for _,ore in pairs(descr.scatter) do
|
||||
if pr:next(0,ore.scarcity)==0 then
|
||||
local ocx=pr:next(radiusn,radiusp)
|
||||
local ocy=pr:next(radiusn,radiusp)
|
||||
local ocz=pr:next(radiusn,radiusp)
|
||||
for y=ocy-ore.size, ocy+ore.size do
|
||||
for x=ocx-ore.size, ocx+ore.size do
|
||||
for z=ocz-ore.size, ocz+ore.size do
|
||||
if pr:next(0,ore.density)==0 then
|
||||
di=area:index(p.x+x,p.y+y,p.z+z)
|
||||
if data[di]==depositgen.l.ToResolve.air.id then
|
||||
data[di]=ore.content.id
|
||||
end
|
||||
end
|
||||
end end end
|
||||
end
|
||||
end
|
||||
--</scatter>
|
||||
--<brush>
|
||||
for y= radiusn, radiusp do
|
||||
for x= radiusn, radiusp do
|
||||
for z= radiusn, radiusp do
|
||||
di=area:index(p.x+x,p.y+y,p.z+z)
|
||||
if data[di]==depositgen.l.ToResolve.air.id then
|
||||
data[di]=descr.content.id
|
||||
end
|
||||
end end end
|
||||
--</brush>
|
||||
--brush(data,area,p,descr.radius,content,descr.scatter,orepr)
|
||||
end
|
||||
end
|
||||
|
||||
end --</apipe>
|
||||
|
||||
l.print("pipes "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
||||
|
||||
table.insert(depositgen.l.OnGenerate,generate)
|
@ -1,16 +0,0 @@
|
||||
function depositgen.l.SpawnCluster(mgc,pos,wherein,size,content,density)
|
||||
for y=pos.y-size, pos.y+size do
|
||||
for x=pos.x-size, pos.x+size do
|
||||
for z=pos.z-size, pos.z+size do
|
||||
if mgc.pr:next(0,density)==0 then
|
||||
di=mgc.area:index(x,y,z)
|
||||
if mgc.data[di]==wherein then
|
||||
mgc.data[di]=content
|
||||
end
|
||||
end
|
||||
end end end
|
||||
end
|
||||
function depositgen.l.rndvector(mgc)
|
||||
local chunksizer = mgc.maxp.x - mgc.minp.x + 1
|
||||
return vector.new(mgc.pr:next(0,chunksizer)+mgc.minp.x,mgc.pr:next(0,chunksizer)+mgc.minp.y,mgc.pr:next(0,chunksizer)+mgc.minp.z)
|
||||
end
|
@ -1,101 +0,0 @@
|
||||
-- experimental fast vein generator
|
||||
|
||||
local l=depositgen.l
|
||||
local print=l.print
|
||||
|
||||
-- the public table of registered veins
|
||||
depositgen.veins={}
|
||||
local regs=depositgen.veins
|
||||
|
||||
depositgen.register_vein= function(descr)
|
||||
local vein={
|
||||
ymin=(descr.ymin or -10000),
|
||||
ymax=(descr.ymax or 200),
|
||||
scarcity=descr.scarcity,
|
||||
content={ name=descr.content },
|
||||
scatter={}
|
||||
}
|
||||
table.insert(depositgen.l.ToResolve,vein.content)
|
||||
for _,sc in pairs(descr.scatter) do
|
||||
local psc={
|
||||
scarcity=sc.scarcity,
|
||||
size=(sc.size or vein.width),
|
||||
density=sc.density,
|
||||
content={ name=sc.content }
|
||||
}
|
||||
table.insert(depositgen.l.ToResolve,psc.content)
|
||||
table.insert(vein.scatter,psc)
|
||||
end
|
||||
return table.insert(regs,vein)
|
||||
end
|
||||
|
||||
do
|
||||
local sample_vein_def={
|
||||
ymin=-200, ymax=-6,
|
||||
scarcity=80,
|
||||
content="default:dirt",
|
||||
scatter={
|
||||
{ scarcity=7, density=4, content="default:mese", size=2 }
|
||||
}
|
||||
}
|
||||
depositgen.register_vein(sample_vein_def)
|
||||
end
|
||||
|
||||
local function generate(mgc)
|
||||
local t1 = os.clock()
|
||||
local data = mgc.data
|
||||
local area = mgc.area
|
||||
local pr=mgc.pr
|
||||
|
||||
local chunksizer = mgc.maxp.x - mgc.minp.x + 1
|
||||
local chunksize = chunksizer + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = mgc.minp.x, y = mgc.minp.z}
|
||||
|
||||
for _,descr in pairs(regs) do
|
||||
local num = math.floor( (chunksize/descr.scarcity) + (pr:next(0,99)/100) )
|
||||
for vc=1, num do
|
||||
|
||||
local A=l.rndvector(mgc)
|
||||
local B=l.rndvector(mgc)
|
||||
local C=l.rndvector(mgc)
|
||||
local D=l.rndvector(mgc)
|
||||
local l1=vector.distance(A,C)+vector.distance(C,B)
|
||||
local l2=vector.distance(A,D)+vector.distance(D,B)
|
||||
local step=2/math.max(l1,l2)
|
||||
for t=0, 1, step do
|
||||
local P=vector.multiply(A,(1-t)^2)
|
||||
P=vector.add(P, vector.multiply(B,t*t) )
|
||||
local Q=vector.add(P, vector.multiply(D,2*t*(1-t)) )
|
||||
P=vector.add(P, vector.multiply(C,2*t*(1-t)) )
|
||||
local step2=1/vector.distance(P,Q)
|
||||
for u=0, 1, step2 do
|
||||
local R=vector.add(vector.multiply(P,(1-u)), vector.multiply(Q,u) )
|
||||
--<brush>
|
||||
local di=area:indexp(vector.round(R))
|
||||
if data[di] then
|
||||
data[di]=descr.content.id
|
||||
end
|
||||
--</brush>
|
||||
end
|
||||
end
|
||||
--<ores>
|
||||
local cluster=descr.scatter[1]
|
||||
for xxx=1, 5 do
|
||||
local t=pr:next(0,100)/100
|
||||
local u=pr:next(0,100)/100
|
||||
local P=vector.multiply(A,(1-t)^2)
|
||||
P=vector.add(P, vector.multiply(B,t*t) )
|
||||
local Q=vector.add(P, vector.multiply(D,2*t*(1-t)) )
|
||||
P=vector.add(P, vector.multiply(C,2*t*(1-t)) )
|
||||
local R=vector.add(vector.multiply(P,(1-u)), vector.multiply(Q,u) )
|
||||
l.SpawnCluster(mgc,vector.round(R),l.ToResolve.air.id,cluster.size,cluster.content.id,cluster.density)
|
||||
end
|
||||
--</ores>
|
||||
end
|
||||
end
|
||||
|
||||
print("vein "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
||||
|
||||
table.insert(depositgen.l.OnGenerate,generate)
|
22
how.txt
@ -1,22 +0,0 @@
|
||||
I see that the state this mod is now is horrible. Now, as I passed my final
|
||||
exams, i decided to spend more time on this. Since I cannot write a
|
||||
complete geological simulator, I decided on the following strategy:
|
||||
|
||||
1. Under like 5km generate only igneous rocks.
|
||||
2. Abowe that generate sandstone, that will serve as placeholder for more rocks.
|
||||
3. Generate a fixed amout of layers of rocks there.
|
||||
- some igneous layers could represent lava spills
|
||||
- including metamorphic rocks
|
||||
4. Shift everything around (possibly multiple times) to simulate faults.
|
||||
5. Create some intrusions (name?) and underground volcanic activity.
|
||||
6. Create some veins.
|
||||
|
||||
Using 2d noise as heightmap has one notable advantage: Looping over 80*80
|
||||
nodes is faster than 80*80*80.
|
||||
|
||||
Minecraft mods I inspire from: Geologica, SGU bettergeo, geocraft.
|
||||
|
||||
Doing a complete geological mapgen could be possible too: Start with plate
|
||||
tectonics, deposit rock in layer on top of each other, do some faults and
|
||||
folding inbetween, put soil on top. This could produce an interesting
|
||||
landscape.
|
85
ign.lua
Normal file
@ -0,0 +1,85 @@
|
||||
--
|
||||
-- Igneous Layer
|
||||
--
|
||||
|
||||
local ign={
|
||||
top={
|
||||
offset = -10, scale = 0,
|
||||
spread = {x=80, y=80, z=80},
|
||||
octaves = 0, persist = 0 },
|
||||
bot={
|
||||
offset = -180, scale = 10, seed=rocksl.GetNextSeed(),
|
||||
spread = {x=80, y=80, z=80},
|
||||
octaves = 2, persist = 0.7 },
|
||||
primary={ name="rocks:basalt" },
|
||||
localized={},
|
||||
stats={ count=0, total=0, node={}, totalnodes=0 },
|
||||
debugging=nil
|
||||
}
|
||||
|
||||
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
|
||||
minetest.register_node( "rocks:basalt", {
|
||||
description = S("Basalt"),
|
||||
tiles = { "rocks_Basalt.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
-- more rock defs
|
||||
minetest.register_node( "rocks:granite", {
|
||||
description = S("Granite"),
|
||||
tiles = { "rocks_Granite.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=3, stone=1},
|
||||
})
|
||||
minetest.register_node( "rocks:diorite", {
|
||||
description = S("Diorite"),
|
||||
tiles = { "rocks_Diorite.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node( "rocks:gabbro", {
|
||||
description = S("Gabbro"),
|
||||
tiles = { "rocks_Gabbro.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
local reg=function(name,param)
|
||||
rocksl.register_stratus(ign,name,param)
|
||||
end
|
||||
rocks.register_igneous_stratus=reg
|
||||
|
||||
-- rock registration
|
||||
reg("rocks:granite", { spread=40, height=32, treshold=0.06})
|
||||
reg("rocks:diorite", { spread=40, height=32, treshold=0.23})
|
||||
reg("rocks:gabbro", { spread=40, height=32, treshold=0.36})
|
||||
|
||||
-- vein stuff
|
||||
ign.veins={}
|
||||
|
||||
rocksl.register_vein(ign.veins,"default:nyancat",{
|
||||
wherein="rocks:granite",
|
||||
miny=-160, maxy=20,
|
||||
radius={ average=10, amplitude=4, frequency=8 },
|
||||
density=1,
|
||||
rarity=0.025, -- this^3*mapblock_volume veins per mapblock
|
||||
})
|
||||
|
||||
-- { primary="rocks:pegmatite_diamond", size=3, count=5,
|
||||
-- rarity=0.3 -- (this/count) chance of spawning cluster in the vein
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
rocksl.layergen(ign,minp,maxp,seed)
|
||||
rocksl.veingen(ign.veins,minp,maxp,seed)
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
if (ign.stats.count==0) then rocksl.print("[rocks](ign) stats not available, no chunks generated") return end
|
||||
rocksl.print("[rocks](ign) generated total "..ign.stats.count.." chunks in "..ign.stats.total.." seconds ("..(ign.stats.total/ign.stats.count).." seconds per "..ign.stats.side.."^3 chunk)")
|
||||
for name,total in pairs(ign.stats.node) do
|
||||
rocksl.print("[rocks](ign) "..name..": "..total.." nodes placed ("..(total*100)/(ign.stats.totalnodes).." %)")
|
||||
end
|
||||
end)
|
||||
|
||||
-- ~ Tomas Brod
|
27
init.lua
Normal file
@ -0,0 +1,27 @@
|
||||
minetest.log("info","[rocks] mod initializing")
|
||||
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
rocks={}
|
||||
rocksl={}
|
||||
|
||||
rocksl.print=function(text)
|
||||
print("[rocks] "..text)
|
||||
end
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/mapgen.lua")
|
||||
dofile(modpath.."/sed.lua")
|
||||
dofile(modpath.."/ign.lua")
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
-- todo: disable caves and ores
|
||||
end)
|
BIN
layers0.png
Normal file
After Width: | Height: | Size: 674 KiB |
181
mapgen.lua
Normal file
@ -0,0 +1,181 @@
|
||||
--
|
||||
-- layer generator
|
||||
--
|
||||
|
||||
local print2=function(text)
|
||||
minetest.log("verbose","rocks/gen/ "..text)
|
||||
end
|
||||
|
||||
rocksl.seedseq=0
|
||||
rocksl.GetNextSeed=function()
|
||||
rocksl.seedseq=rocksl.seedseq+20
|
||||
print2("seed "..rocksl.seedseq)
|
||||
return rocksl.seedseq
|
||||
end
|
||||
|
||||
rocksl.register_stratus=function(layer,name,param)
|
||||
table.insert(layer.localized,{
|
||||
primary=name,
|
||||
spread=(param.spread or 20),
|
||||
height=(param.height or 15),
|
||||
treshold=(param.treshold or 0.85),
|
||||
secondary=param.secondary,
|
||||
seed=(rocksl.GetNextSeed()),
|
||||
})
|
||||
layer.stats.node[name]=0
|
||||
end
|
||||
|
||||
rocksl.register_vein=function(col,name,param)
|
||||
table.insert(col,{
|
||||
primary=name,
|
||||
wherein=param.wherein,
|
||||
miny=param.miny, maxy=param.maxy,
|
||||
radius={ average=param.radius.average, amplitude=param.radius.amplitude, frequency=param.radius.frequency },
|
||||
density=(param.density or 1),
|
||||
rarity=param.rarity,
|
||||
localized={}
|
||||
})
|
||||
end
|
||||
|
||||
rocksl.layergen=function(layer, minp, maxp, seed)
|
||||
if ( (layer.top.offset+layer.top.scale)>minp.y )
|
||||
and ( (layer.bot.offset-layer.bot.scale)<maxp.y )
|
||||
then
|
||||
stone_ctx= minetest.get_content_id("default:stone")
|
||||
air_ctx= minetest.get_content_id("air")
|
||||
dirt_ctx= minetest.get_content_id("default:dirt")
|
||||
if layer.debugging then
|
||||
layer.primary.ctx= air_ctx
|
||||
else
|
||||
layer.primary.ctx= minetest.get_content_id(layer.primary.name)
|
||||
end
|
||||
local timebefore=os.clock();
|
||||
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local nodes = manipulator:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local side_length = (maxp.x - minp.x) + 1
|
||||
local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}
|
||||
-- noises:
|
||||
local bottom=minetest.get_perlin_map(layer.bot,map_lengths_xyz):get2dMap_flat({x=minp.x, y=minp.z})
|
||||
local localized={}
|
||||
for _,loc in ipairs(layer.localized) do
|
||||
--defaults and overrides
|
||||
local np={ offset = 0, scale = 1, octaves = 1, persist = 0.7,
|
||||
spread = {x=loc.spread, y=loc.height, z=loc.spread}, seed=loc.seed}
|
||||
--get noise and content ids
|
||||
table.insert(localized,
|
||||
{
|
||||
noise=minetest.get_perlin_map(np,map_lengths_xyz):get3dMap_flat(minp),
|
||||
treshold=loc.treshold,
|
||||
ctx= minetest.get_content_id(loc.primary),
|
||||
ndn=loc.primary
|
||||
})
|
||||
end
|
||||
local noise2d_ix = 1
|
||||
local noise3d_ix = 1
|
||||
print2("after noise: "..(os.clock()-timebefore))
|
||||
for z=minp.z,maxp.z,1 do
|
||||
for y=minp.y,maxp.y,1 do
|
||||
for x=minp.x,maxp.x,1 do
|
||||
local pos = area:index(x, y, z)
|
||||
if (y>bottom[noise2d_ix]) and (y<layer.top.offset)
|
||||
and ( (nodes[pos]==stone_ctx) or (nodes[pos]==dirt_ctx) )
|
||||
then
|
||||
layer.stats.totalnodes=layer.stats.totalnodes+1
|
||||
if nodes[pos]==stone_ctx then nodes[pos] = layer.primary.ctx end
|
||||
for k,loc in pairs(localized) do
|
||||
if ( loc.noise[noise3d_ix] > loc.treshold) then
|
||||
nodes[pos]=loc.ctx
|
||||
layer.stats.node[loc.ndn]=layer.stats.node[loc.ndn]+1
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
noise2d_ix=noise2d_ix+1
|
||||
noise3d_ix=noise3d_ix+1
|
||||
end
|
||||
noise2d_ix=noise2d_ix-side_length
|
||||
end
|
||||
noise2d_ix=noise2d_ix+side_length
|
||||
end
|
||||
print2("after loop: "..(os.clock()-timebefore))
|
||||
manipulator:set_data(nodes)
|
||||
--manipulator:calc_lighting()
|
||||
--manipulator:update_liquids()
|
||||
if layer.debugging then
|
||||
manipulator:set_lighting({day=15,night=15})
|
||||
end
|
||||
manipulator:write_to_map()
|
||||
print2("after commit: "..(os.clock()-timebefore))
|
||||
layer.stats.count=layer.stats.count+1
|
||||
layer.stats.total=layer.stats.total+(os.clock()-timebefore)
|
||||
layer.stats.side=side_length
|
||||
end
|
||||
end
|
||||
|
||||
local ignore_wherein=1
|
||||
|
||||
rocksl.veingen=function(veins,minp,maxp,seed)
|
||||
local side_length=(maxp.y-minp.y)
|
||||
local random=PseudoRandom(seed-79)
|
||||
local timebefore=os.clock();
|
||||
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local nodes = manipulator:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local did_generate=nil
|
||||
for _,vein in ipairs(veins) do
|
||||
if (minp.y<vein.maxy) and (maxp.y>vein.maxy) then
|
||||
local vr2=vein.radius.average^2
|
||||
local vrm=vein.radius.average+vein.radius.amplitude
|
||||
local noise_map=minetest.get_perlin_map(
|
||||
{
|
||||
seed=-79,
|
||||
scale=vein.radius.amplitude,
|
||||
offset=0, octaves=1, persist=0.7,
|
||||
spread={x=vein.radius.frequency, y=vein.radius.frequency, z=vein.radius.frequency}
|
||||
},{x=(vrm*2)+1, y=(vrm*2)+1, z=(vrm*2)+1}
|
||||
)
|
||||
local iterations_count= (vein.rarity*side_length)^3
|
||||
iterations_count=iterations_count+(random:next(0,100)/100)
|
||||
local primary_ctx=minetest.get_content_id(vein.primary)
|
||||
local wherein_ctx=minetest.get_content_id(vein.wherein)
|
||||
--print("vein "..vein.primary.." ic="..iterations_count.." p="..primary_ctx.." w="..wherein_ctx)
|
||||
for iteration=1, iterations_count do
|
||||
local x0=minp.x+ random:next(0,side_length)
|
||||
local y0=minp.y+ random:next(0,side_length)
|
||||
local z0=minp.z+ random:next(0,side_length)
|
||||
local noise=noise_map:get3dMap_flat({x=x0-vrm, y=y0-vrm, z=z0-vrm})
|
||||
local noise_ix=1
|
||||
local posi = area:index(x0, y0, z0)
|
||||
if ignore_wherein or (nodes[posi]==wherein_ctx) then
|
||||
--print("vein "..vein.primary.." @ "..x0..","..y0..","..z0.." vrm="..vrm)
|
||||
did_generate=1
|
||||
for x=-vrm, vrm do
|
||||
for y=-vrm, vrm do
|
||||
for z=-vrm, vrm do
|
||||
local posc = {x=x+x0,y=y+y0,z=z+z0}
|
||||
posi = area:index(posc.x, posc.y, posc.z)
|
||||
local nv=noise[noise_ix]
|
||||
if ((x^2)+(y^2)+(z^2))<((vein.radius.average+nv)^2) then
|
||||
--minetest.set_node(posc, {name=vein.primary})
|
||||
nodes[posi]=primary_ctx
|
||||
end
|
||||
noise_ix=noise_ix+1
|
||||
end end end
|
||||
else
|
||||
--print("vein "..vein.primary.." bad environmnent -"..minetest.get_node({x0,y0,z0}).name.."="..nodes[posi])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if did_generate then
|
||||
manipulator:set_data(nodes)
|
||||
--manipulator:calc_lighting()
|
||||
manipulator:write_to_map()
|
||||
print("end veingen "..(os.clock()-timebefore))
|
||||
else
|
||||
print("end veingen (nothin generated)")
|
||||
end
|
||||
end
|
||||
|
||||
-- ~ Tomas Brod
|
@ -1,38 +0,0 @@
|
||||
--
|
||||
-- The minerals mod.
|
||||
--
|
||||
|
||||
minetest.log("info","/mineral mod initializing")
|
||||
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local function GetNoiseParams()
|
||||
return {
|
||||
scale=1, offset=0, seed=rocksl.GetNextSeed(), octaves=1, persist=1,
|
||||
spread={ x=100, y=100, z=100 } }
|
||||
end
|
||||
|
||||
mineral={}
|
||||
mineral.noise={}
|
||||
|
||||
local print=function(text)
|
||||
minetest.log("info","/mineral "..text)
|
||||
end
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
mineral.noise.Copper=GetNoiseParams()
|
||||
mineral.noise.PbZn=GetNoiseParams()
|
||||
mineral.noise.Iron=GetNoiseParams()
|
||||
mineral.noise.Tin=GetNoiseParams()
|
||||
|
||||
dofile(modpath.."/skarn.lua")
|
||||
dofile(modpath.."/pegmatite.lua")
|
||||
|
@ -1,42 +0,0 @@
|
||||
--
|
||||
-- Pegmatite deposit
|
||||
--
|
||||
|
||||
local function GetNoiseParams()
|
||||
return {
|
||||
scale=1, offset=0, seed=rocksl.GetNextSeed(), octaves=1, persist=1,
|
||||
spread={ x=100, y=100, z=100 } }
|
||||
end
|
||||
|
||||
-- ores have to be redefined for pegmatite background
|
||||
|
||||
-- Ore/Mineral Percent
|
||||
-- Spodumene 7%
|
||||
-- Muscovite (mica) 7%
|
||||
-- Kyanite 5%
|
||||
-- Lepidolite 2.5%
|
||||
-- Tantalite 2%
|
||||
-- Cassiterite 1.5%
|
||||
-- Wolframite 1%
|
||||
-- Pollucite 0.1%
|
||||
|
||||
|
||||
-- Cassiterite
|
||||
minetest.register_node( "mineral:pegmatite_cassiterite", {
|
||||
description = S("Cassiterite"),
|
||||
tiles = { "rocks_Pegmatite.png^mineral_cassiterite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
wherein="rocks:pegmatite",
|
||||
ore="mineral:pegmatite_cassiterite",
|
||||
clust_size=3,
|
||||
clust_num_ores=9,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=-0.1,
|
||||
noise_params=mineral.noise.Tin
|
||||
})
|
||||
|
||||
-- ~ Tomas Brod
|
@ -1,123 +0,0 @@
|
||||
--
|
||||
-- Skarn deposit
|
||||
--
|
||||
|
||||
-- ores have to be redefined for skarn background
|
||||
|
||||
-- Chalcopyrite
|
||||
minetest.register_node( "mineral:skarn_chalcopyrite", {
|
||||
description = S("Chalcopyrite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Chalcopyrite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Malachyte
|
||||
minetest.register_node( "mineral:skarn_malachyte", {
|
||||
description = S("Malachyte"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Chalcopyrite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Chalcopyrite/Malachyte skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_chalcopyrite",
|
||||
clust_size=3,
|
||||
clust_num_ores=12,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.333,
|
||||
noise_params=mineral.noise.Copper
|
||||
})
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_malachyte",
|
||||
clust_size=3,
|
||||
clust_num_ores=11,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.333,
|
||||
noise_params=mineral.noise.Copper
|
||||
})
|
||||
|
||||
-- Sphalerite
|
||||
minetest.register_node( "mineral:skarn_sphalerite", {
|
||||
description = S("Sphalerite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_sphalerite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Galena
|
||||
minetest.register_node( "mineral:skarn_galena", {
|
||||
description = S("Galena"),
|
||||
tiles = { "rocks_Skarn.png^mineral_galena.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Pb Zn skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_sphalerite",
|
||||
clust_size=3,
|
||||
clust_num_ores=9,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.38,
|
||||
noise_params=mineral.noise.PbZn
|
||||
})
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_galena",
|
||||
clust_size=3,
|
||||
clust_num_ores=10,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.38,
|
||||
noise_params=mineral.noise.PbZn
|
||||
})
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_galena", percent=25 },
|
||||
-- { ore="rocks:skarn_sphalerite", percent=25 },
|
||||
|
||||
-- Magnetite
|
||||
minetest.register_node( "mineral:skarn_magnetite", {
|
||||
description = S("Magnetite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Magnetite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Fe skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_magnetite",
|
||||
clust_size=3,
|
||||
clust_num_ores=13,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.3,
|
||||
noise_params=mineral.noise.Iron
|
||||
})
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_magnetite", percent=40 },
|
||||
|
||||
-- Magnesite
|
||||
minetest.register_node( "mineral:skarn_magnesite", {
|
||||
description = S("Magnesite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Magnesite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Vermiculite (fixme: move to CommonRocks)
|
||||
minetest.register_node( "mineral:vermiculite", {
|
||||
description = S("Vermiculite"),
|
||||
tiles = { "mineral_Vermiculite.png" },
|
||||
groups = {crumbly=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- magnesite/vermiculite skarn mix
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_magnesite", percent=30 },
|
||||
-- { ore="rocks:vermiculite", percent=20 },
|
||||
|
||||
-- ~ Tomas Brod
|
Before Width: | Height: | Size: 870 B |
Before Width: | Height: | Size: 774 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
@ -1 +0,0 @@
|
||||
# This is now a modpack, for you to ask why :)
|
@ -1,61 +0,0 @@
|
||||
local np_elv = {
|
||||
offset = -4, octaves = 2, persist = 0.4,
|
||||
scale = 28,
|
||||
spread = {x=25, y=25, z=25},
|
||||
seed = -546,
|
||||
}
|
||||
local np_fault = {
|
||||
offset = -5, octaves = 2, persist = 0.4,
|
||||
scale = 10,
|
||||
spread = {x=25, y=25, z=25},
|
||||
seed = 632,
|
||||
}
|
||||
|
||||
rocksl.genlayers = function (minp, maxp, seed, vm, area)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksize = maxp.x - minp.x + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
local c_stone= minetest.get_content_id("default:stone")
|
||||
local c_sample=minetest.get_content_id("rocks:samplelayerblock")
|
||||
local c_air=minetest.get_content_id("air")
|
||||
|
||||
n_elv= minetest.get_perlin_map(np_elv, pmapsize) : get2dMap_flat(minpxz)
|
||||
n_fault= minetest.get_perlin_map(np_fault, pmapsize) : get2dMap_flat(minpxz)
|
||||
|
||||
local nixz=1
|
||||
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
|
||||
|
||||
local fault=n_fault[nixz]
|
||||
local lmh=-10
|
||||
if fault>0 then lmh=lmh+10 end
|
||||
local lt=math.floor(n_elv[nixz])
|
||||
if lt>0 then
|
||||
if lt>18 then lt=18 end
|
||||
local top=math.min(lmh,maxp.y)
|
||||
local bot=math.max(1+lmh-lt,minp.y)
|
||||
for y=bot, top do
|
||||
local di=area:index(x,y,z)
|
||||
data[di]=c_sample
|
||||
end
|
||||
end
|
||||
|
||||
nixz=nixz+1
|
||||
if z%100>50 then
|
||||
for y=minp.y, maxp.y do data[area:index(x,y,z)]=c_air end
|
||||
end
|
||||
|
||||
end end
|
||||
vm:set_data(data)
|
||||
vm:set_lighting({day=15,night=15})
|
||||
minetest.log("action", "rocks/genlayers/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
||||
|
||||
minetest.register_node( "rocks:samplelayerblock", {
|
||||
description = S("Sample"),
|
||||
tiles = { "rocks_Slate.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=3},
|
||||
})
|
Before Width: | Height: | Size: 893 B |
Before Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 799 B |
Before Width: | Height: | Size: 1020 B |
Before Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 332 B |
@ -1,54 +0,0 @@
|
||||
-- experimental fast vein generator
|
||||
|
||||
rocks.veins={}
|
||||
|
||||
table.insert(rocks.veins,{
|
||||
scarcity=80,
|
||||
|
||||
})
|
||||
|
||||
|
||||
rocksl.genvein=function(minp,maxp,pr,vm,area)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksizer = maxp.x - minp.x + 1
|
||||
local chunksize = chunksizer + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
local c_sample=minetest.get_content_id("default:stone")
|
||||
local c_sample_ore=minetest.get_content_id("default:mese")
|
||||
|
||||
|
||||
local A=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local B=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local C=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local D=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local l1=vector.distance(A,C)+vector.distance(C,B)
|
||||
local l2=vector.distance(A,D)+vector.distance(D,B)
|
||||
local step=1.4/math.max(l1,l2)
|
||||
print("step="..step.." l1="..l1.." l2="..l2)
|
||||
local scarcity=6
|
||||
local ocn=pr:next(0,scarcity)+(scarcity/2)
|
||||
for t=0, 1, step do
|
||||
local P=vector.multiply(A,(1-t)^2)
|
||||
P=vector.add(P, vector.multiply(B,t*t) )
|
||||
local Q=vector.add(P, vector.multiply(D,2*t*(1-t)) )
|
||||
P=vector.add(P, vector.multiply(C,2*t*(1-t)) )
|
||||
local step2=1/vector.distance(P,Q)
|
||||
for u=0, 1, step2 do
|
||||
local R=vector.add(vector.multiply(P,(1-u)), vector.multiply(Q,u) )
|
||||
local di=area:indexp(vector.round(R))
|
||||
if ocn<1 then
|
||||
data[di]=c_sample_ore
|
||||
ocn=pr:next(0,scarcity)+(scarcity/2)
|
||||
else
|
||||
data[di]=c_sample
|
||||
ocn=ocn-1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
minetest.log("action", "rocks/genvein/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
68
sed.lua
Normal file
@ -0,0 +1,68 @@
|
||||
--
|
||||
-- Sedimentary Layer
|
||||
--
|
||||
|
||||
local sed={
|
||||
top={
|
||||
offset = 20, scale = 0,
|
||||
spread = {x=80, y=80, z=80},
|
||||
octaves = 0, persist = 0 },
|
||||
bot={
|
||||
offset = -16, scale = 10, seed=rocksl.GetNextSeed(),
|
||||
spread = {x=80, y=80, z=80},
|
||||
octaves = 2, persist = 0.7 },
|
||||
primary={ name="rocks:mudstone" },
|
||||
localized={},
|
||||
stats={ count=0, total=0, node={}, totalnodes=0 },
|
||||
debugging=nil
|
||||
}
|
||||
|
||||
-- Mudstone Sed soft Ocean, beach, river, glaciers
|
||||
minetest.register_node( "rocks:mudstone", {
|
||||
description = S("Mudstone"),
|
||||
tiles = { "rocks_Mudstone.png" },
|
||||
groups = {cracky=1, crumbly=3},
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
-- more rock defs
|
||||
minetest.register_node( "rocks:limestone", {
|
||||
description = S("Limestone"),
|
||||
tiles = { "rocks_Limestone.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=2},
|
||||
})
|
||||
|
||||
|
||||
local reg=function(name,param)
|
||||
rocksl.register_stratus(sed,name,param)
|
||||
end
|
||||
|
||||
rocks.register_sedimentary=reg
|
||||
|
||||
-- Sedimentary rock hardness and distribution
|
||||
-- Rock Hard Distribution
|
||||
--Breccia Weak Localized continental, folded
|
||||
-->Claystone Weak Localized continental, folded, oceanic
|
||||
--Conglomerate Weak Localized continental, folded
|
||||
-->Limestone Medium Localized continental, folded; primary oceanic, hills
|
||||
-->Coal - Large beds, twice as common in swamps
|
||||
reg("rocks:limestone", { spread=64, height=32, treshold=0.36 })
|
||||
--reg("rocks:breccia", { spread=64, height=32, treshold=0.6 })
|
||||
--reg("rocks:conglomerate", { spread=64, height=32, treshold=0.6 })
|
||||
reg("default:stone_with_coal", { spread=48, height=14, treshold=0.40 })
|
||||
reg("default:clay",{ spread=48, height=14, treshold=0.50 })
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
rocksl.layergen(sed,minp,maxp,seed)
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
if (sed.stats.count==0) then rocksl.print("[rocks](sed) stats not available, no chunks generated") return end
|
||||
rocksl.print("[rocks](sed) generated total "..sed.stats.count.." chunks in "..sed.stats.total.." seconds ("..(sed.stats.total/sed.stats.count).." seconds per "..sed.stats.side.."^3 chunk)")
|
||||
for name,total in pairs(sed.stats.node) do
|
||||
rocksl.print("[rocks](sed) "..name..": "..total.." nodes placed ("..(total*100)/(sed.stats.totalnodes).." %)")
|
||||
end
|
||||
end)
|
||||
|
||||
-- ~ Tomas Brod
|
@ -11,9 +11,3 @@ rocks_Peridotite.png
|
||||
rocks_Rhyolite.png
|
||||
rocks_Schist.png
|
||||
rocks_Slate.png
|
||||
rocks_Skarn.png
|
||||
rocks_laterite.png
|
||||
rocks_claystone.png
|
||||
rocks_conglomerate.png
|
||||
rocks_anthracite.png
|
||||
rocks_lignite.png
|
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 941 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 612 B |
Before Width: | Height: | Size: 992 B After Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 1022 B After Width: | Height: | Size: 1022 B |
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 910 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 794 B After Width: | Height: | Size: 794 B |
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 937 B |
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 914 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |