mirror of
git://repo.or.cz/rocks.git
synced 2025-01-01 14:00:30 +01:00
Renamed mapgen strata register func, added reg for veins, disabled debug.
This commit is contained in:
parent
4d7d8cd80d
commit
c1cf871d2c
32
ign.lua
32
ign.lua
@ -46,9 +46,9 @@ minetest.register_node( "rocks:gabbro", {
|
||||
})
|
||||
|
||||
local reg=function(name,param)
|
||||
rocksl.register_blob(ign,name,param)
|
||||
rocksl.register_stratus(ign,name,param)
|
||||
end
|
||||
rocks.register_igneous=reg
|
||||
rocks.register_igneous_stratus=reg
|
||||
|
||||
-- rock registration
|
||||
reg("rocks:granite", { spread=40, height=32, treshold=0.06})
|
||||
@ -56,24 +56,22 @@ rocks.register_igneous=reg
|
||||
reg("rocks:gabbro", { spread=40, height=32, treshold=0.36})
|
||||
|
||||
-- vein stuff
|
||||
local sample_vein_col={
|
||||
{ primary="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
|
||||
localized={
|
||||
{ primary="rocks:pegmatite_diamond", size=3, count=5,
|
||||
rarity=0.3 -- (this/count) chance of spawning cluster in the vein
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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(sample_vein_col,minp,maxp,seed)
|
||||
rocksl.veingen(ign.veins,minp,maxp,seed)
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
|
21
mapgen.lua
21
mapgen.lua
@ -13,7 +13,7 @@ rocksl.GetNextSeed=function()
|
||||
return rocksl.seedseq
|
||||
end
|
||||
|
||||
rocksl.register_blob=function(layer,name,param)
|
||||
rocksl.register_stratus=function(layer,name,param)
|
||||
table.insert(layer.localized,{
|
||||
primary=name,
|
||||
spread=(param.spread or 20),
|
||||
@ -25,7 +25,17 @@ rocksl.register_blob=function(layer,name,param)
|
||||
layer.stats.node[name]=0
|
||||
end
|
||||
|
||||
rocksl.register_vein=function(layer,name,param)
|
||||
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 )
|
||||
@ -103,12 +113,11 @@ rocksl.layergen=function(layer, minp, maxp, seed)
|
||||
end
|
||||
end
|
||||
|
||||
local ignore_wherein=1
|
||||
local ignore_wherein=nil
|
||||
|
||||
rocksl.veingen=function(veins,minp,maxp,seed)
|
||||
local side_length=(maxp.y-minp.y)
|
||||
local random=PseudoRandom(seed-79)
|
||||
print("begin veingen")
|
||||
local timebefore=os.clock();
|
||||
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local nodes = manipulator:get_data()
|
||||
@ -130,7 +139,7 @@ rocksl.veingen=function(veins,minp,maxp,seed)
|
||||
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)
|
||||
--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)
|
||||
@ -139,7 +148,7 @@ rocksl.veingen=function(veins,minp,maxp,seed)
|
||||
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)
|
||||
--print("vein "..vein.primary.." @ "..x0..","..y0..","..z0.." vrm="..vrm)
|
||||
did_generate=1
|
||||
for x=-vrm, vrm do
|
||||
for y=-vrm, vrm do
|
||||
|
Loading…
Reference in New Issue
Block a user