Experiments with layers.
[rocks.git] / rocks / init.lua
blob657da203610104faad549d9d7eae905c0f034208
1 minetest.log("info","[rocks] mod initializing")
3 -- Load translation library if intllib is installed
5 if (minetest.get_modpath("intllib")) then
6 dofile(minetest.get_modpath("intllib").."/intllib.lua")
7 S = intllib.Getter(minetest.get_current_modname())
8 else
9 S = function ( s ) return s end
10 end
12 rocks={}
13 rocksl={}
15 rocksl.print=function(text)
16 minetest.log("info","/rocks "..text)
17 end
19 rocksl.seedprng=PseudoRandom(763)
20 rocksl.GetNextSeed=function()
21 return rocksl.seedprng:next()
22 end
24 minetest.clear_registered_ores()
26 local modpath=minetest.get_modpath(minetest.get_current_modname())
28 --dofile(modpath.."/pipes.lua")
29 --dofile(modpath.."/veins.lua")
30 dofile(modpath.."/layers.lua")
32 minetest.register_on_generated(function(minp,maxp,seed)
33 local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
34 local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
35 local pr=PseudoRandom(seed)
36 rocksl.genlayers(minp,maxp,seed,vm,area)
37 vm:write_to_map()
38 end)
40 minetest.register_on_mapgen_init(function(mapgen_params)
41 -- todo: disable caves and ores
42 end)