-
Notifications
You must be signed in to change notification settings - Fork 703
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
Super Mario 64: ItemData class and tables #4321
base: main
Are you sure you want to change the base?
Conversation
worlds/sm64ex/Items.py
Outdated
@@ -1,47 +1,59 @@ | |||
from BaseClasses import Item | |||
from typing import Dict, NamedTuple, Optional |
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.
Should be able to just use dict
since 3.8/3.9 was dropped
worlds/sm64ex/Items.py
Outdated
"Vanish Cap": 3626183, | ||
"1Up Mushroom": 3626184 | ||
class SM64ItemData(NamedTuple): | ||
code: Optional[int] = None |
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.
Can do this now too (and remove the Optional import)
code: Optional[int] = None | |
code: int | None = None |
worlds/sm64ex/Items.py
Outdated
item_table = {name: data.code for name, data in item_data_table.items() if data.code is not None} |
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.
Might as well add the EoF newline now
item_table = {name: data.code for name, data in item_data_table.items() if data.code is not None} | |
item_table = {name: data.code for name, data in item_data_table.items() if data.code is not None} | |
It's probably fine to add them, but just letting you know that |
Did I mess up the implementation or did item descriptions brake between #2409/#2508 and now? |
When the options system was overhauled, their functionality was removed. DS3 still has them, they just don't do anything. I believe you added them correctly |
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.
Sorry, but I don't think I'm in favor of this change. It seems to introduce a lot of redundancy for very little benefit, if at all.
Adding the item classification into the table just means that there's now another field that has to be filled in.
The existing solution with the if-else looks ugly, but to me preferable than giving the classification explicitly for every item.
Explicitly stating classification for each item doesn't have to be necessary if the same if-else logic is ported to the item tables where the default classification of items is progressive. Code has been updated to show this change if verbosity was the main downside of this change.
💀. Removed. |
What is this fixing or adding?
Adds an ItemData class to include
ItemClassification
in the item tables, similar to other worlds.create_item
.How was this tested?
MoveRandomizerActions
inOptions.py
).