plenty of pretty patchi pages#53
Conversation
| <span class="collapse-recipe-show">{{ _('hexdoc.multiblock.show') }}</span> | ||
| <span class="collapse-recipe-hide">{{ _('hexdoc.multiblock.hide') }}</span> | ||
| </summary> | ||
| {% for entry in page.multiblock.bill_of_materials %} |
There was a problem hiding this comment.
i think jinja supports this
| {% for entry in page.multiblock.bill_of_materials %} | |
| {% for item, count in page.multiblock.bill_of_materials %} |
| for layer in self.pattern: | ||
| for row in layer: | ||
| for item in row: | ||
| if item in self.mapping: |
There was a problem hiding this comment.
the only cases where this would be false are (air), _ (any block), or an invalid page. imo we should ignore air, handle "any block" somehow, and raise otherwise if it's not found
There was a problem hiding this comment.
also 0 to mark the center or whatever it is ? I didn't know about the _ any block though.
There was a problem hiding this comment.
aha true! ...actually i can probably deal with this one if you want, many edge cases apparently
| bom_list = list[tuple[ItemWithTexture | TagWithTexture, int]]() | ||
| for item_key, count in bom.items(): | ||
| bom_list.append((self.mapping[item_key], count)) | ||
| return bom_list |
There was a problem hiding this comment.
maybe something like this? (untested)
| bom_list = list[tuple[ItemWithTexture | TagWithTexture, int]]() | |
| for item_key, count in bom.items(): | |
| bom_list.append((self.mapping[item_key], count)) | |
| return bom_list | |
| return sorted( | |
| (self.mapping[item], count) for item, count in bom.items(), | |
| key=lambda v: (v[1], v[0].name), | |
| ) |
There was a problem hiding this comment.
so... I don't like how duplicated everything is, but I'm planning on refactoring the recipe rendering anyway, so I guess it's ok for now.
Co-authored-by: [object Object] <object@objectobject.ca>
|
thanks! |
No description provided.