1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2025-04-21 03:10:25 +02:00

disable some logging

This commit is contained in:
Niklp09 2023-04-12 17:52:29 +02:00
parent d55f066686
commit a154cb9904

View File

@ -10,8 +10,8 @@ function pl.get_def_from_id(id)
end end
function pl.register_on_generate(def, plantname, index, func) function pl.register_on_generate(def, plantname, index, func)
if not index then index = 1 end if not index then index = 1 end -- Do we need `index`?
local deco_def = { local deco_def = { -- This needs some good values (and noise param support)
name = plantname .. "_" .. index, name = plantname .. "_" .. index,
deco_type = "simple", deco_type = "simple",
place_on = def.place_on or def.surface, place_on = def.place_on or def.surface,
@ -33,15 +33,15 @@ end
local ids = {} local ids = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
print(dump(deco)) -- print(dump(deco))
for k, v in pairs(deco) do for k, v in pairs(deco) do
local id = minetest.get_decoration_id(deco[k][1].name) local id = minetest.get_decoration_id(deco[k][1].name)
deco[k][1].id = id deco[k][1].id = id
table.insert(ids, id) table.insert(ids, id)
end end
print(dump2(ids)) -- print(dump2(ids))
minetest.set_gen_notify("decoration", ids) minetest.set_gen_notify("decoration", ids)
print(dump2(deco)) -- print(dump(deco))
end) end)
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
@ -49,9 +49,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
local locations = {} local locations = {}
for _, id in pairs(ids) do for _, id in pairs(ids) do
local deco_locations = g["decoration#" .. id] or {} local deco_locations = g["decoration#" .. id] or {}
print("dl: " .. dump2(deco_locations)) -- print("dl: " .. dump2(deco_locations))
for k, pos in pairs(deco_locations) do for k, pos in pairs(deco_locations) do
print(id) -- print(id)
local next = #locations + 1 local next = #locations + 1
locations[next] = {} locations[next] = {}
locations[next].pos = pos locations[next].pos = pos
@ -60,13 +60,34 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
if #locations == 0 then return end if #locations == 0 then return end
print("locations: " .. dump2(locations)) -- print("locations: " .. dump2(locations))
for _, t in ipairs(locations) do for _, t in ipairs(locations) do
local def = pl.get_def_from_id(t.id) local def = pl.get_def_from_id(t.id)
local spawn_func = def[2] local spawn_func = def[2]
spawn_func(t.pos) spawn_func(t.pos)
abstract_bushes.grow_bush(t.pos) -- local player = minetest.get_player_by_name("Niklp")
local player = minetest.get_player_by_name("Niklp") -- player:set_pos(t.pos)
player:set_pos(t.pos)
end end
end) end)
--[[ Example plant
{
{
y_min = 1,
decoration = "air",
deco_type = "simple",
id = 45,
name = "bushes:bushes_1",
place_on = {
"default:dirt_with_grass",
"stoneage:grass_with_silex",
"sumpf:peat",
"sumpf:sumpf"
},
sidelen = 16,
fill_ratio = 0.001
},
^ - decoration def; object ID
<function>
}, ^ - spawn function
]]--