diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a803116 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/projects/node_metadata.dia.autosave diff --git a/init.lua b/init.lua index de35bd3..bd0e708 100644 --- a/init.lua +++ b/init.lua @@ -2,12 +2,8 @@ -- Metadata Tools -- -- A mod providing write and read access to a nodes' metadata using commands --- ßÿ Lymkwi/LeMagnesium/Mg ; 2015-2016 --- License: WTFPL --- Contributors : --- - Lymkwi/LeMagnesium --- - Paly2 --- - Poikilos +-- (c) 2015-2016 ßÿ Lymkwi/LeMagnesium/Mg and Paly2; (c) 2017-2022 Poikilos +-- License: [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) -- -- Version: Poikilos fork of 1.2.2 -- diff --git a/projects/node_metadata.dia b/projects/node_metadata.dia new file mode 100644 index 0000000..9b16b55 Binary files /dev/null and b/projects/node_metadata.dia differ diff --git a/projects/node_metadata.png b/projects/node_metadata.png new file mode 100644 index 0000000..e6f5598 Binary files /dev/null and b/projects/node_metadata.png differ diff --git a/readme.md b/readme.md index a610b0c..1e447bd 100644 --- a/readme.md +++ b/readme.md @@ -1,58 +1,86 @@ -Minetest mod metatools -###################### +# Minetest mod metatools -A mod inspired by mgl512's itemframe issue -Version : 1.2.2 +Get everything possible* about a node just by clicking it with metatools:stick! -# Authors - - LeMagnesium / Mg / ElectronLibre : Source code writer - - Paly2 / Palige : Contributor for the source code - - Ataron : Texture creater +This goes far beyond Lymkwi's metatools. -# Purpose + +## Differences in Poikilos' fork +- All known* metadata is shown on click! There is no need for various commands to traverse the tree, though the original chat command code is intact. +- Click a node and get its inventory. +- Click an entity and list the entire LuaEntitySOA tree! + - See the "[Minetest API Notes](minetest-api-notes)" section below. +- The texture is redone so that doesn't any longer have an invasive and inappropriate CC-BY-NC-SA license from the upstream version of metatools. + +`*` All metadata where how to obtain it is known by the maintainer of this repo (except where there is an open issue). + + +## Authors +Code: +- 2015-2016 LeMagnesium/Mg/ElectronLibre and Paly2/Palige (mod inspired by mgl512's itemframe issue) +- 2017-2022 Poikilos (Poikilos' fork of Version 1.2.2) + +Textures: +- 2022 Poikilos (redone "metatools_stick.png" *replaces one with invasive and inappropriate CC-BY-NC-SA license [old texture was by Ataron]*) + + +## Purpose This mod's aim is to provide a way for admins to navigate through any (ok, not ignores) nodes on the map, and see values of its metadatas at any of their stratum. -# Media -"metatools_stick.png" by Ataron (CC-BY-NC-SA) -# Todo - - Rewrite the table stocking : a variable containing a copy of the global - table returned by :to_table(), on which we would work, and a save command to - apply it on the node +## Install +- You can remove the project folder to lighten the "game" if necessary (Keeping the png is useful but only for documentation--Nothing in "projects" is used by the mod code). -# Special thanks - - mgl512 (Le_Docteur) for its locked itemframe which gave me the idea of a tool -allowing to see/edit metadatas - - Ataron who created the stick's texture - - palige who agreed to test the mod for its first release, and contributed to the last version -# Command tutorial - - Soon to come, please refer to /meta help until then +## Special thanks +- mgl512 (Le_Docteur) for its locked itemframe which gave me the idea of a tool + allowing to see/edit metadatas +- Ataron who created the stick's texture +- palige who agreed to test the mod for its first release, and contributed to the last version - Node metadatas look like this : - 0 1 2 3 ... - Node/ - | - +- fields - | | - | +- foo - | +- bar - | +- ... - +- inventory - | - +- main - | | - | +- 1 - | +- 2 - | +- 3 - | +- ... - +- craft - | | - | +- 1 - | +- 2 - | +- 3 - | +- ... - +- ... +## Command tutorial +- Soon to come, please refer to /meta help until then + + +## Development + +### Minetest API Notes + +#### Entity Metadata +The magic sauce to get the entire LuaEntitySOA of a pointed_thing was finally discovered by accident (when researching unrelated API feature(s)) after no one would/could answer my question: +```Lua +local pointedObjRef = pointed_thing.ref; +-- . . . some other code is here, then ... +local luaEntity = pointedObjRef:get_luaentity(); +``` + +#### Node metadata +![Node has fields and inventory; there are main and craft inventories, where each is a sequential table where each entry is an itemstack](projects/node_metadata.png) + +``` +Node +| ++-fields +| | +| +-foo +| +-bar +| +-... ++-inventory + | + +-main + | | + | +-1 + | +-2 + | +-3 + | +-... + +-craft + | | + | +-1 + | +-2 + | +-3 + | +-... + +-... +``` diff --git a/textures/metatools_stick.png b/textures/metatools_stick.png index 42302e6..16f7c1f 100644 Binary files a/textures/metatools_stick.png and b/textures/metatools_stick.png differ