disable some logging

This commit is contained in:
Niklp09 2023-04-12 17:52:29 +02:00
parent d55f066686
commit a154cb9904
1 changed files with 33 additions and 12 deletions

View File

@ -10,8 +10,8 @@ function pl.get_def_from_id(id)
end
function pl.register_on_generate(def, plantname, index, func)
if not index then index = 1 end
local deco_def = {
if not index then index = 1 end -- Do we need `index`?
local deco_def = { -- This needs some good values (and noise param support)
name = plantname .. "_" .. index,
deco_type = "simple",
place_on = def.place_on or def.surface,
@ -33,15 +33,15 @@ end
local ids = {}
minetest.register_on_mods_loaded(function()
print(dump(deco))
-- print(dump(deco))
for k, v in pairs(deco) do
local id = minetest.get_decoration_id(deco[k][1].name)
deco[k][1].id = id
table.insert(ids, id)
end
print(dump2(ids))
-- print(dump2(ids))
minetest.set_gen_notify("decoration", ids)
print(dump2(deco))
-- print(dump(deco))
end)
minetest.register_on_generated(function(minp, maxp, blockseed)
@ -49,9 +49,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
local locations = {}
for _, id in pairs(ids) do
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
print(id)
-- print(id)
local next = #locations + 1
locations[next] = {}
locations[next].pos = pos
@ -60,13 +60,34 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
if #locations == 0 then return end
print("locations: " .. dump2(locations))
-- print("locations: " .. dump2(locations))
for _, t in ipairs(locations) do
local def = pl.get_def_from_id(t.id)
local spawn_func = def[2]
spawn_func(t.pos)
abstract_bushes.grow_bush(t.pos)
local player = minetest.get_player_by_name("Niklp")
player:set_pos(t.pos)
-- local player = minetest.get_player_by_name("Niklp")
-- player:set_pos(t.pos)
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
]]--