Ore/Node registration with table? Help Plz

Post Reply
Winter94
Member
Posts: 44
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Ore/Node registration with table? Help Plz

by Winter94 » Post

Ive been trying my hardest to figure this out. what have I done wrong?
Here's the code:

Code: Select all

underforge.minerals = {}

local mineral_table = { --name, desc, strata, rarity
	{"corundum",		"Corundum",			"gneiss",			10*10*10,},
	{"corundum",		"Corundum",			"mica",				10*10*10,},
	{"corundum",		"Corundum",			"schist",			10*10*10,},
	{"corundum",		"Corundum",			"pegmatite",		10*10*10,},
	{"tetrahedrite",	"Tetrahedrite",		"diorite",			10*10*10,},
	{"tetrahedrite",	"Tetrahedrite",		"pegmatite",		10*10*10,},
	{"tetrahedrite",	"Tetrahedrite",		"phyllite",			10*10*10,},
	{"cassiterite",		"Cassiterite",		"andesite",			10*10*10,},
	{"cassiterite",		"Cassiterite",		"basalt",			10*10*10,},
	{"cassiterite",		"Cassiterite",		"gabbro",			10*10*10,},
	{"sphalerite",		"Sphalerite",		"andesite",			10*10*10,},
	{"sphalerite",		"Sphalerite",		"dolomite",			10*10*10,},
	{"sphalerite",		"Sphalerite",		"gneiss",			10*10*10,},
	{"bismuthinite",	"Bismuthinite",		"diorite",			10*10*10,},
	{"bismuthinite",	"Bismuthinite",		"granite",			10*10*10,},
	{"bismuthinite",	"Bismuthinite",		"pegmatite",		10*10*10,},
	}

for i in ipairs (mineral_table) do
    local name		= mineral_table[i][1]
    local desc		= mineral_table[i][2]
    local strata	= mineral_table[i][3]
    local rarity	= mineral_table[i][4]

minetest.register_node("underforge:"..name){
	description	= desc,
	tiles		= '"strata..".png"^"ore_"..name..".png"',
	groups		= {cracky = 3, minerals = 1},
	drop		= "underforge:"..name.."_chunk",
	sounds		= default.node_sound_stone_defaults(),
	}

minetest.register_ore("underforge:"..name){
	ore_type		= "scatter",
	ore				= "underforge:"..name.."_in_"..strata,
	wherein			= "underforge:"..strata,
	clust_scarcity	= {rarity},
	clust_size		= 5,
	clust_num_ores	= 10,
	}

minetest.register_craftitem("underforge:"..name){
		description = S("Chunk of" ..desc ),
		groups = {rocks = 1, minerals = 2},
		inventory_image = "chunk_"..name..".png",
	}
end
And Here's the error:

Code: Select all

2020-01-24 14:21:34: WARNING[Main]: Irrlicht: OpenGL driver version is not 1.2 or better.
2020-01-24 14:21:34: WARNING[Main]: Irrlicht: Failed to load OpenGL's multitexture extension, proceeding without.
2020-01-24 14:21:34: WARNING[Main]: Irrlicht: Warning: OpenGL device only has one texture unit. Disabling multitexturing.
2020-01-24 14:21:34: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 14:21:34: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 14:21:37: ERROR[Main]: ModError: Failed to load and run script from C:\Users\XA-26483\Desktop\MINETEST\minetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:
2020-01-24 14:21:37: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:207: attempt to index local 'nodedef' (a nil value)
2020-01-24 14:21:37: ERROR[Main]: stack traceback:
2020-01-24 14:21:37: ERROR[Main]: 	...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:207: in function 'register_node'
2020-01-24 14:21:37: ERROR[Main]: 	...est-5.1.0-win64\bin\..\mods\underforge_lite/minerals.lua:28: in main chunk
2020-01-24 14:21:37: ERROR[Main]: 	[C]: in function 'dofile'
2020-01-24 14:21:37: ERROR[Main]: 	...inetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:19: in main chunk
2020-01-24 14:21:37: ERROR[Main]: Check debug.txt for details.
2020-01-24 14:21:37: ACTION[Main]: Server: Shutting down
2020-01-24 14:21:40: ERROR[Main]: Please choose a name!

User avatar
paramat
Developer
Posts: 3683
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Ore/Node registration with table? Help Plz

by paramat » Post

Please do not start a new thread for this problem when you already have one you started a few hours earlier, and are already getting help:
viewtopic.php?f=47&t=24103
You also posted this problem in the mapgen questions thread, please do not spam this everywhere, thanks.

This thread should be deleted.

Winter94
Member
Posts: 44
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Ore/Node registration with table? Help Plz

by Winter94 » Post

Ok, I'm sorry. I didn't think about it reaching the point of spam, it was my friend's idea to repost it in different places. How do I delete it?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest