1
0
mirror of git://repo.or.cz/rocks.git synced 2025-01-01 14:00:30 +01:00

Remove old.

This commit is contained in:
Tomáš Brada 2015-06-30 12:58:26 +02:00
parent f4ba640dcf
commit a9f2272127
5 changed files with 0 additions and 587 deletions

View File

@ -1,205 +0,0 @@
-- experimental sedimentary layer generator
local np_elv = {
offset = 0, octaves = 2, persist = 0.4,
scale = 8,
spread = {x=25, y=25, z=25},
seed = -546,
}
local np_typ1 = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=50, y=50, z=50},
seed = -5500,
}
local np_typ2 = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=70, y=70, z=70},
seed = -5472,
}
local np_vc = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=100, y=100, z=100},
seed = 749,
}
local np_sp = {
offset = 0, octaves = 2, persist = 0.33,
scale = 1,
spread = {x=150, y=150, z=150},
seed = -1284,
}
local stats
stats={ total=0 }
rocksl.gensed = 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_dwg= c_stone
local sla = {
{min=18, sd=169},
{min=9, sd=324},
{min=0, sd=-230},
{min=-6, sd=850},
{min=-12, sd=-643},
{min=-18, sd=0},
}
if minp.y<(sla[#sla].min-10) then return end
local biomes = {
lava={ mod="default" },
nyancat={ mod="default" },
wood={ mod="default" },
gravel={ mod="default" },
sand={ mod="default" },
sandstone={ mod="default" },
clay={ mod="default" },
claystone={ mod="rocks" },
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(biomes) do
v.ctx=v.ctx or minetest.get_content_id(v.mod..":"..k)
if stats and (stats[k]==nil) then stats[k]=0 end
end
n_elv= minetest.get_perlin_map(np_elv, pmapsize) : get2dMap_flat(minp)
local generated
local nixz= 0
local nixyz= 0
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
nixz= nixz+1
-- loop
local bi
local li
for y=maxp.y, minp.y, -1 do
nixyz=nixyz+1
local di=area:index(x,y,z)
local yn=y +n_elv[nixz]
if (data[di]==c_stone) and ((not bi)or(yn<sla[li].min)) then
-- go to deeper layer
if not li then li=1 end
while (li<=#sla)and(sla[li].min>yn) do
li=li+1
end
-- create noises for this layer
if li>#sla then break end -- break y loop if too low
if (not sla[li].n_tp1) then
local altminpxz={ x=minp.x+sla[li].sd,
y=minp.z-sla[li].sd}
sla[li].n_tp1= minetest.get_perlin_map(np_typ1, pmapsize) : get2dMap_flat(altminpxz)
sla[li].n_tp2= minetest.get_perlin_map(np_typ2, pmapsize) : get2dMap_flat(altminpxz)
sla[li].n_vc= minetest.get_perlin_map(np_vc, pmapsize) : get2dMap_flat(altminpxz)
sla[li].n_sp= minetest.get_perlin_map(np_sp, pmapsize) : get2dMap_flat(altminpxz)
end
-- BEGIN geome resolution
local vcva= math.abs(sla[li].n_vc[nixz])
local vcv= sla[li].n_vc[nixz]
local spv= sla[li].n_sp[nixz]
local tp=1 --=particulates, 2=biosediments, 3=chemosediments, 4=vulcanosediments
if sla[li].n_tp1[nixz]>0.2 then tp=2
if sla[li].n_tp2[nixz]>0.81 then tp=4 end
elseif sla[li].n_tp2[nixz]>0.76 then tp=3 end
if tp==1 then
-- particulates
if vcva>0.453 then
-- clay-(0,stone,slate)
if spv>0.23 then bi="slate"
elseif spv>-0.2 then bi="claystone"
else bi="clay" end
elseif vcva>0.4 then
bi="mudstone"
elseif vcva>0.2 then
-- sand-(0,stone)
if spv>-0.3 then bi="sandstone" else bi="sand" end
else
-- gravel/conglomerate
if spv>-0.34 then bi="conglomerate" else bi="gravel" end
-- breccia?
end
elseif tp==2 then
-- biosediments
if vcv>0.05 then
bi="limestone"
elseif vcv>-0.1 then
--uhlia
if spv>0.7 then bi="anthracite"
elseif spv>0 then bi="blackcoal"
else bi="lignite" end
else
--ine
bi="wood"
end
end
-- END geome resolution
if not bi then bi="nyancat" end
generated=true
end
if (data[di]==c_stone) then
data[di]=biomes[bi].ctx
if stats then stats.total=stats.total+1 stats[bi]=stats[bi]+1 end
end
end
end end
if generated then
vm:set_data(data)
if stats then for k,v in pairs(stats) do print("stat: "..k..": "..((v/stats.total)*100).."%") end end
else
print("no sed layer y="..minp.y)
end
minetest.log("action", "rocks/gensed/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
end
minetest.register_node( "rocks:slate", {
description = S("Slate"),
tiles = { "rocks_Slate.png" },
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
groups = {cracky=3},
})
minetest.register_node( "rocks:claystone", {
description = S("Claystone"),
tiles = { "rocks_claystone.png" },
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
groups = {crumbly=1, cracky=3},
})
minetest.register_node( "rocks:conglomerate", {
description = S("Conglomerate"),
tiles = { "rocks_conglomerate.png" },
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},
})

View File

@ -1,143 +0,0 @@
--
-- Igneous Layer
--
-- 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(),
})
minetest.register_alias("mapgen_stone", "rocks:basalt")
-- ^ does not work. Seems we can not overwrite an alias.
-- If the alias in default/mapgen.lua is deleted, this works.
-- more rock defs
minetest.register_node( "rocks:granite", {
description = S("Granite"),
tiles = { "rocks_wgr.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)
minetest.register_ore({
ore = name,
wherein= param.inr,
ore_type = "scatter",
clust_scarcity = 10^3,
clust_num_ores = 20^3,
clust_size = 20,
height_min = -31000,
height_max = 28,
noise_threshhold=param.treshold,
noise_params={
offset = 0, scale = 1, octaves = 1, persist = 0.5,
spread = {x=param.spread, y=param.height, z=param.spread},
seed=rocksl.GetNextSeed(),
},
})
end
rocks.register_igneous_stratus=reg
-- vein stuff
local regv=function(name,param)
minetest.register_ore({
ore = name,
wherein= param.wherein,
ore_type = "blob",
clust_scarcity = param.rarity^3,
clust_num_ores = 8,
clust_size = param.radius.average*2,
height_min = -31000,
height_max = 50,
noise_threshhold = 0.5, --< determined experimentally
noise_params={
offset = 1-param.radius.amplitude, scale = param.radius.amplitude, octaves = 3, persist = 0.5,
spread = {x=param.radius.frequency, y=param.radius.frequency, z=param.radius.frequency},
seed=rocksl.GetNextSeed(),
},
})
end
rocks.register_vein=regv
local np_layer = {
offset = 0, octaves = 3, persist = 0.46,
scale = 30,
spread = {x=500, y=500, z=500},
seed = -5500,
}
local np_intr = {
octaves = 3, persist = 0.46,
scale = 20,
offset = -15,
spread = {x=100, y=100, z=100},
seed = 3740,
}
--minetest.register_on_generated( function( minp, maxp, seed )
rocksl.genign=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 = 1}
local pmapminpxz = {x = minp.x, y = minp.z}
local c_stone= minetest.get_content_id("default:stone")
local layers= {
{ min=-100, node="rocks:granite" },
{ min=-240, node="rocks:diorite"},
{ node="rocks:gabbro", min=-700},
}
for k,v in pairs(layers) do
v.ctx=minetest.get_content_id(v.node)
end
local layers_no=#layers
local n_layer= minetest.get_perlin_map(np_layer, pmapsize) : get2dMap_flat(pmapminpxz)
local n_intr= minetest.get_perlin_map(np_intr, pmapsize) : get2dMap_flat(pmapminpxz)
local nixz= 1
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
-- loop
for y=minp.y, maxp.y do
local di=area:index(x,y,z)
local yn=y+n_layer[nixz]
local vintr=n_intr[nixz]
if vintr<1 then vintr=1 end
if data[di]==c_stone then
yn=yn*vintr -- vertical intrusion
for li=1, layers_no do
if yn > layers[li].min then
data[di]=layers[li].ctx
break
end
end
end
end
nixz= nixz+1
end end
vm:set_data(data)
--DEBUG: vm:set_lighting({day=15,night=2})
minetest.generate_ores(vm)
minetest.log("action", "rocks/layer/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
end
-- ~ Tomas Brod

View File

@ -1,24 +0,0 @@
--
-- Pegmatite vein
--
local CommonRarity=45
minetest.register_node( "rocks:pegmatite", {
description = S("Pegmatite"),
tiles = { "rocks_Pegmatite.png" },
groups = {cracky=3, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
-- ores have to be redefined for pegmatite background
-- pegmatites are only 1 kind
rocks.register_vein("rocks:pegmatite",{
wherein={ "rocks:granite" },
miny=-160, maxy=20,
radius={ average=18, amplitude=0.3, frequency=16 },
density=80, rarity=CommonRarity,
ores={
}
})

View File

@ -1,185 +0,0 @@
--
-- Sedimentary Layer
--
-- 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},
})
minetest.register_node( "rocks:laterite", {
description = S("Laterite clay"),
tiles = { "rocks_laterite.png" },
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
groups = {crumbly=3},
})
local beach_max=4
local lowland_max=27
local highland_max=200
local beach_min=-7
local lowland_min=5
local highland_min=28
do
-- Modify default grassland biome
local grassland=minetest.registered_biomes["default:grassland"] or
{ -- default biome, if no biome mod is installed
name = "rocks:grassland",
node_top = "air",
depth_top = 0,
depth_filler=0,
y_min = lowland_min,
y_max = lowland_max,
heat_point = 50,
humidity_point = 50,
}
local mountains={ -- default mountain biome
name = "rocks:mountain",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
node_stone = nil,
y_min = highland_min,
y_max = highland_max,
heat_point = 50,
humidity_point = 50,
}
-- The biome layers are: dust, top, filler, stone
-- On beach: dust, shore_top, shore_filler, underwater
-- coastside: dust, top, filler, shore_filler, underwater, stone
if #minetest.registered_biomes > 1 then
minetest.log("error","Biomes registered before [rocks] discarded, please depend the mod on 'rocks' to fix this.")
-- can't just re-register them here, cause clear_biomes also clears decorations
end
minetest.clear_registered_biomes()
-- hook to inject our sedimentary stone to new biomes
local old_register_biome=minetest.register_biome
minetest.register_biome=function(def)
--print("[rocks] register_biome .name="..def.name)
for n,v in pairs(def) do
--if type(v)~="table" then print(" "..n.."="..v) end
end
local cor=false -- was the biomeheight patched?
local tl=3 -- tolerance in determining biome type based on y_min/max values
local btype -- biome type (:string)
if (def.y_max>3000) and (def.y_min<=highland_min) then
-- correct upper boundary of registered bimes
if (def.y_min<10) and (def.y_min>0) then def.y_max=lowland_max cor=true end
if (def.y_min<30) and (def.y_min>10) then def.y_max=highland_max cor=true end
minetest.log("action","/rocks correcting upper bound on biome "..def.name.." to "..def.y_max)
end
-- actual detection code
if def.node_stone=="default:desert_stone" then btype="desert"
elseif (def.y_min>beach_min-tl) and (def.y_max<beach_max+tl) then btype="beach"
elseif (def.y_min>0) and (def.y_max<lowland_max+tl) then btype="lowland"
elseif (def.y_min>highland_min-tl) and (def.y_max<highland_max+tl) then btype="highland"
elseif (def.y_min<-3000) and (def.y_max<lowland_min+tl) then btype="ocean"
else minetest.log("error", "/rocks could not guess elevation type for biome "..def.name) end
rocksl.print("register_biome .name="..def.name.." -> btype="..btype)
-- patch the new biomes with our rocks
if btype=="lowland" then
--def.node_filler="rocks:mudstone"
--def.depth_filler=11
--def.node_stone="rocks:granite"
if (def.humidity_point>80) and (def.heat_point>80) then
--def.node_filler="rocks:laterite"
end
elseif btype=="highland" then
def.node_filler="rocks:limestone"
def.node_stone="rocks:limestone"
def.depth_filler=15
elseif btype=="beach" then
def.node_stone="rocks:granite"
def.y_min=beach_min
if def.heat_point<50 then
def.node_top="default:gravel"
def.node_filler="default:gravel"
def.depth_filler=2
elseif def.node_top=="default:sand" then
if def.depth_top<2 then def.depth_top=3 end
def.node_filler="default:sandstone"
def.depth_filler=5
end
elseif btype=="ocean" then
def.node_stone="rocks:basalt"
def.node_top="default:gravel"
def.node_filler="rocks:limestone"
end
do -- deactivate the added and removed shore-thing of MGv7
-- to fix weirid sand layers underground
def.node_shore_top=def.node_top
def.node_shore_filler=def.node_filler
def.node_underwater=def.node_top
end
-- and call the saved method to actually do the registration
old_register_biome(def)
end
--now register the default grassland
minetest.register_biome(grassland)
-- create a default mountain biome...
minetest.register_biome(mountains)
-- hook the clear callback (fix biomesdev)
local old_clear=minetest.clear_registered_biomes
minetest.clear_registered_biomes=function()
old_clear()
minetest.log("action","/rocks re-registering default mountain biome!")
minetest.register_biome(mountains)
end
end
-- more biomes
-- todo: mountains, alps, volcanos
local reg=function(name,param)
minetest.register_ore({
ore=name,
wherein= {
"rocks:mudstone",
},
ore_type = "scatter",
clust_scarcity = 8^3,
clust_size = 10,
clust_num_ores = 10^3,
y_min = -20,
y_max = 40,
noise_threshhold = param.treshold,
noise_params = {
offset=0, scale=1, octaves=1, persist=0.3,
spread={x=param.spread, y=param.height, z=param.spread},
seed=rocksl.GetNextSeed(),
},
})
end
-- this does register a new sedimentary vein.
rocks.register_sedimentary=reg
-- follows the only thing remaining from old ver :)
-- 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.35 })
--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=64, height=14, treshold=0.58 })
--reg("default:clay",{ spread=48, height=14, treshold=0.55 })
-- ~ Tomas Brod

View File

@ -1,30 +0,0 @@
--
-- Skarn deposit
--
local CommonRarity=40 --too high... should be like 76
local CommonRadius=10
local CommonWherein={ "rocks:granite", "rocks:limestone" }
minetest.register_node( "rocks:skarn", {
description = S("Skarn"),
tiles = { "rocks_Skarn.png" },
groups = {cracky=3, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
-- skarn deposit
rocks.register_vein("rocks:skarn",{
wherein=CommonWherein,
miny=-320, maxy=300,
radius={ average=CommonRadius, amplitude=0.16, frequency=8 },
density=80, rarity=CommonRarity,
})
-- Todo:
-- There is also a chance of isolated lapis crystals, Gold
-- Molybdenite with Cu
-- wollastonite with Fe
-- enrichments: scheelite and wollastonite
-- ~ Tomas Brod