1
0
mirror of git://repo.or.cz/rocks.git synced 2024-11-15 23:10:40 +01:00

Add vein density.

This commit is contained in:
Tomáš Brada 2015-04-10 19:30:36 +02:00
parent 65f286f233
commit bb7d89bf7d
2 changed files with 10 additions and 4 deletions

11
ign.lua
View File

@ -58,12 +58,17 @@ rocks.register_igneous_stratus=reg
-- vein stuff
ign.veins={}
rocksl.register_vein(ign.veins,"default:nyancat",{
local regv=function(name,param)
rocksl.register_vein(ign.veins,name,param)
end
rocks.register_vein=regv
rocks.register_vein("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
density=100,
rarity=0.0025, -- this^3*mapblock_volume veins per mapblock
ores={
{ ore="default:sand", percent=30 },
{ ore="default:dirt", percent=30 },

View File

@ -157,7 +157,8 @@ rocksl.veingen=function(veins,minp,maxp,seed)
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
local luck=random:next(0,99)
if (luck<vein.density) and (((x^2)+(y^2)+(z^2))<((vein.radius.average+nv)^2)) then
nodes[posi]=primary_ctx
local luck=random:next(0,99)
for _,sec in pairs(vein.secondary) do