Minetest-WorldEdit
Minetest-WorldEdit copied to clipboard
Add command to count different nodes in a selection
My usecase: to plan my builds in a survival server I use a copy of the server map in a singleplayer but in creative mode.
Such command can greatly reduce time for build planning and resource gaining on the server, because depending on the server economy it can be very time consuming to buy, mine or factory process them. This way you know exactly how much you need in advance.
It can also have a group filter parameter if you only need to count specific blocks, say plants or wood. Or even a more generic filter system (lua script?), so for example you can only count blocks with param2=2, etc.
Also I think similar commands may be added to count entities/mobs in a selection.
Some examples of use, as I imagine it.
] //countnodes
Region contains 79 nodes in total:
default:stone - 15
quartz:block - 40
default:chest - 2
default:pine_wood - 22
-- Can also use filter parameter(s) to count specific nodes or groups of nodes
] //countnodes quartz:block default:pine_wood
Region contains 62 quartz:block, default:pine_wood nodes in total:
quartz:block - 40
default:pine_wood - 22
] //countnodes group:wood
Region contains 22 group:wood nodes in total:
default:pine_wood - 22
-- Accepting lua script as a parameter for more specific filtering
-- Querying node attributes like param2
-- Applying regular expressions to node names, etc
] //countnodes <code>
Region contains 1 node that satisfies your query:
default:chest - 1