mirror of
git://repo.or.cz/rocks.git
synced 2025-01-04 07:10:28 +01:00
Changed api to prepare for mapgen rewrite.
This commit is contained in:
parent
aaa6ddeb3f
commit
c02b173bf0
21
ign.lua
21
ign.lua
@ -3,6 +3,7 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local ign={
|
local ign={
|
||||||
|
name="ign",
|
||||||
top={
|
top={
|
||||||
offset = -10, scale = 0,
|
offset = -10, scale = 0,
|
||||||
spread = {x=80, y=80, z=80},
|
spread = {x=80, y=80, z=80},
|
||||||
@ -17,6 +18,8 @@ local ign={
|
|||||||
debugging=nil
|
debugging=nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rocks.layer_initialize(ign)
|
||||||
|
|
||||||
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
|
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
|
||||||
minetest.register_node( "rocks:basalt", {
|
minetest.register_node( "rocks:basalt", {
|
||||||
description = S("Basalt"),
|
description = S("Basalt"),
|
||||||
@ -58,10 +61,7 @@ rocks.register_igneous_stratus=reg
|
|||||||
-- vein stuff
|
-- vein stuff
|
||||||
ign.veins={}
|
ign.veins={}
|
||||||
|
|
||||||
local regv=function(name,param)
|
local regv=rocks.register_vein
|
||||||
rocksl.register_vein(ign.veins,name,param)
|
|
||||||
end
|
|
||||||
rocks.register_vein=regv
|
|
||||||
|
|
||||||
rocks.register_vein("default:nyancat",{
|
rocks.register_vein("default:nyancat",{
|
||||||
wherein={"rocks:granite"},
|
wherein={"rocks:granite"},
|
||||||
@ -76,17 +76,4 @@ rocks.register_vein("default:nyancat",{
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
|
||||||
rocksl.layergen(ign,minp,maxp,seed)
|
|
||||||
rocksl.veingen(ign.veins,minp,maxp,seed)
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_shutdown(function()
|
|
||||||
if (ign.stats.count==0) then rocksl.print("[rocks](ign) stats not available, no chunks generated") return end
|
|
||||||
rocksl.print("[rocks](ign) generated total "..ign.stats.count.." chunks in "..ign.stats.total.." seconds ("..(ign.stats.total/ign.stats.count).." seconds per "..ign.stats.side.."^3 chunk)")
|
|
||||||
for name,total in pairs(ign.stats.node) do
|
|
||||||
rocksl.print("[rocks](ign) "..name..": "..total.." nodes placed ("..(total*100)/(ign.stats.totalnodes).." %)")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- ~ Tomas Brod
|
-- ~ Tomas Brod
|
34
mapgen.lua
34
mapgen.lua
@ -3,7 +3,7 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local print2=function(text)
|
local print2=function(text)
|
||||||
minetest.log("verbose","rocks/gen/ "..text)
|
minetest.log("info","rocks/gen/ "..text)
|
||||||
end
|
end
|
||||||
|
|
||||||
rocksl.seedseq=0
|
rocksl.seedseq=0
|
||||||
@ -13,6 +13,13 @@ rocksl.GetNextSeed=function()
|
|||||||
return rocksl.seedseq
|
return rocksl.seedseq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local layers={}
|
||||||
|
|
||||||
|
rocks.layer_initialize=function(layer)
|
||||||
|
layer.stats={ count=0, total=0, node={}, totalnodes=0 }
|
||||||
|
table.insert(layers,layer)
|
||||||
|
end
|
||||||
|
|
||||||
rocksl.register_stratus=function(layer,name,param)
|
rocksl.register_stratus=function(layer,name,param)
|
||||||
table.insert(layer.localized,{
|
table.insert(layer.localized,{
|
||||||
primary=name,
|
primary=name,
|
||||||
@ -25,7 +32,9 @@ rocksl.register_stratus=function(layer,name,param)
|
|||||||
layer.stats.node[name]=0
|
layer.stats.node[name]=0
|
||||||
end
|
end
|
||||||
|
|
||||||
rocksl.register_vein=function(col,name,param)
|
local veins={}
|
||||||
|
|
||||||
|
rocks.register_vein=function(name,param)
|
||||||
local d={
|
local d={
|
||||||
primary=name,
|
primary=name,
|
||||||
wherein=param.wherein,
|
wherein=param.wherein,
|
||||||
@ -35,7 +44,7 @@ rocksl.register_vein=function(col,name,param)
|
|||||||
rarity=param.rarity,
|
rarity=param.rarity,
|
||||||
secondary=(param.ores or {}),
|
secondary=(param.ores or {}),
|
||||||
}
|
}
|
||||||
table.insert(col,d)
|
table.insert(veins,d)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: rewrite above function to register normal minetest ore, with
|
-- TODO: rewrite above function to register normal minetest ore, with
|
||||||
@ -199,4 +208,23 @@ rocksl.veingen=function(veins,minp,maxp,seed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
for _,layer in pairs(layers) do rocksl.layergen(layer,minp,maxp,seed) end
|
||||||
|
rocksl.veingen(veins,minp,maxp,seed)
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
for _,ign in pairs(layers) do
|
||||||
|
print("[rocks] Stats for layer "..ign.name)
|
||||||
|
if (ign.stats.count==0) then
|
||||||
|
print("[rocks] |- stats not available, no chunks generated")
|
||||||
|
else
|
||||||
|
print("[rocks] |- generated total "..ign.stats.count.." chunks in "..ign.stats.total.." seconds ("..(ign.stats.total/ign.stats.count).." seconds per "..ign.stats.side.."^3 chunk)")
|
||||||
|
for name,total in pairs(ign.stats.node) do
|
||||||
|
print("[rocks] |- "..name..": "..total.." nodes placed ("..(total*100)/(ign.stats.totalnodes).." %)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- ~ Tomas Brod
|
-- ~ Tomas Brod
|
15
sed.lua
15
sed.lua
@ -3,6 +3,7 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local sed={
|
local sed={
|
||||||
|
name="sed",
|
||||||
top={
|
top={
|
||||||
offset = 20, scale = 0,
|
offset = 20, scale = 0,
|
||||||
spread = {x=80, y=80, z=80},
|
spread = {x=80, y=80, z=80},
|
||||||
@ -17,6 +18,8 @@ local sed={
|
|||||||
debugging=nil
|
debugging=nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rocks.layer_initialize(sed)
|
||||||
|
|
||||||
-- Mudstone Sed soft Ocean, beach, river, glaciers
|
-- Mudstone Sed soft Ocean, beach, river, glaciers
|
||||||
minetest.register_node( "rocks:mudstone", {
|
minetest.register_node( "rocks:mudstone", {
|
||||||
description = S("Mudstone"),
|
description = S("Mudstone"),
|
||||||
@ -53,16 +56,4 @@ rocks.register_sedimentary=reg
|
|||||||
reg("default:stone_with_coal", { spread=48, height=14, treshold=0.50 })
|
reg("default:stone_with_coal", { spread=48, height=14, treshold=0.50 })
|
||||||
reg("default:clay",{ spread=48, height=14, treshold=0.50 })
|
reg("default:clay",{ spread=48, height=14, treshold=0.50 })
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
|
||||||
rocksl.layergen(sed,minp,maxp,seed)
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_shutdown(function()
|
|
||||||
if (sed.stats.count==0) then rocksl.print("[rocks](sed) stats not available, no chunks generated") return end
|
|
||||||
rocksl.print("[rocks](sed) generated total "..sed.stats.count.." chunks in "..sed.stats.total.." seconds ("..(sed.stats.total/sed.stats.count).." seconds per "..sed.stats.side.."^3 chunk)")
|
|
||||||
for name,total in pairs(sed.stats.node) do
|
|
||||||
rocksl.print("[rocks](sed) "..name..": "..total.." nodes placed ("..(total*100)/(sed.stats.totalnodes).." %)")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- ~ Tomas Brod
|
-- ~ Tomas Brod
|
Loading…
Reference in New Issue
Block a user