Do not log generation of terrain features

this leads to excessive io otherwise
This commit is contained in:
cora 2022-06-22 16:37:44 +02:00
parent fed81932e2
commit 8e976d9191
2 changed files with 18 additions and 4 deletions

View File

@ -2,6 +2,7 @@ mcl_structures.registered_structures = {}
function mcl_structures.place_structure(pos, def, pr) function mcl_structures.place_structure(pos, def, pr)
if not def then return end if not def then return end
local logging = not def.terrain_feature
local y_offset = 0 local y_offset = 0
if type(def.y_offset) == "function" then if type(def.y_offset) == "function" then
y_offset = def.y_offset(pr) y_offset = def.y_offset(pr)
@ -9,22 +10,30 @@ function mcl_structures.place_structure(pos, def, pr)
y_offset = def.y_offset y_offset = def.y_offset
end end
if def.on_place and not def.on_place(pos,def,pr) then if def.on_place and not def.on_place(pos,def,pr) then
if logging then
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.") minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.")
end
return false return false
end end
if def.filenames then if def.filenames then
local file = def.filenames[pr:next(1,#def.filenames)] local file = def.filenames[pr:next(1,#def.filenames)]
local pp = vector.offset(pos,0,y_offset,0) local pp = vector.offset(pos,0,y_offset,0)
mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",def.after_place,pr,{pos,def}) mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",def.after_place,pr,{pos,def})
if logging then
minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos))
end
return true return true
elseif def.place_func and def.place_func(pos,def,pr) then elseif def.place_func and def.place_func(pos,def,pr) then
if not def.after_place or ( def.after_place and def.after_place(pos,def,pr) ) then if not def.after_place or ( def.after_place and def.after_place(pos,def,pr) ) then
if logging then
minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos))
end
return true return true
end end
end end
if logging then
minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos)) minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos))
end
end end
function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly

View File

@ -80,6 +80,7 @@ end
mcl_structures.register_structure("lavapool",{ mcl_structures.register_structure("lavapool",{
place_on = {"group:sand", "group:dirt", "group:stone"}, place_on = {"group:sand", "group:dirt", "group:stone"},
terrain_feature = true,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 0.0000022, scale = 0.0000022,
@ -99,6 +100,7 @@ mcl_structures.register_structure("lavapool",{
mcl_structures.register_structure("water_lake",{ mcl_structures.register_structure("water_lake",{
place_on = {"group:dirt","group:stone"}, place_on = {"group:dirt","group:stone"},
terrain_feature = true,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 0.000032, scale = 0.000032,
@ -119,6 +121,7 @@ mcl_structures.register_structure("water_lake",{
mcl_structures.register_structure("basalt_column",{ mcl_structures.register_structure("basalt_column",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
terrain_feature = true,
spawn_by = {"air"}, spawn_by = {"air"},
num_spawn_by = 2, num_spawn_by = 2,
noise_params = { noise_params = {
@ -155,6 +158,7 @@ mcl_structures.register_structure("basalt_column",{
}) })
mcl_structures.register_structure("basalt_pillar",{ mcl_structures.register_structure("basalt_pillar",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
terrain_feature = true,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 0.001, scale = 0.001,
@ -192,6 +196,7 @@ mcl_structures.register_structure("lavadelta",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
spawn_by = {"mcl_blackstone:basalt","mcl_blackstone:blackstone"}, spawn_by = {"mcl_blackstone:basalt","mcl_blackstone:blackstone"},
num_spawn_by = 2, num_spawn_by = 2,
terrain_feature = true,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 0.01, scale = 0.01,