mirror of
git://repo.or.cz/rocks.git
synced 2025-01-04 07:10:28 +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)
|
local reg=function(name,param)
|
||||||
rocksl.register_blob(ign,name,param)
|
rocksl.register_stratus(ign,name,param)
|
||||||
end
|
end
|
||||||
rocks.register_igneous=reg
|
rocks.register_igneous_stratus=reg
|
||||||
|
|
||||||
-- rock registration
|
-- rock registration
|
||||||
reg("rocks:granite", { spread=40, height=32, treshold=0.06})
|
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})
|
reg("rocks:gabbro", { spread=40, height=32, treshold=0.36})
|
||||||
|
|
||||||
-- vein stuff
|
-- vein stuff
|
||||||
local sample_vein_col={
|
ign.veins={}
|
||||||
{ primary="default:nyancat",
|
|
||||||
wherein="rocks:granite",
|
rocksl.register_vein(ign.veins,"default:nyancat",{
|
||||||
miny=-160, maxy=20,
|
wherein="rocks:granite",
|
||||||
radius={ average=10, amplitude=4, frequency=8 },
|
miny=-160, maxy=20,
|
||||||
density=1,
|
radius={ average=10, amplitude=4, frequency=8 },
|
||||||
rarity=0.025, -- this^3*mapblock_volume veins per mapblock
|
density=1,
|
||||||
localized={
|
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
|
|
||||||
}
|
-- { 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)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
rocksl.layergen(ign,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)
|
end)
|
||||||
|
|
||||||
minetest.register_on_shutdown(function()
|
minetest.register_on_shutdown(function()
|
||||||
|
21
mapgen.lua
21
mapgen.lua
@ -13,7 +13,7 @@ rocksl.GetNextSeed=function()
|
|||||||
return rocksl.seedseq
|
return rocksl.seedseq
|
||||||
end
|
end
|
||||||
|
|
||||||
rocksl.register_blob=function(layer,name,param)
|
rocksl.register_stratus=function(layer,name,param)
|
||||||
table.insert(layer.localized,{
|
table.insert(layer.localized,{
|
||||||
primary=name,
|
primary=name,
|
||||||
spread=(param.spread or 20),
|
spread=(param.spread or 20),
|
||||||
@ -25,7 +25,17 @@ rocksl.register_blob=function(layer,name,param)
|
|||||||
layer.stats.node[name]=0
|
layer.stats.node[name]=0
|
||||||
end
|
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)
|
rocksl.layergen=function(layer, minp, maxp, seed)
|
||||||
if ( (layer.top.offset+layer.top.scale)>minp.y )
|
if ( (layer.top.offset+layer.top.scale)>minp.y )
|
||||||
@ -103,12 +113,11 @@ rocksl.layergen=function(layer, minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ignore_wherein=1
|
local ignore_wherein=nil
|
||||||
|
|
||||||
rocksl.veingen=function(veins,minp,maxp,seed)
|
rocksl.veingen=function(veins,minp,maxp,seed)
|
||||||
local side_length=(maxp.y-minp.y)
|
local side_length=(maxp.y-minp.y)
|
||||||
local random=PseudoRandom(seed-79)
|
local random=PseudoRandom(seed-79)
|
||||||
print("begin veingen")
|
|
||||||
local timebefore=os.clock();
|
local timebefore=os.clock();
|
||||||
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
local nodes = manipulator:get_data()
|
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)
|
iterations_count=iterations_count+(random:next(0,100)/100)
|
||||||
local primary_ctx=minetest.get_content_id(vein.primary)
|
local primary_ctx=minetest.get_content_id(vein.primary)
|
||||||
local wherein_ctx=minetest.get_content_id(vein.wherein)
|
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
|
for iteration=1, iterations_count do
|
||||||
local x0=minp.x+ random:next(0,side_length)
|
local x0=minp.x+ random:next(0,side_length)
|
||||||
local y0=minp.y+ 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 noise_ix=1
|
||||||
local posi = area:index(x0, y0, z0)
|
local posi = area:index(x0, y0, z0)
|
||||||
if ignore_wherein or (nodes[posi]==wherein_ctx) then
|
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
|
did_generate=1
|
||||||
for x=-vrm, vrm do
|
for x=-vrm, vrm do
|
||||||
for y=-vrm, vrm do
|
for y=-vrm, vrm do
|
||||||
|
Loading…
Reference in New Issue
Block a user