Skip to content
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

[WORKING DRAFT] Better dungeon door detection/overlay #879

Merged

Conversation

GatienDoesStuff
Copy link
Contributor

I've just spent the day rewriting the code that detects dungeons doors.

Let me know if I'm doing anything wrong / there are any concerns regarding the proposed code.

Summary of changes compared to current implementation

  • Cleanup of now unused functions
  • Doors towards the blood room are now detected by looking at the map, allowing them to be rendered no matter where the player currently is in the dungeon (just like BetterMap does on 1.8)
  • This also means that the fairy room is now highlighted, which wasn't the case before
  • Fixes bugs related to the key being picked up naturally after it times out (the door wouldn't get recolored to green)

Concerns

  • Code quality ?

  • Hardcoded values for map colors, as well as position code that might not be easily understood

  • Currently, the doors are checked for every tick, which might not be a good thing for performance. It could be possible to only check when necessary :

    • Upon starting a run
    • Upon opening a door
    • Upon fairy room being discovered (harder to detect)

    Feel free to test those changes, things have been working pretty smoothly on my end, and I haven't been able to find any bugs / wrong placements for the doors.

@LifeIsAParadox LifeIsAParadox added the reviews needed This PR needs reviews label Jul 30, 2024
@GatienDoesStuff
Copy link
Contributor Author

Just did a dozen runs with this, and I haven't really found any issues, doors are rendering where they're expected to

Copy link
Collaborator

@kevinthegreat1 kevinthegreat1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some small things and formatting.

Comment on lines +398 to +399
}
else if (matchingRoomsSize == 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
else if (matchingRoomsSize == 1) {
} else if (matchingRoomsSize == 1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad on those, I didn't correctly apply the formatting config listed on the wiki.

While the other changes all apply just like you did, it seems like the formatter really doesn't want to have the else if on the same line as the closing bracket.
Is it a config I'm missing ? If I apply this, the next person to work on that file might just revert it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure. The intellij default keeps them on the same line.

@LifeIsAParadox LifeIsAParadox added changes requested This PR need changes and removed reviews needed This PR needs reviews labels Aug 6, 2024
@LifeIsAParadox LifeIsAParadox added reviews needed This PR needs reviews and removed changes requested This PR need changes labels Aug 6, 2024
Also threw in an extra comment regarding map colors, and fixed `doorPos` being `doorpos`.
@GatienDoesStuff
Copy link
Contributor Author

I believe this should be it, minus the small nitpick about else if above.

@LifeIsAParadox LifeIsAParadox added merge me please Pull requests that are ready to merge and removed reviews needed This PR needs reviews labels Aug 8, 2024
@AzureAaron AzureAaron added this to the 1.22 milestone Aug 8, 2024
@AzureAaron AzureAaron merged commit 367197d into SkyblockerMod:master Aug 9, 2024
1 check passed
@LifeIsAParadox LifeIsAParadox removed the merge me please Pull requests that are ready to merge label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants