-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easier to access node settings within node definition #60
Labels
Comments
This would cover large part of cleanup mentioned in #42, not all of it but still a lot. |
S-S-X
pushed a commit
that referenced
this issue
Nov 19, 2020
Should probably leave this here as note to myself if I have to do something like this again... find . -type f -name '*.lua' -path '*/nodes/*' | xargs -L1 -i'{}' bash -c 'ed "{}" <<END
/^return {$/+1;/^}$/-1m/^local definition = {/
/^return {$/-;/^}$/d
wq
END
' |
S-S-X
pushed a commit
that referenced
this issue
Nov 19, 2020
Merged
S-S-X
pushed a commit
that referenced
this issue
Nov 20, 2020
S-S-X
pushed a commit
that referenced
this issue
Nov 20, 2020
S-S-X
pushed a commit
that referenced
this issue
Nov 20, 2020
S-S-X
added a commit
that referenced
this issue
Nov 21, 2020
* (#60) OOP model for node definitions * formatting * (#60) Drop tooldef key/subtable from definition table * (#60) Covert before_* API methods to OOP model, cleaner formatting for other API methods * (#60) Unified on_use flow, similar overrides for callbacks * (#60) Fix before_write/read/info callbacks, allow short name for /metatool:give * (#60) Update API documentation, style/formatting for tool:on_write_node call * (#60) Extend regression tests * checkout@v2, "mineunit" detached to mt-mods repo * Update mineunit * Remove metatool copy/paste/info wrapper methods Co-authored-by: SX <sx@minetest>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem with getting configuration values easily
There is
metatool.settings(toolname, key)
function which is probably good enough for tool itself but there's nothing for node definition, instead one has to do something likemetatool.tool("mytool").nodes.mynode.settings.setting_name
to read node settings.Currently another way could be using
metatool.ns
function but that is not so clean and not really meant for this kind of hacky access to self and introduces many other problems.Possible solution, maybe
Better way would probably be something like
self.settings.setting_name
when accessed from node functions (copy, paste, info, before_write, before read, etc.).This requires converting node definitions to allow easy and clean definitions with easy and clean access to node definition object.
Things to consider, list of tasks
Edit: Seems that this is already done, just not utilized and not visible in any way. Just try to convert node definitions to format that more visibly express this possibility.
tooldef
key from node definition table. Just bring everything below it to top level.There's no need for another level and it just makes things complicated, also
tooldef
as name is very bad and misleading.on_read_node
/on_write_node
out and callcopy
/paste
from node definition directly.There might be some use for tool
on_read_node
and/oron_write_node
callbacks so it might be good to allow these but most tools just copy/paste exact same stuff there.Breaking changes for API, bump major version when releasing this
The text was updated successfully, but these errors were encountered: