-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add Lua API function to resolve node/collision/selection boxes #13964
Conversation
Idea: add a variant of the api that can work with a |
That's a good idea, I've implemented it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments are out of date, otherwise looks good, tested and works.
Also a nitpick / detail: Maybe it would make sense to return nil
for collision boxes if a node is not walkable / nil
for selection boxes if a node is not pointable / nil
for node boxes if a node doesn't use node boxes.
For selection boxes, returning |
For some purposes, it is useful for modders to be able to retrieve the actual collision or selection boxes of a node. This includes:
However, manually resolving node/collision/selection boxes in a node definition into actual boxes can be quite complex, depending on the type of box. Boxes can be facedir-rotated, wallmounted, leveled and/or connected. #11391 will further increase the number of cases to consider. There is a Lua implementation by @appgurueu: boxes.lua
This PR instead exposes the existing engine method for resolving boxes to the Lua API:
I also added the "Node Box Visualizer", a Devtest tool for testing the new function.
To do
This PR is a Ready for Review.
How to test
Start a Devtest world and get yourself the "Node Box Visualizer" tool. Press the place button to change the selected box type. Punch a node to show its boxes of the selected type.