diff --git a/rocks/veins.lua b/depositgen/veins.lua similarity index 67% rename from rocks/veins.lua rename to depositgen/veins.lua index c7ec2b6..bc22850 100644 --- a/rocks/veins.lua +++ b/depositgen/veins.lua @@ -1,12 +1,45 @@ -- experimental fast vein generator -rocks.veins={} +local l=depositgen.l +local print=l.print -table.insert(rocks.veins,{ +-- the public table of registered veins +depositgen.veins={} +local regs=depositgen.veins + +depositgen.register_vein= function(descr) + local vein={ + ymin=(descr.ymin or -10000), + ymax=(descr.ymax or 200), + scarcity=descr.scarcity, + content={ name=descr.content }, + scatter={} + } + table.insert(depositgen.l.ToResolve,vein.content) + for _,sc in pairs(descr.scatter) do + local psc={ + scarcity=sc.scarcity, + size=(sc.size or vein.width), + density=sc.density, + content={ name=sc.content } + } + table.insert(depositgen.l.ToResolve,psc.content) + table.insert(vein.scatter,psc) + end + return table.insert(regs,vein) +end + +do +local sample_vein_def={ + ymin=-200, ymax=-6, scarcity=80, - -}) - + content="default:dirt", + scatter={ + --{ scarcity=7, density=4, content="default:mese", size=2 } + } +} +depositgen.register_vein(sample_vein_def) +end rocksl.genvein=function(minp,maxp,pr,vm,area) local t1 = os.clock()