From 8a44c3a8cd55533ea7897ba665fe5eb19147bf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Brada?= Date: Sun, 8 Feb 2015 21:32:25 +0100 Subject: [PATCH] Added ore chance. --- geologica_nv.lua | 4 ++-- mapgen.lua | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/geologica_nv.lua b/geologica_nv.lua index c04516b..6238147 100644 --- a/geologica_nv.lua +++ b/geologica_nv.lua @@ -15,8 +15,8 @@ rocks.register_vein("clay",{ hmin=-8, hmax=nil, layers={ "mudstone" }, }) -rocks.register_ore( "clay", "default:clay", {treshold=0, chance=1 } ) -rocks.register_ore( "clay", "default:torch", {treshold=0, chance=0.3 } ) +rocks.register_ore( "clay", "default:clay", {treshold=0, chance=85 } ) +rocks.register_ore( "clay", "default:torch", {treshold=0, chance=15 } ) -- Breccia Mixture soft in mudstone -- Conglomerate Sed soft in mudstone diff --git a/mapgen.lua b/mapgen.lua index d55ec6a..d56a185 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -37,7 +37,7 @@ minetest.register_on_generated(function(minp, maxp, seed) -- noise pre vein np=vd.np vd.nmap=minetest.get_perlin_map(np,map_lengths_xyz):get3dMap_flat(minp) - vd.prng=nil + vd.prng=PseudoRandom(np.seed) vd.sum=0 for i,ore in pairs(vd.ores) do -- contntid pre rudu @@ -93,9 +93,13 @@ minetest.register_on_generated(function(minp, maxp, seed) if vein then --* select ore + local chance=vein.prng:next(0,vein.sum) for i,ore in pairs(vein.ores) do - rock=ore - break + chance=chance-ore.chance + if chance<=0 then + rock=ore + break + end end end @@ -111,8 +115,9 @@ minetest.register_on_generated(function(minp, maxp, seed) end end manipulator:set_data(nodes) - manipulator:calc_lighting() - manipulator:update_liquids() + --manipulator:calc_lighting() + --manipulator:set_lighting({day=15,night=15}) + --manipulator:update_liquids() manipulator:write_to_map() print("[rocks] gen0 "..os.clock()-timebefore) end)