mirror of
git://repo.or.cz/rocks.git
synced 2024-11-15 23:10:40 +01:00
New oregen init.
This commit is contained in:
parent
a9f2272127
commit
9b9419f2eb
46
depositgen/init.lua
Normal file
46
depositgen/init.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
depositgen={}
|
||||
local l={}
|
||||
depositgen.l=l
|
||||
|
||||
l.print=function(text)
|
||||
minetest.log("info","[depositgen] "..text)
|
||||
end
|
||||
|
||||
l.print("mod initializing")
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
l.OnGenerate={}
|
||||
l.OnInit={}
|
||||
l.ToResolve={}
|
||||
|
||||
local includes={
|
||||
"pipes","veins","layers"
|
||||
}
|
||||
|
||||
minetest.register_on_generated(function(minp,maxp,seed)
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local pr=PseudoRandom(seed)
|
||||
for i=0, #l.OnGenerate do
|
||||
l.OnGenerate[i](minp,maxp,seed,vm,area)
|
||||
end
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
-- todo: disable caves and ores
|
||||
-- todo: sort layers
|
||||
--Resolve all mapgen nodes to content ids
|
||||
l.print("Resolving node names")
|
||||
for _,i in pairs(l.ToResolve) do
|
||||
i.id=minetest.get_content_id(i.node)
|
||||
i.node=nil --free some memory
|
||||
end
|
||||
l.print("running mapgen initialization tasks")
|
||||
for _,i in pairs(l.OnInit) do
|
||||
i(mapgen_params)
|
||||
end
|
||||
end)
|
||||
|
||||
for _,s in pairs(includes) do dofile(modpath.."/"..s..".lua") end
|
|
@ -1,42 +0,0 @@
|
|||
minetest.log("info","[rocks] mod initializing")
|
||||
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
rocks={}
|
||||
rocksl={}
|
||||
|
||||
rocksl.print=function(text)
|
||||
minetest.log("info","/rocks "..text)
|
||||
end
|
||||
|
||||
rocksl.seedprng=PseudoRandom(763)
|
||||
rocksl.GetNextSeed=function()
|
||||
return rocksl.seedprng:next()
|
||||
end
|
||||
|
||||
minetest.clear_registered_ores()
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
--dofile(modpath.."/pipes.lua")
|
||||
--dofile(modpath.."/veins.lua")
|
||||
dofile(modpath.."/layers.lua")
|
||||
|
||||
minetest.register_on_generated(function(minp,maxp,seed)
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local pr=PseudoRandom(seed)
|
||||
rocksl.genlayers(minp,maxp,seed,vm,area)
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
-- todo: disable caves and ores
|
||||
end)
|
Loading…
Reference in New Issue
Block a user