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

Add an option for always showing items received while offline #221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

thislooksfun
Copy link

I decided to take a stab at doing this myself. I'm happy to change it up if you'd rather it be done a different way.

Fixes #220.

@@ -153,7 +153,9 @@ private static void StartOrResumeGame(bool newGame, MenuLabel errorLabel)
}
else
{
Archipelago.Instance.MenuSettings = Archipelago.Instance.ApSettings with { };
Archipelago.Instance.MenuSettings = Archipelago.Instance.ApSettings with {
AlwaysShowItems = Archipelago.Instance.MenuSettings.AlwaysShowItems
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be needed

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately it is. Without that change the save-specific ApSettings will override the MenuSettings whenever a save file is loaded, which causes the AlwaysShowItems setting to be overridden. If you have another solution I'm happy to hear it, but this was the simplest fix I was able to find.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yuck didn't think of that. Settings really need to be refactored but there is just not a way to do it that doesn't break anyone with an existing install

Copy link
Author

Choose a reason for hiding this comment

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

I'm sure it's possible to do while still being backwards-compatible, but it was a bigger change than I wanted to make in this PR, so I opted for the simpler solution. I'm happy to take a crack at that refactor if you'd prefer it done that way though.

Archipelago.HollowKnight/Archipelago.cs Outdated Show resolved Hide resolved
@BadMagic100
Copy link
Contributor

This approach seems fine, was any testing done with this change?

@thislooksfun
Copy link
Author

This approach seems fine, was any testing done with this change?

Yes it was, I have been running this version for a while now. I have discovered one issue that I want to resolve though. It does what I want with getting items, but it doesn't behave quite as I'd like with other players collecting their items. That blocks for a very long time with irrelevant information. I want to take a stab at fixing that.

@thislooksfun
Copy link
Author

Ah, I've realized the issue. Releasing items while the game is running works as expected, but collecting items (via the AP server) does not. By that I mean that if a player !collects while this mod is running and connected, nothing will update until the save file is closed and re-opened. This can either be fixed so that !collecting while the mod is connected works instantly (and I'll add a second toggle for whether or not you want to list those items as well), or I can just never show the !collected items in the corner (but they still display in RecentItems, if that is installed, which is weird). I am personally leaning towards the former, but I'd like to hear your thoughts if you have any.

@thislooksfun thislooksfun marked this pull request as draft May 10, 2024 22:28
@thislooksfun
Copy link
Author

^ rebased onto main, and marked as draft until the collect issue is resolved.

@BadMagic100
Copy link
Contributor

So the collect issue is:

  • Player A is playing HK
  • Player B collects
  • Player A's client never sees that the items were collected until reloading the file?

That seems very odd, and strikes me as something which would be a multiclient issue. But if this is the case then I would tend to agree that the game should react immediately, and should probably not show the items either in the corner or recent items. Don't feel like it's worth it to be a toggle

@thislooksfun
Copy link
Author

thislooksfun commented May 11, 2024

So the collect issue is:
* Player A is playing HK
* Player B collects
* Player A's client never sees that the items were collected until reloading the file?

Correct.

That seems very odd, and strikes me as something which would be a multiclient issue.

Possibly. It might also be that the multiclient handles it correctly and this mod doesn't subscribe/react properly. This mod definitely doesn't handle the locations being checked mid-game by anyone other than the active HK player, but I haven't dug enough to know if there is something that the AP client is exposing that just isn't being plugged into. It's starting to sound like its own ticket though, so I shall file that in a moment. (edit: filed as #222)

But if this is the case then I would tend to agree that the game should react immediately, and should probably not show the items either in the corner or recent items. Don't feel like it's worth it to be a toggle

I both do and don't agree. I don't feel that we need to list every single item Player B collected, but it might be nice to show something to signal the player that things have changed. Maybe we could display a single message saying something like "Player B collected their remaining items"? That would keep it nice and short (only one entry in both the corner and RecentItems) while still letting the HK player know they should re-check their plan because the map state has changed.

@thislooksfun thislooksfun marked this pull request as ready for review May 12, 2024 03:44
@thislooksfun
Copy link
Author

Alright, I made it hide the collected items during load for now. That behavior can be revisited in #222 if desired. I made the change via a fixup commit for easier re-reviewing, and I will squash it down when its ready. Or I can do it now if you'd prefer.

// FROM this world, which can SERIOUSLY lock up the item display if someone collects a
// lot of their items at once (usually via the !collect command). It also prevents these
// items from displaying in RecentItemsDisplay (if installed) for the same reason.
MarkLocationAsChecked(location, true, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this also hide your own received items from recent items? That seems wrong.

@BadMagic100
Copy link
Contributor

This will be affected by 760eb05 which moves to use separate local and global settings classes with connection details as a member. So this setting would move out of connection details and onto global settings

@BadMagic100
Copy link
Contributor

Another thought on this, rather than a true/false on/off, we could have a "progression only" mode which only queues items classified as progression to the corner display

@thislooksfun
Copy link
Author

Ooh, that's not a bad idea. Should help cut down on some of the geo rock spam.

Sorry for totally dropping the ball on this PR btw, my motivation for working on this just vanished and I haven't managed to find it again yet.

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.

Newly acquired items no longer show when connecting to an ongoing game
2 participants