-
Notifications
You must be signed in to change notification settings - Fork 481
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
Added BoundsOverlay Rendermode Primitive #1336
base: master
Are you sure you want to change the base?
Conversation
Overlay bounds
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.
Overall: there is nothing critical here, but few changes need to be applied to increase code readability and overall code quality.
**/ | ||
// iterate over all the colors | ||
for ( col = 0; col < self->numcolors; col++) { | ||
any = false; |
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.
Code format need more care here and over the whole PR.
/** | ||
* Check if a sane option was passed. | ||
**/ | ||
if (opt && opt != Py_None) { |
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.
This if
is taking whole function with exception for one command at the end. I would invert it and close function fast. By example:
if (!opt || opt == Py_None) {
self->parent.get_color = get_color;
return 0;
}
There is one line which will be repeated, but overall this will increase code readability with limited number of levels.
/** | ||
* Try to parse the definitions of conditions and colors. | ||
**/ | ||
if (cont) { |
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.
Similar situation here, if not cond set parent color and return 0. There is no need to wait with this till the function end.
} | ||
} | ||
|
||
if (self->bounds) { |
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.
The same condition in two ifs side by side, join them into one if or fail fast if there is no self->bounds
.
As a response to #1332 and designed to Display land ownership on map.bitquest.co, I created a new RenderMode Primitive called
BoundsOverlay
. This rendermode overlays colors on the map within sets of bounding boxes, specified as multiple tuples of the form(minx, minz, maxx, maxz)
. So by specifying(0, 0, 16, 16)
all the blocks (inclusive) within the boundary created by these coordinates will be colored. The color is specified as(r, g, b, a)
.An example usage in the config.py would be:
with a result like:
I also updated the docs with example usage.