From 78844484f8ed85164e123d94e77f81b2fb3024f4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 27 Nov 2023 23:44:06 +0000 Subject: [PATCH] Add //ngroups, which lists the groups a given node is a member of --- CHANGELOG.md | 1 + Chat-Command-Reference.md | 36 +++++++++++++ .../commands/nodes/init.lua | 11 ++++ .../commands/nodes/ngroups.lua | 52 +++++++++++++++++++ worldeditadditions_commands/init.lua | 5 +- .../utils/NodeListMatcher.lua | 2 +- 6 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 worldeditadditions_commands/commands/nodes/init.lua create mode 100644 worldeditadditions_commands/commands/nodes/ngroups.lua diff --git a/CHANGELOG.md b/CHANGELOG.md index 8689923..5f80436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Note to self: See the bottom of this file for the release template text. - Added a (rather nuclear) fix (attempt 4) at finally exterminating all zombie region marker walls forever - This is not a hotfix to avoid endless small releases fixing the bug, as it's clear it's much more difficult to fix on all systems than initially expected - Added [`//nodeapply`](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply), a generalisation of [`//airapply`](https://worldeditadditions.mooncarrot.space/Reference/#airapply) that works with a defined list of nodes. Check out [the reference](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply) - it has some cool tricks to it! (thanks for suggesting, @kliv91 from the Discord server!) +- Added [`//ngroups`](https://worldeditadditions.mooncarrot.space/Reference/#ngroups), which lists the groups that a given node is a member of. Useful when paired with [`//nodeapply`](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply)! ## v1.14.5: The multipoint update, hotfix 5 (1st August 2023) diff --git a/Chat-Command-Reference.md b/Chat-Command-Reference.md index c995229..b94f785 100644 --- a/Chat-Command-Reference.md +++ b/Chat-Command-Reference.md @@ -1401,6 +1401,42 @@ This command is intended for development and modding. You will not normally need ``` +### `//ngroups [v[erbose]]` +Lists the groups that a given node is a member of. For example: + +```weacmd +//ngroups sand +``` + +Might return: + +``` +default:sand ∈ sand crumbly falling_node +``` + +Groups in Minetest can also have a numerical value greater than 0. Append `v` or `verbose` to see those values: + +```weacmd +//ngroups sand v +//ngroups sand verbose +``` + +...both of the above might produce an output like this: + +``` +default:sand ∈ sand=1 crumbly=3 falling_node=1 +``` + +Finally, the customary misc examples: + +```weacmd +//ngroups sand +//ngroups bakedclay:orange v +//ngroups cactus +//ngroups default:dry_shrub v +``` + + ## Extras