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

Core: Add toggles_as_bools to options.as_dict #3770

Merged
merged 6 commits into from
Dec 10, 2024

Conversation

Exempt-Medic
Copy link
Member

@Exempt-Medic Exempt-Medic commented Aug 11, 2024

What is this fixing or adding?

It's pretty common for a world to want their Toggle options to be Booleans and not Ints in slot_data, so this adds that as an option.

Might as well improve the typing while we're at it

How was this tested?

Generations and printing slot_data using options.as_dict with Toggle and DefaultOnToggle options.
Apparently PyCharm also said no more spaces in empty lines 🤷

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Aug 11, 2024
@Exempt-Medic Exempt-Medic added the is: enhancement Issues requesting new features or pull requests implementing new features. label Aug 11, 2024
@NewSoupVi
Copy link
Member

Seems nice to have to me

This is more of an "opinion" PR so like, probably need a couple more of those

Options.py Outdated Show resolved Hide resolved
Exempt-Medic and others added 2 commits August 15, 2024 20:31
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
@Exempt-Medic Exempt-Medic requested a review from beauxq August 16, 2024 00:33
@alwaysintreble
Copy link
Collaborator

alwaysintreble commented Aug 16, 2024

If we're going to this a kwarg to return current_key would be good too. I'm a bit against doing this because bools are more expensive to encode in slot_data than ints are, but the measurable difference is so minor and they're more convenient to use so eh. But ints are just as easy to parse on the client side.

@Exempt-Medic
Copy link
Member Author

Exempt-Medic commented Aug 16, 2024

If we're going to this a kwarg to return current_key would be good too. I'm a bit against doing this because bools are more expensive to encode in slot_data than ints are, but the measurable difference is so minor and they're more convenient to use so eh. But ints are just as easy to parse on the client side.

You could add that in another PR, I feel it's out of scope here, especially since current_key behavior varies by option type.

As far as the expensiveness of bools go, plenty of worlds are already using them, so if AP wanted to prevent that, they should have done so earlier

Options.py Show resolved Hide resolved
@Exempt-Medic Exempt-Medic requested a review from beauxq August 16, 2024 11:07
Copy link
Collaborator

@beauxq beauxq left a comment

Choose a reason for hiding this comment

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

I don't see problems with code.
I didn't test it.
I don't have an opinion on whether the feature should exist or not.

Options.py Outdated Show resolved Hide resolved
@NewSoupVi NewSoupVi merged commit 704f14f into ArchipelagoMW:main Dec 10, 2024
16 checks passed
@NewSoupVi
Copy link
Member

Oh wait, technically I was supposed to let Medic merge this themself now that they're a Core Maintainer... oh well :D

@Exempt-Medic Exempt-Medic deleted the as_dict-toggles_as_bools branch December 10, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants