Added biosediments: limestone, coal, lignite, anthracite. And placeholders.

This commit is contained in:
Tomáš Brada 2015-05-03 10:53:50 +02:00
parent 7a5d600e0c
commit 59737a0652
2 changed files with 59 additions and 27 deletions

2
a.txt
View File

@ -75,7 +75,7 @@ Noise3(220)= miera spevnenia, kvalita
štrk gravel(20%) -> zlepenec conglomerate
piesok sand(10%) -> pieskovec sandstone
? -> prachovec
mudstone
íl clay -> ílovec claystone(40%) -> bridlica slate(50%)
### Bio-vce

View File

@ -3,7 +3,7 @@
local np_typ1 = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=70, y=70, z=70},
spread = {x=50, y=50, z=50},
seed = -5500,
}
local np_typ2 = {
@ -21,22 +21,12 @@ local np_vc = {
local np_sp = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=100, y=100, z=100},
spread = {x=150, y=150, z=150},
seed = -1284,
}
local stats={
dirt=0,
gravel=0,
sand=0,
sandstone=0,
clay=0,
claystone=0,
slate=0,
conglomerate=0,
mudstone=0,
total=0
}
local stats
stats={ total=0 }
rocksl.gensed = function (minp, maxp, seed)
local t1 = os.clock()
@ -57,6 +47,7 @@ rocksl.gensed = function (minp, maxp, seed)
local n_sp= minetest.get_perlin_map(np_sp, pmapsize) : get2dMap_flat(pmapminpxz)
local layers = {
stone={ mod="default" },
dirt={ mod="default" },
gravel={ mod="default" },
sand={ mod="default" },
@ -66,32 +57,38 @@ rocksl.gensed = function (minp, maxp, seed)
slate={ mod="rocks" },
conglomerate={ mod="rocks" },
mudstone={ mod="rocks" },
limestone={ mod="rocks" },
blackcoal={ mod="rocks" },
lignite={ mod="rocks" },
anthracite={ mod="rocks" },
}
for k,v in pairs(layers) do
v.ctx=minetest.get_content_id(v.mod..":"..k)
if stats and (stats[k]==nil) then stats[k]=0 end
end
local nixz= 1
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
-- loop
local li
local vcv= math.abs(n_vc[nixz])
local vcva= math.abs(n_vc[nixz])
local vcv= n_vc[nixz]
local spv= n_sp[nixz]
local tp=1 --=particulates, 2=biosediments, 3=chemosediments, 4=vulcanosediments
if n_tp1[nixz]>0.5 then tp=2
if n_tp2[nixz]>0.7 then tp=4 end
elseif n_tp2[nixz]>0.7 then tp=3 end
if n_tp1[nixz]>0.2 then tp=2
if n_tp2[nixz]>0.81 then tp=4 end
elseif n_tp2[nixz]>0.76 then tp=3 end
if tp==1 then
-- particulates
if vcv>0.46 then
if vcva>0.44 then
-- clay-(0,stone,slate)
if spv>0.28 then li="slate"
elseif spv>-0.31 then li="claystone"
if spv>0.23 then li="slate"
elseif spv>-0.21 then li="claystone"
else li="clay" end
elseif spv>0.4 then
elseif vcva>0.4 then
li="mudstone"
elseif vcv>0.2 then
elseif vcva>0.2 then
-- sand-(0,stone)
if spv>-0.3 then li="sandstone" else li="sand" end
else
@ -99,14 +96,30 @@ rocksl.gensed = function (minp, maxp, seed)
if spv>-0.34 then li="conglomerate" else li="gravel" end
-- breccia?
end
elseif tp==2 then
-- biosediments
if vcv>0.81 then
--ropa
li="stone"
elseif vcv>-0.12 then
li="limestone"
elseif vcv>-0.42 then
--ine
li="stone"
else
--uhlia
if spv>0.7 then li="anthracite"
elseif spv>0 then li="blackcoal"
else li="lignite" end
end
end
if not li then li="dirt" end
for y=minp.y, maxp.y do
local di=area:index(x,y,z)
if ((data[di]==c_stone) or (data[di]==c_dwg)) and li then
data[di]=layers[li].ctx
--stats.total=stats.total+1
--stats[li]=stats[li]+1
if stats then stats.total=stats.total+1 stats[li]=stats[li]+1 end
end
end
nixz= nixz+1
@ -114,7 +127,7 @@ rocksl.gensed = function (minp, maxp, seed)
vm:set_data(data)
minetest.log("action", "rocks/gensed/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
vm:write_to_map(data)
--for k,v in pairs(stats) do print("stat: "..k..": "..((v/stats.total)*100).."%") end
if stats then for k,v in pairs(stats) do print("stat: "..k..": "..((v/stats.total)*100).."%") end end
end
minetest.register_node( "rocks:slate", {
@ -136,3 +149,22 @@ minetest.register_node( "rocks:conglomerate", {
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
groups = {crumbly=3},
})
minetest.register_node( "rocks:lignite", {
description = S("Lignite coal"),
tiles = { "rocks_Mudstone.png^rocks_lignite.png" },
is_ground_content = true,
groups = {crumbly=3},
})
minetest.register_node( "rocks:blackcoal", {
description = S("Black coal"),
tiles = { "rocks_Mudstone.png^default_mineral_coal.png" },
is_ground_content = true,
groups = {crumbly=3},
})
minetest.register_node( "rocks:anthracite", {
description = S("Anthracite coal"),
tiles = { "rocks_Mudstone.png^rocks_anthracite.png" },
is_ground_content = true,
groups = {crumbly=3},
})