-
Notifications
You must be signed in to change notification settings - Fork 722
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
WebHost: Refactor weighted-settings.js #2318
Conversation
badf79f
to
ca4810d
Compare
This moves most of the infrastructure into two classes: * WeightedSettings covers the settings page as a whole. It tracks the user's current settings in local storage as well as the game data from the server so they don't need to be manually passed around from function to function. * GameSettings covers the settings for a single game, and provides a view of the current settings and the game data just for that game.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from moving everything into classes, what benefit do we gain from this? This doesn't necessarily improve readability, and there is no new functionality present.
In addition to being slightly more efficient thanks to loading from This is particularly helpful when adding new data that needs to be passed through these functions. For example, I have a work-in-progress commit built on this that makes and another that adds the ability for worlds to provide descriptions for individual items and locations (the tooltip shows up on hover of course): Both of these are much easier if you can just directly access the data from |
I was trying to prevent change for the sake of change. I'm down if you have work in the pipeline which depends on these features. I realized as I was typing this I forgot to test whether changing a single setting and reloading the page preserves the setting change. So I'll do that later tonight, and merge if all is good. |
During some testing, I discovered a bug. The item pool quantities are not preserved upon a reload, and will always revert to
Link to the Past is visible in the screenshots below. |
Oops, fixed! I'd missed one call to |
* Refactor weighted-settings.js This moves most of the infrastructure into two classes: * WeightedSettings covers the settings page as a whole. It tracks the user's current settings in local storage as well as the game data from the server so they don't need to be manually passed around from function to function. * GameSettings covers the settings for a single game, and provides a view of the current settings and the game data just for that game. * Fix item count updating
* Refactor weighted-settings.js This moves most of the infrastructure into two classes: * WeightedSettings covers the settings page as a whole. It tracks the user's current settings in local storage as well as the game data from the server so they don't need to be manually passed around from function to function. * GameSettings covers the settings for a single game, and provides a view of the current settings and the game data just for that game. * Fix item count updating
What is this fixing or adding?
This moves most of the infrastructure into two classes:
WeightedSettings covers the settings page as a whole. It tracks the
user's current settings in local storage as well as the game data
from the server so they don't need to be manually passed around from
function to function.
GameSettings covers the settings for a single game, and provides a
view of the current settings and the game data just for that game.
How was this tested?
Manually tested adjusting settings, reloading from local storage, exporting to YAML, etc.