[mod] Display All Installed Nodes (for design and building)
The code excludes lava water and fire from display (else it obscures your view, or combusts everything)
just paste it into an init.lua file in a directory of your choice, or extract the zip file
https://dl.dropboxusercontent.com/u/21225632/displayallnodes.zip
BTW in 0.4.11 debug (F5) tells which node you're pointing at if you want to identify them
In the foreground is minetest_game, and the background is with moreblocks included


EDIT: This was my original post, left for posterity
I'd really like a mod which can place every registered node in a game so I can view them.
I'm considering making one, but don't know how to list all registered nodes.
I know there is minetest.registered_nodes[nodename], but that's indexed by name. As a start, I want a list I can iterate through to return the names.
Does anyone know how to do that (or can supply code to get me more or less of the way along)?
just paste it into an init.lua file in a directory of your choice, or extract the zip file
https://dl.dropboxusercontent.com/u/21225632/displayallnodes.zip
BTW in 0.4.11 debug (F5) tells which node you're pointing at if you want to identify them
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local displayAllNodes = function(pos)
local nodeCount = 0
-- key is node name, eg default:stone value is definition table
for key, value in pairs(minetest.registered_nodes) do
print (key)
nodeCount = nodeCount + 1
end
local manip = minetest.get_voxel_manip()
minetest.chat_send_all("placing".. nodeCount.. " nodes")
local curY = pos.y + math.sqrt(nodeCount * 2)
local curX = pos.x
local curZ = pos.z
local startX = pos.x
local startZ = pos.z
local curRowMax = 1
local rowCount = 1
for key, value in pairs(minetest.registered_nodes) do
if ((string.find(key,"lava") == nil) and (string.find(key,"fire")) == nil and (string.find(key,"water") == nil) and (string.find(key,"air") == nil)) then
local p = {x=curX, y=curY, z=curZ}
manip:read_from_map(p, p)
minetest.env:add_node(p, {name=key})
-- use the voxelmanip to fix lighting problems
manip:calc_lighting()
rowCount = rowCount + 1
if rowCount > curRowMax then
rowCount = 1
curRowMax = curRowMax + 1 --2
--startX = startX - 1
startZ = startZ - 1
curY = curY - 1
curX = startX
curZ = startZ
else
curX = curX + 1
curZ = curZ + 1
end
end
end
return true
end
minetest.register_chatcommand("/dan", {
params = "",
description = "Display All registered Nodes",
func = function(name, param)
local pos = minetest.get_player_by_name(name):getpos()
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
displayAllNodes(pos)
return true
end,
})
In the foreground is minetest_game, and the background is with moreblocks included


EDIT: This was my original post, left for posterity
I'd really like a mod which can place every registered node in a game so I can view them.
I'm considering making one, but don't know how to list all registered nodes.
I know there is minetest.registered_nodes[nodename], but that's indexed by name. As a start, I want a list I can iterate through to return the names.
Does anyone know how to do that (or can supply code to get me more or less of the way along)?