gallery: add cube option /gallerycube

This commit is contained in:
cora 2022-03-25 23:31:49 +01:00
parent 906f9ab1a2
commit 8fed69703f
1 changed files with 29 additions and 0 deletions

View File

@ -7,6 +7,27 @@ local function generate_gallery(pos)
i = i + 1 i = i + 1
end end
end end
local function generate_gallery_cube(pos)
local i=1
local j=1
local x=1
local y=1
local z=1
local length=10
for n,node in pairs(minetest.registered_nodes) do
minetest.set_node(vector.add(pos,vector.new(x,y,z)),{name=n})
if x > length then
x = 1
z = z + 1
else
x = x + 1
end
if z > length then
y = y + 1
z = 1
end
end
end
minetest.register_chatcommand("gallery",{ minetest.register_chatcommand("gallery",{
description="Generates a wall of all registered nodes next to the player", description="Generates a wall of all registered nodes next to the player",
@ -15,3 +36,11 @@ minetest.register_chatcommand("gallery",{
local pl=minetest.get_player_by_name(name) local pl=minetest.get_player_by_name(name)
generate_gallery(vector.add(pl:get_pos(),vector.new(0,0,5))) generate_gallery(vector.add(pl:get_pos(),vector.new(0,0,5)))
end}) end})
minetest.register_chatcommand("gallerycube",{
description="Generates a cube 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_cube(vector.add(pl:get_pos(),vector.new(0,0,5)))
end})