Skip to content

Don't autosave immediately after purchasing from a shop#2079

Merged
dcvz merged 6 commits intoHarbourMasters:developfrom
jbodner09:dont-autosave-shops
Dec 10, 2022
Merged

Don't autosave immediately after purchasing from a shop#2079
dcvz merged 6 commits intoHarbourMasters:developfrom
jbodner09:dont-autosave-shops

Conversation

@jbodner09
Copy link
Contributor

@jbodner09 jbodner09 commented Dec 4, 2022

Players have found that there exists a moment in time between when an item is purchased and when it's actually paid for where autosave will kick in, and if the game is reset in between that time, then they'll get to keep the item without needing to pay for it. This fix prevents that by deferring autosave after purchasing items from shops until the rupee decrement is complete.

To do that, the pending sale item is stored in the save file, and autosave checks to see if there's a pending sale before it triggers.
After the rupee decrement is finished, autosave is called again, although it still follows whatever settings have been chosen as to whether or not it will save after obtaining a particular type of item. Closes #1823

Build Artifacts

@briaguya0
Copy link
Contributor

so this completely disables autosave when purchasing from shops? or just delays the autosave until the rupees have been taken. looking through the code it seems like it's the former. would it be possible to add an autosave call when the rupees finish getting taken?

@briaguya0 briaguya0 added the merge conflicts PR has conflicts that need to be resolved before it can be merged label Dec 5, 2022
@jbodner09
Copy link
Contributor Author

@briaguya-ai I can easily add an autosave call after the rupee decrement is finished since I need to fix the merge conflict I created for myself with my other PRs. Originally I didn't think it was too necessary since in most cases you'd be leaving the shop/grotto when you're finished and autosave would trigger then, but I think there are enough scrubs in big areas, especially with scrubsanity turned on, that it would still be useful.

@jbodner09 jbodner09 removed the merge conflicts PR has conflicts that need to be resolved before it can be merged label Dec 7, 2022
@jbodner09 jbodner09 changed the base branch from develop-flynn to develop December 8, 2022 18:27
Copy link
Contributor

@briaguya0 briaguya0 left a comment

Choose a reason for hiding this comment

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

I wish this could be done without touching so many places, but i can't think of a simpler way to implement all the functionality.

Let's :shipit:

Copy link
Contributor

@dcvz dcvz left a comment

Choose a reason for hiding this comment

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

@briaguya-ai since we're modifying so many places now, I wonder if instead of using it explicitly for saving the current item we should instead make a generic hook like 'itemWillBeGiven' or some better name. Allowing us a general API for hooking into some game actions.

@dcvz
Copy link
Contributor

dcvz commented Dec 10, 2022

Won't block this merge on this though.. will give it more thought in the background

@dcvz dcvz merged commit 26ec696 into HarbourMasters:develop Dec 10, 2022
@jbodner09 jbodner09 deleted the dont-autosave-shops branch December 10, 2022 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants