-
Notifications
You must be signed in to change notification settings - Fork 51
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 ChunkLock visualisation. #369
Conversation
For the impatient, here's a Windows-compiled version (Sorry that it needs a ton of supporting DLLs, I don't have a static Qt available) |
As I'm far away from any computer, I can not look into the code any time soon. Therefore, I start just asking some questions: It seems to be a datapack and not Vanilla feature. Therefore, I would expect the new menu entry only to show up when this datapack is detected. This might be something for WorldInfo class during initial parsing of the world folder. The current highlight seems to be a red border around the Chunk. With this, the border pixels are covered and not visible. Have you tested other rendering options? E.g. red shadow of complete Chunk. Can you think of any way to describe this feature as plugin in a JSON file and have some generic code supporting more mods of this kind? I mean a JSON file to describe how to detect that mod, how to detect mod data per Chunk, and a colour to render that Chunk. We could try something like this as second step. I do not mean you should do that now, just think about it. |
I haven't looked into hiding this the menu entry when the datapack is not present. Since the entry is effectively a no-op in such a case, I don't think it's super necessary to do so. As for the highlight, it's always 1-pixel wide, even with zoom, and the assumption is that one uses pretty high zoom levels when using this datapack anyway, so it should be good enough. With overlays over the whole chunk, we lose a lot of the information - suddenly blocks are different colors. I'm open to suggestions here, this is just something that I found works best for me right now. I could quickly change the rendering and provide an image for comparison. I've tried coming up with a way to describe such a feature in a generic way, but it's way too complicated - the datapack uses specific entities within each chunk, with specific tags, to store the needed information; since Minutor doesn't even store the complete entity info, it would mean a huge change in the data representation (and possibly performance). For rendering purposes, it makes much more sense to actually mark chunks with the properties, rather than keep an extra list of chunks to highlight. Not to mention this PR still doesn't provide the entire information, it only shows what kind of item is needed for unlocking, but doesn't show the amount needed - that is stored in the scoreboard, which aren't parsed by Minutor at all. Oh, I do see a way to do it generically: Add a Lua interpreter and some API, then we can make Lua code snippet to detect and parse and set the needed information :D Bring out the big cannons. |
Just wanted to say this is super cool and can't wait for it to get merged! Fwiw I definitely prefer the shaded representation of locked chunks (covering the entire chunk rather than just outlining), but not sure how well that would play with other visualisations active (such as spawners/igloos/etc.). |
I've been trying both visualisations for some time and I have to say that although the full-shading looks better at first glance, the framing actually feels much better for actual use. |
(I just asked if you compared them, I have no strong opinion yet. Probably I also have to try it out.) @madmaxoft @TizzySaurus could you please provide world downloads for testing? |
@EtlamGit Here you go, this is the world used for the screenshots above: |
@TizzySaurus Look at the single locked chunk at the center bottom in my comparison screenshots, just above the |
I personally don't have any issues recognising it, but maybe that's just a difference in monitor/lighting 🤷
I don't feel particularly strongly either way, and I can see cases where the framing would be more practical, and since that's what you've already got here I'm happy for it to stay the same. Have been doing some messing around with the other overlays and it seems the current framing is clear even with those on, so yeah, maybe best to just leave it.
I've got one here: https://www.mediafire.com/file/zrjfdxfue5tarvj/world.zip/file |
I still don't think the datapack detection is robust enough - it is based only on a filename, so if someone downloads the datapack under a different name (say the devs release the pack with a version in its name, or someone not english-speaking renames the file) the detection would get broken. It is also possible to have this datapack installed but deactivated, or the opposite - not installed, but still active (somewhat broken). This probably means the only reasonable way to detect the datapack is actually encountering the specific entities in the chunks themselves. But that is very late. |
When the pack is not enabled or the installation is broken, it is task for the user to fix it before he can play again. Therefore we do not have to support broken state. But you are right, we have to support renamed datapacks. And even more, the second example world used an unzipped variation of that datapack (yours is zipped). |
Here is a working dynamic menu for ChunkLock: It is only the menu entry, toggle flags and signal->slot connections are already in your code. It has just to be combined. |
I've decided against dynamic action creation and instead opted to have the action always present and only hide it if not detected. Qt already hides separators if two or more are next to each other, so the solution becomes trivial. I've also modified the drawing code a bit, added an adjustment for when the drawn chunk crosses the X or Y axis (in viewspace) - the rectangles were missing their bottom or right edges otherwise, most likely due to rounding / overdraw errors. |
I also observed the behavior of hiding the second separator. But I just got confused by this. I tested "fixed UI and then hiding" also, this is obviously easier. |
This adds a new View option, "ChunkLock", which frames in red all chunks that are currently locked by the ChunkLock resourcepack:
Also adds a note in the status bar, displaying the item needed for unlocking.