1
0
mirror of git://repo.or.cz/rocks.git synced 2024-11-18 00:08:35 +01:00

Added ore chance.

This commit is contained in:
Tomáš Brada 2015-02-08 21:32:25 +01:00
parent d2b4bd6332
commit 8a44c3a8cd
2 changed files with 12 additions and 7 deletions

View File

@ -15,8 +15,8 @@ rocks.register_vein("clay",{
hmin=-8, hmax=nil, hmin=-8, hmax=nil,
layers={ "mudstone" }, layers={ "mudstone" },
}) })
rocks.register_ore( "clay", "default:clay", {treshold=0, chance=1 } ) rocks.register_ore( "clay", "default:clay", {treshold=0, chance=85 } )
rocks.register_ore( "clay", "default:torch", {treshold=0, chance=0.3 } ) rocks.register_ore( "clay", "default:torch", {treshold=0, chance=15 } )
-- Breccia Mixture soft in mudstone -- Breccia Mixture soft in mudstone
-- Conglomerate Sed soft in mudstone -- Conglomerate Sed soft in mudstone

View File

@ -37,7 +37,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- noise pre vein -- noise pre vein
np=vd.np np=vd.np
vd.nmap=minetest.get_perlin_map(np,map_lengths_xyz):get3dMap_flat(minp) vd.nmap=minetest.get_perlin_map(np,map_lengths_xyz):get3dMap_flat(minp)
vd.prng=nil vd.prng=PseudoRandom(np.seed)
vd.sum=0 vd.sum=0
for i,ore in pairs(vd.ores) do for i,ore in pairs(vd.ores) do
-- contntid pre rudu -- contntid pre rudu
@ -93,11 +93,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
if vein then if vein then
--* select ore --* select ore
local chance=vein.prng:next(0,vein.sum)
for i,ore in pairs(vein.ores) do for i,ore in pairs(vein.ores) do
chance=chance-ore.chance
if chance<=0 then
rock=ore rock=ore
break break
end end
end end
end
--* place rocks --* place rocks
if (rock) and(nodes[p_pos]==stone_ctx) then if (rock) and(nodes[p_pos]==stone_ctx) then
@ -111,8 +115,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
manipulator:set_data(nodes) manipulator:set_data(nodes)
manipulator:calc_lighting() --manipulator:calc_lighting()
manipulator:update_liquids() --manipulator:set_lighting({day=15,night=15})
--manipulator:update_liquids()
manipulator:write_to_map() manipulator:write_to_map()
print("[rocks] gen0 "..os.clock()-timebefore) print("[rocks] gen0 "..os.clock()-timebefore)
end) end)