Problems • Re: A most puzzling ore spawn issue
I'm a bit confused... If it's too late to register new ores at that time, then logically none of my own ores should be registered since that occurs only within the callback. But during testing I found that most of my ores were being registered, just not all of them. It was puzzling because the ores which failed to register were all located inside the same files where the working ores are. For example, gemstones are working and are registered from within "mineral-non_metal-ore.lua", but all the other ores in that file are missing from the table. Most stones are registered, but a few are missing. All of the metal ores are missing, which is really odd since that file is loaded before the one that registers the gemstones.<br><br>Apparently I've spent too much time in a terminal and forgot that Firefox can read plaintext files, which solves my non-issue of posting code *facepalm* Here's the broken init.lua file, and in the meantime I'll be reading that forum you linked.<br><div class="codebox"><p>Code: </p><pre><code>local geopath = minetest.get_modpath("geo")---- API and Config--geo = {}dofile(geopath.."/config.lua")dofile(geopath.."/api/climate.lua")---- Nodes--dofile(geopath.."/nodes/stone-sedimentary-node.lua")dofile(geopath.."/nodes/stone-metamorphic-node.lua")dofile(geopath.."/nodes/stone-igneous-node.lua")dofile(geopath.."/nodes/sediment-node.lua")dofile(geopath.."/nodes/mineral-metal-node.lua")dofile(geopath.."/nodes/mineral-non_metal-node.lua")dofile(geopath.."/nodes/blocks.lua")---- Items and Tools--dofile(geopath.."/craftitems.lua")dofile(geopath.."/tools/flint.lua")dofile(geopath.."/tools/ruby.lua")dofile(geopath.."/tools/sapphire.lua")dofile(geopath.."/tools/hammer.lua")----[[ Mapgen--NOTICE: The exact order in which these files are loaded seems to matter morethan I once thought. For example, if lava.lua is loaded earlier in the chainthen the magma conduits will never form, but the code still runs and causes lagwhenever I break something.--]]---- Clear the ores table.--local ores_copy = {}for k, v in pairs(core.registered_ores) doores_copy[k] = vendcore.clear_registered_ores()---- Initialize new ores--if geo.config.gen_stone thendofile(geopath.."/mapgen/stone-upper_mantle.lua")dofile(geopath.."/mapgen/stone-crust.lua")dofile(geopath.."/mapgen/stone-chunks.lua")endif geo.config.gen_sed thendofile(geopath.."/mapgen/sediment-ore.lua")endif geo.config.gen_ore thendofile(geopath.."/mapgen/mineral-metal-ore.lua")dofile(geopath.."/mapgen/mineral-non_metal-ore.lua")endif geo.config.gen_lava thendofile(geopath.."/mapgen/conduit.lua")core.register_mapgen_script(geopath.."/mapgen/lava.lua")endlocal delete = {["default:stone_with_coal"] = 1,["default:stone_with_copper"] = 1,["default:stone_with_tin"] = 1,["default:stone_with_iron"] = 1,["default:stone_with_gold"] = 1,["default:stone_with_diamond"] = 1,["default:clay"] = 1,["default:sand"] = 1,["default:silver_sand"] = 1,["default:gravel"] = 1,["tnt:sulfur_block"] = 1,}---- Replace missing ores.---- NOTICE: The API doc says core.registered_ores is indexed by name, but when-- printing 'k' during debug it just gave a bunch of numbers, while 'ipairs'-- simply gives nil and is useless here. We use 'pairs' and 'def.ore' since-- that does return the node name as a string.--for key, def in pairs(ores_copy) doif geo.config.gen_ore thenif not delete[def.ore] thencore.register_ore(def)endelsecore.register_ore(def)endend---- Support for other mods--local mods = {"animalworld","advtrains","anvil","bweapons_bows_pack","composting","livingcaves","quartz","torches_redo","techage","tnt",}for i, v in ipairs(mods) doif core.get_modpath(v) thendofile(geopath.."/support/"..v..".lua")endendcore.register_on_mods_loaded(function()for _, def in pairs(core.registered_ores) doprint("GEO-LOGICAL: " .. def.ore)endend)</code></pre></div><p>Statistics: Posted by <a href="https://forum.luanti.org/memberlist.php?mode=viewprofile&u=49614">rg19</a> — Wed Jan 28, 2026 10:21</p><hr />