add node gallery

generates a wall of all registered nodes next to the player.
chatcommand /gallery
This commit is contained in:
cora 2022-03-25 22:20:32 +01:00 committed by Gitea
parent ecc9fb298c
commit 1fc37f505d
3 changed files with 25 additions and 0 deletions

7
node_gallery/README.md Normal file
View File

@ -0,0 +1,7 @@
# node gallery
generates a wall of all registered nodes next to the player
## Chatcommands
/gallery - generate the node gallery

17
node_gallery/init.lua Normal file
View File

@ -0,0 +1,17 @@
local length = 50
local function generate_gallery(pos)
local i=1
for n,node in pairs(minetest.registered_nodes) do
minetest.set_node(vector.add(pos,vector.new(i % length,math.ceil(i / length),0)),{name=n})
i = i + 1
end
end
minetest.register_chatcommand("gallery",{
description="Generates a wall of all registered nodes next to the player",
privs={debug=true},
func=function(name,p)
local pl=minetest.get_player_by_name(name)
generate_gallery(vector.add(pl:get_pos(),vector.new(0,0,5)))
end})

1
node_gallery/mod.conf Normal file
View File

@ -0,0 +1 @@
name=node_gallery